Panda3D

Loading...
Searching...
No Matches
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 */
17INLINE InterrogateComponent::
18InterrogateComponent(InterrogateModuleDef *def) :
19 _def(def)
20{
21}
22
23/**
24 *
25 */
26INLINE InterrogateComponent::
27InterrogateComponent(const InterrogateComponent &copy) :
28 _def(copy._def),
29 _name(copy._name)
30{
31}
32
33/**
34 *
35 */
36INLINE void InterrogateComponent::
37operator = (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 */
46INLINE bool InterrogateComponent::
47 has_library_name() const {
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 */
58INLINE const char *InterrogateComponent::
59 get_library_name() const {
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 */
70INLINE 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 */
82INLINE 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 */
93INLINE bool InterrogateComponent::
94has_name() const {
95 return !_name.empty();
96}
97
98/**
99 *
100 */
101INLINE const std::string &InterrogateComponent::
102get_name() const {
103 return _name;
104}
105
106/**
107 *
108 */
109INLINE int InterrogateComponent::
110get_num_alt_names() const {
111 return _alt_names.size();
112}
113
114/**
115 *
116 */
117INLINE const std::string &InterrogateComponent::
118get_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}
InterrogateComponent
The base class for things that are part of the interrogate database.
Definition interrogateComponent.h:30
InterrogateComponent::get_module_name
const char * get_module_name() const
Returns the module name, if it is known, or NULL if it is not.
Definition interrogateComponent.I:83
InterrogateComponent::has_module_name
bool has_module_name() const
Returns true if we have a known module name, false if we do not.
Definition interrogateComponent.I:71
InterrogateComponent::get_library_name
const char * get_library_name() const
Returns the library name, if it is known, or NULL if it is not.
Definition interrogateComponent.I:59
InterrogateComponent::has_library_name
bool has_library_name() const
Returns true if we have a known library name, false if we do not.
Definition interrogateComponent.I:47
InterrogateModuleDef
Definition interrogate_request.h:52