Panda3D
interrogateComponent.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 interrogateComponent.I
10  * @author drose
11  * @date 2000-08-08
12  */
13 
14 /**
15  *
16  */
17 INLINE InterrogateComponent::
18 InterrogateComponent(InterrogateModuleDef *def) :
19  _def(def)
20 {
21 }
22 
23 /**
24  *
25  */
26 INLINE InterrogateComponent::
27 InterrogateComponent(const InterrogateComponent &copy) :
28  _def(copy._def),
29  _name(copy._name)
30 {
31 }
32 
33 /**
34  *
35  */
36 INLINE void InterrogateComponent::
37 operator = (const InterrogateComponent &copy) {
38  _def = copy._def;
39  _name = copy._name;
40 }
41 
42 /**
43  * Returns true if we have a known library name, false if we do not. See
44  * get_library_name().
45  */
46 INLINE bool InterrogateComponent::
48  const char *name = get_library_name();
49  return (name != nullptr && name[0] != '\0');
50 }
51 
52 /**
53  * Returns the library name, if it is known, or NULL if it is not. This is
54  * the name of the library that this particular component was built into.
55  * Typically this will be a one-to-one correspondance with an invocation of
56  * the interrogate command. Typical examples are "libutil" and "liblinmath".
57  */
58 INLINE const char *InterrogateComponent::
60  if (_def != nullptr) {
61  return _def->library_name;
62  }
63  return nullptr;
64 }
65 
66 /**
67  * Returns true if we have a known module name, false if we do not. See
68  * get_module_name().
69  */
70 INLINE bool InterrogateComponent::
71 has_module_name() const {
72  const char *name = get_module_name();
73  return (name != nullptr && name[0] != '\0');
74 }
75 
76 /**
77  * Returns the module name, if it is known, or NULL if it is not. This is the
78  * name of the module that this particular component is associated with. This
79  * is a higher grouping than library. Typical examples are "panda" and
80  * "pandaegg".
81  */
82 INLINE const char *InterrogateComponent::
83 get_module_name() const {
84  if (_def != nullptr) {
85  return _def->module_name;
86  }
87  return nullptr;
88 }
89 
90 /**
91  *
92  */
93 INLINE bool InterrogateComponent::
94 has_name() const {
95  return !_name.empty();
96 }
97 
98 /**
99  *
100  */
101 INLINE const std::string &InterrogateComponent::
102 get_name() const {
103  return _name;
104 }
105 
106 /**
107  *
108  */
109 INLINE int InterrogateComponent::
110 get_num_alt_names() const {
111  return _alt_names.size();
112 }
113 
114 /**
115  *
116  */
117 INLINE const std::string &InterrogateComponent::
118 get_alt_name(int n) const {
119  if (n >= 0 && n < (int)_alt_names.size()) {
120  return _alt_names[n];
121  }
122  return _empty_string;
123 }
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.