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