00001 // Filename: interrogateType.I 00002 // Created by: drose (31Jul00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 00016 //////////////////////////////////////////////////////////////////// 00017 // Function: InterrogateType::is_global 00018 // Access: Public 00019 // Description: Returns true if the type is marked as 'global'. This 00020 // means only that it should appear in the global type 00021 // list. 00022 //////////////////////////////////////////////////////////////////// 00023 INLINE bool InterrogateType:: 00024 is_global() const { 00025 return (_flags & F_global) != 0; 00026 } 00027 00028 //////////////////////////////////////////////////////////////////// 00029 // Function: InterrogateType::has_scoped_name 00030 // Access: Public 00031 // Description: 00032 //////////////////////////////////////////////////////////////////// 00033 INLINE bool InterrogateType:: 00034 has_scoped_name() const { 00035 return !_scoped_name.empty(); 00036 } 00037 00038 //////////////////////////////////////////////////////////////////// 00039 // Function: InterrogateType::get_scoped_name 00040 // Access: Public 00041 // Description: 00042 //////////////////////////////////////////////////////////////////// 00043 INLINE const string &InterrogateType:: 00044 get_scoped_name() const { 00045 return _scoped_name; 00046 } 00047 00048 //////////////////////////////////////////////////////////////////// 00049 // Function: InterrogateType::has_true_name 00050 // Access: Public 00051 // Description: 00052 //////////////////////////////////////////////////////////////////// 00053 INLINE bool InterrogateType:: 00054 has_true_name() const { 00055 return !_true_name.empty(); 00056 } 00057 00058 //////////////////////////////////////////////////////////////////// 00059 // Function: InterrogateType::get_true_name 00060 // Access: Public 00061 // Description: 00062 //////////////////////////////////////////////////////////////////// 00063 INLINE const string &InterrogateType:: 00064 get_true_name() const { 00065 return _true_name; 00066 } 00067 00068 //////////////////////////////////////////////////////////////////// 00069 // Function: InterrogateType::has_comment 00070 // Access: Public 00071 // Description: 00072 //////////////////////////////////////////////////////////////////// 00073 INLINE bool InterrogateType:: 00074 has_comment() const { 00075 return !_comment.empty(); 00076 } 00077 00078 //////////////////////////////////////////////////////////////////// 00079 // Function: InterrogateType::get_comment 00080 // Access: Public 00081 // Description: 00082 //////////////////////////////////////////////////////////////////// 00083 INLINE const string &InterrogateType:: 00084 get_comment() const { 00085 return _comment; 00086 } 00087 00088 //////////////////////////////////////////////////////////////////// 00089 // Function: InterrogateType::is_nested 00090 // Access: Public 00091 // Description: Returns true if this type is nested within some class 00092 // definition. 00093 //////////////////////////////////////////////////////////////////// 00094 INLINE bool InterrogateType:: 00095 is_nested() const { 00096 return (_flags & F_nested) != 0; 00097 } 00098 00099 //////////////////////////////////////////////////////////////////// 00100 // Function: InterrogateType::get_outer_class 00101 // Access: Public 00102 // Description: If is_nested() returns true, this is the class within 00103 // which this type is defined. 00104 //////////////////////////////////////////////////////////////////// 00105 INLINE TypeIndex InterrogateType:: 00106 get_outer_class() const { 00107 return _outer_class; 00108 } 00109 00110 //////////////////////////////////////////////////////////////////// 00111 // Function: InterrogateType::is_atomic 00112 // Access: Public 00113 // Description: 00114 //////////////////////////////////////////////////////////////////// 00115 INLINE bool InterrogateType:: 00116 is_atomic() const { 00117 return (_flags & F_atomic) != 0; 00118 } 00119 00120 //////////////////////////////////////////////////////////////////// 00121 // Function: InterrogateType::get_atomic_token 00122 // Access: Public 00123 // Description: 00124 //////////////////////////////////////////////////////////////////// 00125 INLINE AtomicToken InterrogateType:: 00126 get_atomic_token() const { 00127 return _atomic_token; 00128 } 00129 00130 //////////////////////////////////////////////////////////////////// 00131 // Function: InterrogateType::is_unsigned 00132 // Access: Public 00133 // Description: 00134 //////////////////////////////////////////////////////////////////// 00135 INLINE bool InterrogateType:: 00136 is_unsigned() const { 00137 return (_flags & F_unsigned) != 0; 00138 } 00139 00140 //////////////////////////////////////////////////////////////////// 00141 // Function: InterrogateType::is_signed 00142 // Access: Public 00143 // Description: 00144 //////////////////////////////////////////////////////////////////// 00145 INLINE bool InterrogateType:: 00146 is_signed() const { 00147 return (_flags & F_signed) != 0; 00148 } 00149 00150 //////////////////////////////////////////////////////////////////// 00151 // Function: InterrogateType::is_long 00152 // Access: Public 00153 // Description: 00154 //////////////////////////////////////////////////////////////////// 00155 INLINE bool InterrogateType:: 00156 is_long() const { 00157 return (_flags & F_long) != 0; 00158 } 00159 00160 //////////////////////////////////////////////////////////////////// 00161 // Function: InterrogateType::is_longlong 00162 // Access: Public 00163 // Description: 00164 //////////////////////////////////////////////////////////////////// 00165 INLINE bool InterrogateType:: 00166 is_longlong() const { 00167 return (_flags & F_longlong) != 0; 00168 } 00169 00170 //////////////////////////////////////////////////////////////////// 00171 // Function: InterrogateType::is_short 00172 // Access: Public 00173 // Description: 00174 //////////////////////////////////////////////////////////////////// 00175 INLINE bool InterrogateType:: 00176 is_short() const { 00177 return (_flags & F_short) != 0; 00178 } 00179 00180 //////////////////////////////////////////////////////////////////// 00181 // Function: InterrogateType::is_wrapped 00182 // Access: Public 00183 // Description: 00184 //////////////////////////////////////////////////////////////////// 00185 INLINE bool InterrogateType:: 00186 is_wrapped() const { 00187 return (_flags & F_wrapped) != 0; 00188 } 00189 00190 //////////////////////////////////////////////////////////////////// 00191 // Function: InterrogateType::is_pointer 00192 // Access: Public 00193 // Description: 00194 //////////////////////////////////////////////////////////////////// 00195 INLINE bool InterrogateType:: 00196 is_pointer() const { 00197 return (_flags & F_pointer) != 0; 00198 } 00199 00200 //////////////////////////////////////////////////////////////////// 00201 // Function: InterrogateType::is_const 00202 // Access: Public 00203 // Description: 00204 //////////////////////////////////////////////////////////////////// 00205 INLINE bool InterrogateType:: 00206 is_const() const { 00207 return (_flags & F_const) != 0; 00208 } 00209 00210 //////////////////////////////////////////////////////////////////// 00211 // Function: InterrogateType::get_wrapped_type 00212 // Access: Public 00213 // Description: 00214 //////////////////////////////////////////////////////////////////// 00215 INLINE TypeIndex InterrogateType:: 00216 get_wrapped_type() const { 00217 return _wrapped_type; 00218 } 00219 00220 //////////////////////////////////////////////////////////////////// 00221 // Function: InterrogateType::is_enum 00222 // Access: Public 00223 // Description: 00224 //////////////////////////////////////////////////////////////////// 00225 INLINE bool InterrogateType:: 00226 is_enum() const { 00227 return (_flags & F_enum) != 0; 00228 } 00229 00230 //////////////////////////////////////////////////////////////////// 00231 // Function: InterrogateType::number_of_enum_values 00232 // Access: Public 00233 // Description: 00234 //////////////////////////////////////////////////////////////////// 00235 INLINE int InterrogateType:: 00236 number_of_enum_values() const { 00237 return _enum_values.size(); 00238 } 00239 00240 //////////////////////////////////////////////////////////////////// 00241 // Function: InterrogateType::get_enum_value_name 00242 // Access: Public 00243 // Description: 00244 //////////////////////////////////////////////////////////////////// 00245 INLINE const string &InterrogateType:: 00246 get_enum_value_name(int n) const { 00247 if (n >= 0 && n < (int)_enum_values.size()) { 00248 return _enum_values[n]._name; 00249 } 00250 return _empty_string; 00251 } 00252 00253 //////////////////////////////////////////////////////////////////// 00254 // Function: InterrogateType::get_enum_value_scoped_name 00255 // Access: Public 00256 // Description: 00257 //////////////////////////////////////////////////////////////////// 00258 INLINE const string &InterrogateType:: 00259 get_enum_value_scoped_name(int n) const { 00260 if (n >= 0 && n < (int)_enum_values.size()) { 00261 return _enum_values[n]._scoped_name; 00262 } 00263 return _empty_string; 00264 } 00265 00266 //////////////////////////////////////////////////////////////////// 00267 // Function: InterrogateType::get_enum_value 00268 // Access: Public 00269 // Description: 00270 //////////////////////////////////////////////////////////////////// 00271 INLINE int InterrogateType:: 00272 get_enum_value(int n) const { 00273 if (n >= 0 && n < (int)_enum_values.size()) { 00274 return _enum_values[n]._value; 00275 } 00276 return 0; 00277 } 00278 00279 //////////////////////////////////////////////////////////////////// 00280 // Function: InterrogateType::is_struct 00281 // Access: Public 00282 // Description: 00283 //////////////////////////////////////////////////////////////////// 00284 INLINE bool InterrogateType:: 00285 is_struct() const { 00286 return (_flags & F_struct) != 0; 00287 } 00288 00289 //////////////////////////////////////////////////////////////////// 00290 // Function: InterrogateType::is_class 00291 // Access: Public 00292 // Description: 00293 //////////////////////////////////////////////////////////////////// 00294 INLINE bool InterrogateType:: 00295 is_class() const { 00296 return (_flags & F_class) != 0; 00297 } 00298 00299 //////////////////////////////////////////////////////////////////// 00300 // Function: InterrogateType::is_union 00301 // Access: Public 00302 // Description: 00303 //////////////////////////////////////////////////////////////////// 00304 INLINE bool InterrogateType:: 00305 is_union() const { 00306 return (_flags & F_union) != 0; 00307 } 00308 00309 //////////////////////////////////////////////////////////////////// 00310 // Function: InterrogateType::is_fully_defined 00311 // Access: Public 00312 // Description: 00313 //////////////////////////////////////////////////////////////////// 00314 INLINE bool InterrogateType:: 00315 is_fully_defined() const { 00316 return (_flags & F_fully_defined) != 0; 00317 } 00318 00319 //////////////////////////////////////////////////////////////////// 00320 // Function: InterrogateType::is_unpublished 00321 // Access: Public 00322 // Description: Returns true if the type is an unpublished type. 00323 // This either means the type is a nested type, and it 00324 // is protected or private within its scope, or that its 00325 // definition is simply not marked as 'published'. 00326 //////////////////////////////////////////////////////////////////// 00327 INLINE bool InterrogateType:: 00328 is_unpublished() const { 00329 return (_flags & F_unpublished) != 0; 00330 } 00331 00332 //////////////////////////////////////////////////////////////////// 00333 // Function: InterrogateType::number_of_constructors 00334 // Access: Public 00335 // Description: 00336 //////////////////////////////////////////////////////////////////// 00337 INLINE int InterrogateType:: 00338 number_of_constructors() const { 00339 return _constructors.size(); 00340 } 00341 00342 //////////////////////////////////////////////////////////////////// 00343 // Function: InterrogateType::get_constructor 00344 // Access: Public 00345 // Description: 00346 //////////////////////////////////////////////////////////////////// 00347 INLINE FunctionIndex InterrogateType:: 00348 get_constructor(int n) const { 00349 if (n >= 0 && n < (int)_constructors.size()) { 00350 return _constructors[n]; 00351 } else { 00352 return 0; 00353 } 00354 } 00355 00356 //////////////////////////////////////////////////////////////////// 00357 // Function: InterrogateType::has_destructor 00358 // Access: Public 00359 // Description: 00360 //////////////////////////////////////////////////////////////////// 00361 INLINE bool InterrogateType:: 00362 has_destructor() const { 00363 return (_destructor != 0); 00364 } 00365 00366 //////////////////////////////////////////////////////////////////// 00367 // Function: InterrogateType::destructor_is_inherited 00368 // Access: Public 00369 // Description: 00370 //////////////////////////////////////////////////////////////////// 00371 INLINE bool InterrogateType:: 00372 destructor_is_inherited() const { 00373 return (_flags & F_inherited_destructor) != 0; 00374 } 00375 00376 //////////////////////////////////////////////////////////////////// 00377 // Function: InterrogateType::get_destructor 00378 // Access: Public 00379 // Description: 00380 //////////////////////////////////////////////////////////////////// 00381 INLINE FunctionIndex InterrogateType:: 00382 get_destructor() const { 00383 return _destructor; 00384 } 00385 00386 //////////////////////////////////////////////////////////////////// 00387 // Function: InterrogateType::number_of_elements 00388 // Access: Public 00389 // Description: 00390 //////////////////////////////////////////////////////////////////// 00391 INLINE int InterrogateType:: 00392 number_of_elements() const { 00393 return _elements.size(); 00394 } 00395 00396 //////////////////////////////////////////////////////////////////// 00397 // Function: InterrogateType::get_element 00398 // Access: Public 00399 // Description: 00400 //////////////////////////////////////////////////////////////////// 00401 INLINE ElementIndex InterrogateType:: 00402 get_element(int n) const { 00403 if (n >= 0 && n < (int)_elements.size()) { 00404 return _elements[n]; 00405 } else { 00406 return 0; 00407 } 00408 } 00409 00410 //////////////////////////////////////////////////////////////////// 00411 // Function: InterrogateType::number_of_methods 00412 // Access: Public 00413 // Description: 00414 //////////////////////////////////////////////////////////////////// 00415 INLINE int InterrogateType:: 00416 number_of_methods() const { 00417 return _methods.size(); 00418 } 00419 00420 //////////////////////////////////////////////////////////////////// 00421 // Function: InterrogateType::get_method 00422 // Access: Public 00423 // Description: 00424 //////////////////////////////////////////////////////////////////// 00425 INLINE FunctionIndex InterrogateType:: 00426 get_method(int n) const { 00427 if (n >= 0 && n < (int)_methods.size()) { 00428 return _methods[n]; 00429 } else { 00430 return 0; 00431 } 00432 } 00433 00434 //////////////////////////////////////////////////////////////////// 00435 // Function: InterrogateType::number_of_make_seqs 00436 // Access: Public 00437 // Description: 00438 //////////////////////////////////////////////////////////////////// 00439 INLINE int InterrogateType:: 00440 number_of_make_seqs() const { 00441 return _make_seqs.size(); 00442 } 00443 00444 //////////////////////////////////////////////////////////////////// 00445 // Function: InterrogateType::get_make_seq 00446 // Access: Public 00447 // Description: 00448 //////////////////////////////////////////////////////////////////// 00449 INLINE MakeSeqIndex InterrogateType:: 00450 get_make_seq(int n) const { 00451 if (n >= 0 && n < (int)_make_seqs.size()) { 00452 return _make_seqs[n]; 00453 } else { 00454 return 0; 00455 } 00456 } 00457 00458 //////////////////////////////////////////////////////////////////// 00459 // Function: InterrogateType::number_of_casts 00460 // Access: Public 00461 // Description: 00462 //////////////////////////////////////////////////////////////////// 00463 INLINE int InterrogateType:: 00464 number_of_casts() const { 00465 return _casts.size(); 00466 } 00467 00468 //////////////////////////////////////////////////////////////////// 00469 // Function: InterrogateType::get_cast 00470 // Access: Public 00471 // Description: 00472 //////////////////////////////////////////////////////////////////// 00473 INLINE FunctionIndex InterrogateType:: 00474 get_cast(int n) const { 00475 if (n >= 0 && n < (int)_casts.size()) { 00476 return _casts[n]; 00477 } else { 00478 return 0; 00479 } 00480 } 00481 00482 //////////////////////////////////////////////////////////////////// 00483 // Function: InterrogateType::number_of_derivations 00484 // Access: Public 00485 // Description: 00486 //////////////////////////////////////////////////////////////////// 00487 INLINE int InterrogateType:: 00488 number_of_derivations() const { 00489 return _derivations.size(); 00490 } 00491 00492 //////////////////////////////////////////////////////////////////// 00493 // Function: InterrogateType::get_derivation 00494 // Access: Public 00495 // Description: 00496 //////////////////////////////////////////////////////////////////// 00497 INLINE TypeIndex InterrogateType:: 00498 get_derivation(int n) const { 00499 if (n >= 0 && n < (int)_derivations.size()) { 00500 return _derivations[n]._base; 00501 } else { 00502 return 0; 00503 } 00504 } 00505 00506 //////////////////////////////////////////////////////////////////// 00507 // Function: InterrogateType::derivation_has_upcast 00508 // Access: Public 00509 // Description: 00510 //////////////////////////////////////////////////////////////////// 00511 INLINE bool InterrogateType:: 00512 derivation_has_upcast(int n) const { 00513 if (n >= 0 && n < (int)_derivations.size()) { 00514 return (_derivations[n]._flags & DF_upcast) != 0; 00515 } else { 00516 return false; 00517 } 00518 } 00519 00520 //////////////////////////////////////////////////////////////////// 00521 // Function: InterrogateType::derivation_get_upcast 00522 // Access: Public 00523 // Description: 00524 //////////////////////////////////////////////////////////////////// 00525 INLINE TypeIndex InterrogateType:: 00526 derivation_get_upcast(int n) const { 00527 if (n >= 0 && n < (int)_derivations.size()) { 00528 return _derivations[n]._upcast; 00529 } else { 00530 return 0; 00531 } 00532 } 00533 00534 //////////////////////////////////////////////////////////////////// 00535 // Function: InterrogateType::derivation_downcast_is_impossible 00536 // Access: Public 00537 // Description: 00538 //////////////////////////////////////////////////////////////////// 00539 INLINE bool InterrogateType:: 00540 derivation_downcast_is_impossible(int n) const { 00541 if (n >= 0 && n < (int)_derivations.size()) { 00542 return (_derivations[n]._flags & DF_downcast_impossible) != 0; 00543 } else { 00544 return false; 00545 } 00546 } 00547 00548 //////////////////////////////////////////////////////////////////// 00549 // Function: InterrogateType::derivation_has_downcast 00550 // Access: Public 00551 // Description: 00552 //////////////////////////////////////////////////////////////////// 00553 INLINE bool InterrogateType:: 00554 derivation_has_downcast(int n) const { 00555 if (n >= 0 && n < (int)_derivations.size()) { 00556 return (_derivations[n]._flags & DF_downcast) != 0; 00557 } else { 00558 return false; 00559 } 00560 } 00561 00562 //////////////////////////////////////////////////////////////////// 00563 // Function: InterrogateType::derivation_get_downcast 00564 // Access: Public 00565 // Description: 00566 //////////////////////////////////////////////////////////////////// 00567 INLINE TypeIndex InterrogateType:: 00568 derivation_get_downcast(int n) const { 00569 if (n >= 0 && n < (int)_derivations.size()) { 00570 return _derivations[n]._downcast; 00571 } else { 00572 return 0; 00573 } 00574 } 00575 00576 //////////////////////////////////////////////////////////////////// 00577 // Function: InterrogateType::number_of_nested_types 00578 // Access: Public 00579 // Description: 00580 //////////////////////////////////////////////////////////////////// 00581 INLINE int InterrogateType:: 00582 number_of_nested_types() const { 00583 return _nested_types.size(); 00584 } 00585 00586 //////////////////////////////////////////////////////////////////// 00587 // Function: InterrogateType::get_nested_type 00588 // Access: Public 00589 // Description: 00590 //////////////////////////////////////////////////////////////////// 00591 INLINE TypeIndex InterrogateType:: 00592 get_nested_type(int n) const { 00593 if (n >= 0 && n < (int)_nested_types.size()) { 00594 return _nested_types[n]; 00595 } else { 00596 return 0; 00597 } 00598 } 00599 00600 INLINE ostream & 00601 operator << (ostream &out, const InterrogateType &type) { 00602 type.output(out); 00603 return out; 00604 } 00605 00606 INLINE istream & 00607 operator >> (istream &in, InterrogateType &type) { 00608 type.input(in); 00609 return in; 00610 } 00611 00612 INLINE ostream & 00613 operator << (ostream &out, const InterrogateType::Derivation &d) { 00614 d.output(out); 00615 return out; 00616 } 00617 00618 INLINE istream & 00619 operator >> (istream &in, InterrogateType::Derivation &d) { 00620 d.input(in); 00621 return in; 00622 } 00623 00624 INLINE ostream & 00625 operator << (ostream &out, const InterrogateType::EnumValue &ev) { 00626 ev.output(out); 00627 return out; 00628 } 00629 00630 INLINE istream & 00631 operator >> (istream &in, InterrogateType::EnumValue &ev) { 00632 ev.input(in); 00633 return in; 00634 } 00635