Panda3D
interrogateComponent.I
1 // Filename: interrogateComponent.I
2 // Created by: drose (08Aug00)
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: InterrogateComponent::Constructor
18 // Access: Public
19 // Description:
20 ////////////////////////////////////////////////////////////////////
21 INLINE InterrogateComponent::
22 InterrogateComponent(InterrogateModuleDef *def) :
23  _def(def)
24 {
25 }
26 
27 ////////////////////////////////////////////////////////////////////
28 // Function: InterrogateComponent::Copy Constructor
29 // Access: Public
30 // Description:
31 ////////////////////////////////////////////////////////////////////
32 INLINE InterrogateComponent::
33 InterrogateComponent(const InterrogateComponent &copy) :
34  _def(copy._def),
35  _name(copy._name)
36 {
37 }
38 
39 ////////////////////////////////////////////////////////////////////
40 // Function: InterrogateComponent::Copy Assignment Operator
41 // Access: Public
42 // Description:
43 ////////////////////////////////////////////////////////////////////
44 INLINE void InterrogateComponent::
45 operator = (const InterrogateComponent &copy) {
46  _def = copy._def;
47  _name = copy._name;
48 }
49 
50 ////////////////////////////////////////////////////////////////////
51 // Function: InterrogateComponent::has_library_name
52 // Access: Public
53 // Description: Returns true if we have a known library name, false if
54 // we do not. See get_library_name().
55 ////////////////////////////////////////////////////////////////////
56 INLINE bool InterrogateComponent::
58  const char *name = get_library_name();
59  return (name != (const char *)NULL && name[0] != '\0');
60 }
61 
62 ////////////////////////////////////////////////////////////////////
63 // Function: InterrogateComponent::get_library_name
64 // Access: Public
65 // Description: Returns the library name, if it is known, or NULL if
66 // it is not. This is the name of the library that this
67 // particular component was built into. Typically this
68 // will be a one-to-one correspondance with an
69 // invocation of the interrogate command. Typical
70 // examples are "libutil" and "liblinmath".
71 ////////////////////////////////////////////////////////////////////
72 INLINE const char *InterrogateComponent::
74  if (_def != (InterrogateModuleDef *)NULL) {
75  return _def->library_name;
76  }
77  return (const char *)NULL;
78 }
79 
80 ////////////////////////////////////////////////////////////////////
81 // Function: InterrogateComponent::has_module_name
82 // Access: Public
83 // Description: Returns true if we have a known module name, false if
84 // we do not. See get_module_name().
85 ////////////////////////////////////////////////////////////////////
86 INLINE bool InterrogateComponent::
87 has_module_name() const {
88  const char *name = get_module_name();
89  return (name != (const char *)NULL && name[0] != '\0');
90 }
91 
92 ////////////////////////////////////////////////////////////////////
93 // Function: InterrogateComponent::get_module_name
94 // Access: Public
95 // Description: Returns the module name, if it is known, or NULL if
96 // it is not. This is the name of the module that this
97 // particular component is associated with. This is a
98 // higher grouping than library. Typical examples are
99 // "panda" and "pandaegg".
100 ////////////////////////////////////////////////////////////////////
101 INLINE const char *InterrogateComponent::
103  if (_def != (InterrogateModuleDef *)NULL) {
104  return _def->module_name;
105  }
106  return (const char *)NULL;
107 }
108 
109 ////////////////////////////////////////////////////////////////////
110 // Function: InterrogateComponent::has_name
111 // Access: Public
112 // Description:
113 ////////////////////////////////////////////////////////////////////
114 INLINE bool InterrogateComponent::
115 has_name() const {
116  return !_name.empty();
117 }
118 
119 ////////////////////////////////////////////////////////////////////
120 // Function: InterrogateComponent::get_name
121 // Access: Public
122 // Description:
123 ////////////////////////////////////////////////////////////////////
124 INLINE const string &InterrogateComponent::
125 get_name() const {
126  return _name;
127 }
128 
129 ////////////////////////////////////////////////////////////////////
130 // Function: InterrogateComponent::get_num_alt_names
131 // Access: Public
132 // Description:
133 ////////////////////////////////////////////////////////////////////
134 INLINE int InterrogateComponent::
135 get_num_alt_names() const {
136  return _alt_names.size();
137 }
138 
139 ////////////////////////////////////////////////////////////////////
140 // Function: InterrogateComponent::get_num_alt_names
141 // Access: Public
142 // Description:
143 ////////////////////////////////////////////////////////////////////
144 INLINE const string &InterrogateComponent::
145 get_alt_name(int n) const {
146  if (n >= 0 && n < (int)_alt_names.size()) {
147  return _alt_names[n];
148  }
149  return _empty_string;
150 }
bool has_library_name() const
Returns true if we have a known library name, false if we do not.
bool has_module_name() const
Returns true if we have a known module name, false if we do not.
The base class for things that are part of the interrogate database.
const char * get_library_name() const
Returns the library name, if it is known, or NULL if it is not.
const char * get_module_name() const
Returns the module name, if it is known, or NULL if it is not.