Panda3D
|
00001 // Filename: interrogateComponent.I 00002 // Created by: drose (08Aug00) 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: InterrogateComponent::Constructor 00018 // Access: Public 00019 // Description: 00020 //////////////////////////////////////////////////////////////////// 00021 INLINE InterrogateComponent:: 00022 InterrogateComponent(InterrogateModuleDef *def) : 00023 _def(def) 00024 { 00025 } 00026 00027 //////////////////////////////////////////////////////////////////// 00028 // Function: InterrogateComponent::Copy Constructor 00029 // Access: Public 00030 // Description: 00031 //////////////////////////////////////////////////////////////////// 00032 INLINE InterrogateComponent:: 00033 InterrogateComponent(const InterrogateComponent ©) : 00034 _def(copy._def), 00035 _name(copy._name) 00036 { 00037 } 00038 00039 //////////////////////////////////////////////////////////////////// 00040 // Function: InterrogateComponent::Copy Assignment Operator 00041 // Access: Public 00042 // Description: 00043 //////////////////////////////////////////////////////////////////// 00044 INLINE void InterrogateComponent:: 00045 operator = (const InterrogateComponent ©) { 00046 _def = copy._def; 00047 _name = copy._name; 00048 } 00049 00050 //////////////////////////////////////////////////////////////////// 00051 // Function: InterrogateComponent::has_library_name 00052 // Access: Public 00053 // Description: Returns true if we have a known library name, false if 00054 // we do not. See get_library_name(). 00055 //////////////////////////////////////////////////////////////////// 00056 INLINE bool InterrogateComponent:: 00057 has_library_name() const { 00058 const char *name = get_library_name(); 00059 return (name != (const char *)NULL && name[0] != '\0'); 00060 } 00061 00062 //////////////////////////////////////////////////////////////////// 00063 // Function: InterrogateComponent::get_library_name 00064 // Access: Public 00065 // Description: Returns the library name, if it is known, or NULL if 00066 // it is not. This is the name of the library that this 00067 // particular component was built into. Typically this 00068 // will be a one-to-one correspondance with an 00069 // invocation of the interrogate command. Typical 00070 // examples are "libutil" and "liblinmath". 00071 //////////////////////////////////////////////////////////////////// 00072 INLINE const char *InterrogateComponent:: 00073 get_library_name() const { 00074 if (_def != (InterrogateModuleDef *)NULL) { 00075 return _def->library_name; 00076 } 00077 return (const char *)NULL; 00078 } 00079 00080 //////////////////////////////////////////////////////////////////// 00081 // Function: InterrogateComponent::has_module_name 00082 // Access: Public 00083 // Description: Returns true if we have a known module name, false if 00084 // we do not. See get_module_name(). 00085 //////////////////////////////////////////////////////////////////// 00086 INLINE bool InterrogateComponent:: 00087 has_module_name() const { 00088 const char *name = get_module_name(); 00089 return (name != (const char *)NULL && name[0] != '\0'); 00090 } 00091 00092 //////////////////////////////////////////////////////////////////// 00093 // Function: InterrogateComponent::get_module_name 00094 // Access: Public 00095 // Description: Returns the module name, if it is known, or NULL if 00096 // it is not. This is the name of the module that this 00097 // particular component is associated with. This is a 00098 // higher grouping than library. Typical examples are 00099 // "panda" and "pandaegg". 00100 //////////////////////////////////////////////////////////////////// 00101 INLINE const char *InterrogateComponent:: 00102 get_module_name() const { 00103 if (_def != (InterrogateModuleDef *)NULL) { 00104 return _def->module_name; 00105 } 00106 return (const char *)NULL; 00107 } 00108 00109 //////////////////////////////////////////////////////////////////// 00110 // Function: InterrogateComponent::has_name 00111 // Access: Public 00112 // Description: 00113 //////////////////////////////////////////////////////////////////// 00114 INLINE bool InterrogateComponent:: 00115 has_name() const { 00116 return !_name.empty(); 00117 } 00118 00119 //////////////////////////////////////////////////////////////////// 00120 // Function: InterrogateComponent::get_name 00121 // Access: Public 00122 // Description: 00123 //////////////////////////////////////////////////////////////////// 00124 INLINE const string &InterrogateComponent:: 00125 get_name() const { 00126 return _name; 00127 } 00128 00129 //////////////////////////////////////////////////////////////////// 00130 // Function: InterrogateComponent::get_num_alt_names 00131 // Access: Public 00132 // Description: 00133 //////////////////////////////////////////////////////////////////// 00134 INLINE int InterrogateComponent:: 00135 get_num_alt_names() const { 00136 return _alt_names.size(); 00137 } 00138 00139 //////////////////////////////////////////////////////////////////// 00140 // Function: InterrogateComponent::get_num_alt_names 00141 // Access: Public 00142 // Description: 00143 //////////////////////////////////////////////////////////////////// 00144 INLINE const string &InterrogateComponent:: 00145 get_alt_name(int n) const { 00146 if (n >= 0 && n < (int)_alt_names.size()) { 00147 return _alt_names[n]; 00148 } 00149 return _empty_string; 00150 }