Panda3D
 All Classes Functions Variables Enumerations
interrogateType.I
1 // Filename: interrogateType.I
2 // Created by: drose (31Jul00)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: InterrogateType::is_global
18 // Access: Public
19 // Description: Returns true if the type is marked as 'global'. This
20 // means only that it should appear in the global type
21 // list.
22 ////////////////////////////////////////////////////////////////////
23 INLINE bool InterrogateType::
24 is_global() const {
25  return (_flags & F_global) != 0;
26 }
27 
28 ////////////////////////////////////////////////////////////////////
29 // Function: InterrogateType::has_scoped_name
30 // Access: Public
31 // Description:
32 ////////////////////////////////////////////////////////////////////
33 INLINE bool InterrogateType::
34 has_scoped_name() const {
35  return !_scoped_name.empty();
36 }
37 
38 ////////////////////////////////////////////////////////////////////
39 // Function: InterrogateType::get_scoped_name
40 // Access: Public
41 // Description:
42 ////////////////////////////////////////////////////////////////////
43 INLINE const string &InterrogateType::
44 get_scoped_name() const {
45  return _scoped_name;
46 }
47 
48 ////////////////////////////////////////////////////////////////////
49 // Function: InterrogateType::has_true_name
50 // Access: Public
51 // Description:
52 ////////////////////////////////////////////////////////////////////
53 INLINE bool InterrogateType::
54 has_true_name() const {
55  return !_true_name.empty();
56 }
57 
58 ////////////////////////////////////////////////////////////////////
59 // Function: InterrogateType::get_true_name
60 // Access: Public
61 // Description:
62 ////////////////////////////////////////////////////////////////////
63 INLINE const string &InterrogateType::
64 get_true_name() const {
65  return _true_name;
66 }
67 
68 ////////////////////////////////////////////////////////////////////
69 // Function: InterrogateType::has_comment
70 // Access: Public
71 // Description:
72 ////////////////////////////////////////////////////////////////////
73 INLINE bool InterrogateType::
74 has_comment() const {
75  return !_comment.empty();
76 }
77 
78 ////////////////////////////////////////////////////////////////////
79 // Function: InterrogateType::get_comment
80 // Access: Public
81 // Description:
82 ////////////////////////////////////////////////////////////////////
83 INLINE const string &InterrogateType::
84 get_comment() const {
85  return _comment;
86 }
87 
88 ////////////////////////////////////////////////////////////////////
89 // Function: InterrogateType::is_nested
90 // Access: Public
91 // Description: Returns true if this type is nested within some class
92 // definition.
93 ////////////////////////////////////////////////////////////////////
94 INLINE bool InterrogateType::
95 is_nested() const {
96  return (_flags & F_nested) != 0;
97 }
98 
99 ////////////////////////////////////////////////////////////////////
100 // Function: InterrogateType::get_outer_class
101 // Access: Public
102 // Description: If is_nested() returns true, this is the class within
103 // which this type is defined.
104 ////////////////////////////////////////////////////////////////////
105 INLINE TypeIndex InterrogateType::
107  return _outer_class;
108 }
109 
110 ////////////////////////////////////////////////////////////////////
111 // Function: InterrogateType::is_atomic
112 // Access: Public
113 // Description:
114 ////////////////////////////////////////////////////////////////////
115 INLINE bool InterrogateType::
116 is_atomic() const {
117  return (_flags & F_atomic) != 0;
118 }
119 
120 ////////////////////////////////////////////////////////////////////
121 // Function: InterrogateType::get_atomic_token
122 // Access: Public
123 // Description:
124 ////////////////////////////////////////////////////////////////////
125 INLINE AtomicToken InterrogateType::
126 get_atomic_token() const {
127  return _atomic_token;
128 }
129 
130 ////////////////////////////////////////////////////////////////////
131 // Function: InterrogateType::is_unsigned
132 // Access: Public
133 // Description:
134 ////////////////////////////////////////////////////////////////////
135 INLINE bool InterrogateType::
136 is_unsigned() const {
137  return (_flags & F_unsigned) != 0;
138 }
139 
140 ////////////////////////////////////////////////////////////////////
141 // Function: InterrogateType::is_signed
142 // Access: Public
143 // Description:
144 ////////////////////////////////////////////////////////////////////
145 INLINE bool InterrogateType::
146 is_signed() const {
147  return (_flags & F_signed) != 0;
148 }
149 
150 ////////////////////////////////////////////////////////////////////
151 // Function: InterrogateType::is_long
152 // Access: Public
153 // Description:
154 ////////////////////////////////////////////////////////////////////
155 INLINE bool InterrogateType::
156 is_long() const {
157  return (_flags & F_long) != 0;
158 }
159 
160 ////////////////////////////////////////////////////////////////////
161 // Function: InterrogateType::is_longlong
162 // Access: Public
163 // Description:
164 ////////////////////////////////////////////////////////////////////
165 INLINE bool InterrogateType::
166 is_longlong() const {
167  return (_flags & F_longlong) != 0;
168 }
169 
170 ////////////////////////////////////////////////////////////////////
171 // Function: InterrogateType::is_short
172 // Access: Public
173 // Description:
174 ////////////////////////////////////////////////////////////////////
175 INLINE bool InterrogateType::
176 is_short() const {
177  return (_flags & F_short) != 0;
178 }
179 
180 ////////////////////////////////////////////////////////////////////
181 // Function: InterrogateType::is_wrapped
182 // Access: Public
183 // Description:
184 ////////////////////////////////////////////////////////////////////
185 INLINE bool InterrogateType::
186 is_wrapped() const {
187  return (_flags & F_wrapped) != 0;
188 }
189 
190 ////////////////////////////////////////////////////////////////////
191 // Function: InterrogateType::is_pointer
192 // Access: Public
193 // Description:
194 ////////////////////////////////////////////////////////////////////
195 INLINE bool InterrogateType::
196 is_pointer() const {
197  return (_flags & F_pointer) != 0;
198 }
199 
200 ////////////////////////////////////////////////////////////////////
201 // Function: InterrogateType::is_const
202 // Access: Public
203 // Description:
204 ////////////////////////////////////////////////////////////////////
205 INLINE bool InterrogateType::
206 is_const() const {
207  return (_flags & F_const) != 0;
208 }
209 
210 ////////////////////////////////////////////////////////////////////
211 // Function: InterrogateType::is_typedef
212 // Access: Public
213 // Description:
214 ////////////////////////////////////////////////////////////////////
215 INLINE bool InterrogateType::
216 is_typedef() const {
217  return (_flags & F_typedef) != 0;
218 }
219 
220 ////////////////////////////////////////////////////////////////////
221 // Function: InterrogateType::get_wrapped_type
222 // Access: Public
223 // Description:
224 ////////////////////////////////////////////////////////////////////
225 INLINE TypeIndex InterrogateType::
226 get_wrapped_type() const {
227  return _wrapped_type;
228 }
229 
230 ////////////////////////////////////////////////////////////////////
231 // Function: InterrogateType::is_array
232 // Access: Public
233 // Description:
234 ////////////////////////////////////////////////////////////////////
235 INLINE bool InterrogateType::
236 is_array() const {
237  return (_flags & F_array) != 0;
238 }
239 
240 ////////////////////////////////////////////////////////////////////
241 // Function: InterrogateType::get_array_size
242 // Access: Public
243 // Description:
244 ////////////////////////////////////////////////////////////////////
245 INLINE int InterrogateType::
246 get_array_size() const {
247  return _array_size;
248 }
249 
250 ////////////////////////////////////////////////////////////////////
251 // Function: InterrogateType::is_enum
252 // Access: Public
253 // Description:
254 ////////////////////////////////////////////////////////////////////
255 INLINE bool InterrogateType::
256 is_enum() const {
257  return (_flags & F_enum) != 0;
258 }
259 
260 ////////////////////////////////////////////////////////////////////
261 // Function: InterrogateType::number_of_enum_values
262 // Access: Public
263 // Description:
264 ////////////////////////////////////////////////////////////////////
265 INLINE int InterrogateType::
266 number_of_enum_values() const {
267  return _enum_values.size();
268 }
269 
270 ////////////////////////////////////////////////////////////////////
271 // Function: InterrogateType::get_enum_value_name
272 // Access: Public
273 // Description:
274 ////////////////////////////////////////////////////////////////////
275 INLINE const string &InterrogateType::
276 get_enum_value_name(int n) const {
277  if (n >= 0 && n < (int)_enum_values.size()) {
278  return _enum_values[n]._name;
279  }
280  return _empty_string;
281 }
282 
283 ////////////////////////////////////////////////////////////////////
284 // Function: InterrogateType::get_enum_value_scoped_name
285 // Access: Public
286 // Description:
287 ////////////////////////////////////////////////////////////////////
288 INLINE const string &InterrogateType::
289 get_enum_value_scoped_name(int n) const {
290  if (n >= 0 && n < (int)_enum_values.size()) {
291  return _enum_values[n]._scoped_name;
292  }
293  return _empty_string;
294 }
295 
296 ////////////////////////////////////////////////////////////////////
297 // Function: InterrogateType::get_enum_value_comment
298 // Access: Public
299 // Description:
300 ////////////////////////////////////////////////////////////////////
301 INLINE const string &InterrogateType::
302 get_enum_value_comment(int n) const {
303  if (n >= 0 && n < (int)_enum_values.size()) {
304  return _enum_values[n]._comment;
305  }
306  return _empty_string;
307 }
308 
309 ////////////////////////////////////////////////////////////////////
310 // Function: InterrogateType::get_enum_value
311 // Access: Public
312 // Description:
313 ////////////////////////////////////////////////////////////////////
314 INLINE int InterrogateType::
315 get_enum_value(int n) const {
316  if (n >= 0 && n < (int)_enum_values.size()) {
317  return _enum_values[n]._value;
318  }
319  return 0;
320 }
321 
322 ////////////////////////////////////////////////////////////////////
323 // Function: InterrogateType::is_struct
324 // Access: Public
325 // Description:
326 ////////////////////////////////////////////////////////////////////
327 INLINE bool InterrogateType::
328 is_struct() const {
329  return (_flags & F_struct) != 0;
330 }
331 
332 ////////////////////////////////////////////////////////////////////
333 // Function: InterrogateType::is_class
334 // Access: Public
335 // Description:
336 ////////////////////////////////////////////////////////////////////
337 INLINE bool InterrogateType::
338 is_class() const {
339  return (_flags & F_class) != 0;
340 }
341 
342 ////////////////////////////////////////////////////////////////////
343 // Function: InterrogateType::is_union
344 // Access: Public
345 // Description:
346 ////////////////////////////////////////////////////////////////////
347 INLINE bool InterrogateType::
348 is_union() const {
349  return (_flags & F_union) != 0;
350 }
351 
352 ////////////////////////////////////////////////////////////////////
353 // Function: InterrogateType::is_fully_defined
354 // Access: Public
355 // Description:
356 ////////////////////////////////////////////////////////////////////
357 INLINE bool InterrogateType::
358 is_fully_defined() const {
359  return (_flags & F_fully_defined) != 0;
360 }
361 
362 ////////////////////////////////////////////////////////////////////
363 // Function: InterrogateType::is_unpublished
364 // Access: Public
365 // Description: Returns true if the type is an unpublished type.
366 // This either means the type is a nested type, and it
367 // is protected or private within its scope, or that its
368 // definition is simply not marked as 'published'.
369 ////////////////////////////////////////////////////////////////////
370 INLINE bool InterrogateType::
371 is_unpublished() const {
372  return (_flags & F_unpublished) != 0;
373 }
374 
375 ////////////////////////////////////////////////////////////////////
376 // Function: InterrogateType::number_of_constructors
377 // Access: Public
378 // Description:
379 ////////////////////////////////////////////////////////////////////
380 INLINE int InterrogateType::
381 number_of_constructors() const {
382  return _constructors.size();
383 }
384 
385 ////////////////////////////////////////////////////////////////////
386 // Function: InterrogateType::get_constructor
387 // Access: Public
388 // Description:
389 ////////////////////////////////////////////////////////////////////
390 INLINE FunctionIndex InterrogateType::
391 get_constructor(int n) const {
392  if (n >= 0 && n < (int)_constructors.size()) {
393  return _constructors[n];
394  } else {
395  return 0;
396  }
397 }
398 
399 ////////////////////////////////////////////////////////////////////
400 // Function: InterrogateType::has_destructor
401 // Access: Public
402 // Description:
403 ////////////////////////////////////////////////////////////////////
404 INLINE bool InterrogateType::
405 has_destructor() const {
406  return (_destructor != 0);
407 }
408 
409 ////////////////////////////////////////////////////////////////////
410 // Function: InterrogateType::destructor_is_inherited
411 // Access: Public
412 // Description:
413 ////////////////////////////////////////////////////////////////////
414 INLINE bool InterrogateType::
415 destructor_is_inherited() const {
416  return (_flags & F_inherited_destructor) != 0;
417 }
418 
419 ////////////////////////////////////////////////////////////////////
420 // Function: InterrogateType::get_destructor
421 // Access: Public
422 // Description:
423 ////////////////////////////////////////////////////////////////////
424 INLINE FunctionIndex InterrogateType::
425 get_destructor() const {
426  return _destructor;
427 }
428 
429 ////////////////////////////////////////////////////////////////////
430 // Function: InterrogateType::number_of_elements
431 // Access: Public
432 // Description:
433 ////////////////////////////////////////////////////////////////////
434 INLINE int InterrogateType::
435 number_of_elements() const {
436  return _elements.size();
437 }
438 
439 ////////////////////////////////////////////////////////////////////
440 // Function: InterrogateType::get_element
441 // Access: Public
442 // Description:
443 ////////////////////////////////////////////////////////////////////
444 INLINE ElementIndex InterrogateType::
445 get_element(int n) const {
446  if (n >= 0 && n < (int)_elements.size()) {
447  return _elements[n];
448  } else {
449  return 0;
450  }
451 }
452 
453 ////////////////////////////////////////////////////////////////////
454 // Function: InterrogateType::number_of_methods
455 // Access: Public
456 // Description:
457 ////////////////////////////////////////////////////////////////////
458 INLINE int InterrogateType::
459 number_of_methods() const {
460  return _methods.size();
461 }
462 
463 ////////////////////////////////////////////////////////////////////
464 // Function: InterrogateType::get_method
465 // Access: Public
466 // Description:
467 ////////////////////////////////////////////////////////////////////
468 INLINE FunctionIndex InterrogateType::
469 get_method(int n) const {
470  if (n >= 0 && n < (int)_methods.size()) {
471  return _methods[n];
472  } else {
473  return 0;
474  }
475 }
476 
477 ////////////////////////////////////////////////////////////////////
478 // Function: InterrogateType::number_of_make_seqs
479 // Access: Public
480 // Description:
481 ////////////////////////////////////////////////////////////////////
482 INLINE int InterrogateType::
483 number_of_make_seqs() const {
484  return _make_seqs.size();
485 }
486 
487 ////////////////////////////////////////////////////////////////////
488 // Function: InterrogateType::get_make_seq
489 // Access: Public
490 // Description:
491 ////////////////////////////////////////////////////////////////////
492 INLINE MakeSeqIndex InterrogateType::
493 get_make_seq(int n) const {
494  if (n >= 0 && n < (int)_make_seqs.size()) {
495  return _make_seqs[n];
496  } else {
497  return 0;
498  }
499 }
500 
501 ////////////////////////////////////////////////////////////////////
502 // Function: InterrogateType::number_of_casts
503 // Access: Public
504 // Description:
505 ////////////////////////////////////////////////////////////////////
506 INLINE int InterrogateType::
507 number_of_casts() const {
508  return _casts.size();
509 }
510 
511 ////////////////////////////////////////////////////////////////////
512 // Function: InterrogateType::get_cast
513 // Access: Public
514 // Description:
515 ////////////////////////////////////////////////////////////////////
516 INLINE FunctionIndex InterrogateType::
517 get_cast(int n) const {
518  if (n >= 0 && n < (int)_casts.size()) {
519  return _casts[n];
520  } else {
521  return 0;
522  }
523 }
524 
525 ////////////////////////////////////////////////////////////////////
526 // Function: InterrogateType::number_of_derivations
527 // Access: Public
528 // Description:
529 ////////////////////////////////////////////////////////////////////
530 INLINE int InterrogateType::
531 number_of_derivations() const {
532  return _derivations.size();
533 }
534 
535 ////////////////////////////////////////////////////////////////////
536 // Function: InterrogateType::get_derivation
537 // Access: Public
538 // Description:
539 ////////////////////////////////////////////////////////////////////
540 INLINE TypeIndex InterrogateType::
541 get_derivation(int n) const {
542  if (n >= 0 && n < (int)_derivations.size()) {
543  return _derivations[n]._base;
544  } else {
545  return 0;
546  }
547 }
548 
549 ////////////////////////////////////////////////////////////////////
550 // Function: InterrogateType::derivation_has_upcast
551 // Access: Public
552 // Description:
553 ////////////////////////////////////////////////////////////////////
554 INLINE bool InterrogateType::
555 derivation_has_upcast(int n) const {
556  if (n >= 0 && n < (int)_derivations.size()) {
557  return (_derivations[n]._flags & DF_upcast) != 0;
558  } else {
559  return false;
560  }
561 }
562 
563 ////////////////////////////////////////////////////////////////////
564 // Function: InterrogateType::derivation_get_upcast
565 // Access: Public
566 // Description:
567 ////////////////////////////////////////////////////////////////////
568 INLINE TypeIndex InterrogateType::
569 derivation_get_upcast(int n) const {
570  if (n >= 0 && n < (int)_derivations.size()) {
571  return _derivations[n]._upcast;
572  } else {
573  return 0;
574  }
575 }
576 
577 ////////////////////////////////////////////////////////////////////
578 // Function: InterrogateType::derivation_downcast_is_impossible
579 // Access: Public
580 // Description:
581 ////////////////////////////////////////////////////////////////////
582 INLINE bool InterrogateType::
583 derivation_downcast_is_impossible(int n) const {
584  if (n >= 0 && n < (int)_derivations.size()) {
585  return (_derivations[n]._flags & DF_downcast_impossible) != 0;
586  } else {
587  return false;
588  }
589 }
590 
591 ////////////////////////////////////////////////////////////////////
592 // Function: InterrogateType::derivation_has_downcast
593 // Access: Public
594 // Description:
595 ////////////////////////////////////////////////////////////////////
596 INLINE bool InterrogateType::
597 derivation_has_downcast(int n) const {
598  if (n >= 0 && n < (int)_derivations.size()) {
599  return (_derivations[n]._flags & DF_downcast) != 0;
600  } else {
601  return false;
602  }
603 }
604 
605 ////////////////////////////////////////////////////////////////////
606 // Function: InterrogateType::derivation_get_downcast
607 // Access: Public
608 // Description:
609 ////////////////////////////////////////////////////////////////////
610 INLINE TypeIndex InterrogateType::
611 derivation_get_downcast(int n) const {
612  if (n >= 0 && n < (int)_derivations.size()) {
613  return _derivations[n]._downcast;
614  } else {
615  return 0;
616  }
617 }
618 
619 ////////////////////////////////////////////////////////////////////
620 // Function: InterrogateType::number_of_nested_types
621 // Access: Public
622 // Description:
623 ////////////////////////////////////////////////////////////////////
624 INLINE int InterrogateType::
625 number_of_nested_types() const {
626  return _nested_types.size();
627 }
628 
629 ////////////////////////////////////////////////////////////////////
630 // Function: InterrogateType::get_nested_type
631 // Access: Public
632 // Description:
633 ////////////////////////////////////////////////////////////////////
634 INLINE TypeIndex InterrogateType::
635 get_nested_type(int n) const {
636  if (n >= 0 && n < (int)_nested_types.size()) {
637  return _nested_types[n];
638  } else {
639  return 0;
640  }
641 }
642 
643 INLINE ostream &
644 operator << (ostream &out, const InterrogateType &type) {
645  type.output(out);
646  return out;
647 }
648 
649 INLINE istream &
650 operator >> (istream &in, InterrogateType &type) {
651  type.input(in);
652  return in;
653 }
654 
655 INLINE ostream &
656 operator << (ostream &out, const InterrogateType::Derivation &d) {
657  d.output(out);
658  return out;
659 }
660 
661 INLINE istream &
662 operator >> (istream &in, InterrogateType::Derivation &d) {
663  d.input(in);
664  return in;
665 }
666 
667 INLINE ostream &
668 operator << (ostream &out, const InterrogateType::EnumValue &ev) {
669  ev.output(out);
670  return out;
671 }
672 
673 INLINE istream &
674 operator >> (istream &in, InterrogateType::EnumValue &ev) {
675  ev.input(in);
676  return in;
677 }
678 
bool is_global() const
Returns true if the type is marked as &#39;global&#39;.
void input(istream &in)
Reads the data file as previously formatted by output().
bool is_unpublished() const
Returns true if the type is an unpublished type.
An internal representation of a type.
TypeIndex get_outer_class() const
If is_nested() returns true, this is the class within which this type is defined. ...
void output(ostream &out) const
Formats the InterrogateType data for output to a data file.
bool is_nested() const
Returns true if this type is nested within some class definition.