Panda3D

Loading...
Searching...
No Matches
interrogateFunctionWrapper.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 interrogateFunctionWrapper.I
10 * @author drose
11 * @date 2000-08-06
12 */
13
14/**
15 *
16 */
17INLINE InterrogateFunctionWrapper::
18InterrogateFunctionWrapper(InterrogateModuleDef *def) :
19 InterrogateComponent(def)
20{
21 _flags = 0;
22 _function = 0;
23 _return_type = 0;
24 _return_value_destructor = 0;
25}
26
27/**
28 *
29 */
30INLINE InterrogateFunctionWrapper::
31InterrogateFunctionWrapper(const InterrogateFunctionWrapper &copy) {
32 (*this) = copy;
33}
34
35/**
36 *
37 */
38INLINE void InterrogateFunctionWrapper::
39operator = (const InterrogateFunctionWrapper &copy) {
40 InterrogateComponent::operator = (copy);
41 _flags = copy._flags;
42 _function = copy._function;
43 _return_type = copy._return_type;
44 _return_value_destructor = copy._return_value_destructor;
45 _unique_name = copy._unique_name;
46 _comment = copy._comment;
47 _parameters = copy._parameters;
48}
49
50/**
51 * Returns the FunctionIndex of the function that this wrapper corresponds to.
52 */
53INLINE FunctionIndex InterrogateFunctionWrapper::
54 get_function() const {
55 return _function;
56}
57
58/**
59 *
60 */
61INLINE bool InterrogateFunctionWrapper::
62is_callable_by_name() const {
63 return (_flags & F_callable_by_name) != 0;
64}
65
66/**
67 * @since 1.10.13
68 */
69INLINE bool InterrogateFunctionWrapper::
70 is_copy_constructor() const {
71 return (_flags & F_copy_constructor) != 0;
72}
73
74/**
75 * @since 1.10.13
76 */
77INLINE bool InterrogateFunctionWrapper::
78 is_coerce_constructor() const {
79 return (_flags & F_coerce_constructor) != 0;
80}
81
82/**
83 * @since 1.10.13
84 */
85INLINE bool InterrogateFunctionWrapper::
86 is_extension() const {
87 return (_flags & F_extension) != 0;
88}
89
90/**
91 *
92 */
93INLINE bool InterrogateFunctionWrapper::
94has_return_value() const {
95 return (_flags & F_has_return) != 0;
96}
97
98/**
99 *
100 */
101INLINE TypeIndex InterrogateFunctionWrapper::
102get_return_type() const {
103 return _return_type;
104}
105
106/**
107 *
108 */
109INLINE bool InterrogateFunctionWrapper::
110caller_manages_return_value() const {
111 return (_flags & F_caller_manages) != 0;
112}
113
114/**
115 *
116 */
117INLINE FunctionIndex InterrogateFunctionWrapper::
118get_return_value_destructor() const {
119 return _return_value_destructor;
120}
121
122/**
123 *
124 */
125INLINE int InterrogateFunctionWrapper::
126number_of_parameters() const {
127 return _parameters.size();
128}
129
130/**
131 *
132 */
133INLINE TypeIndex InterrogateFunctionWrapper::
134parameter_get_type(int n) const {
135 if (n >= 0 && n < (int)_parameters.size()) {
136 return _parameters[n]._type;
137 }
138 return 0;
139}
140
141/**
142 *
143 */
144INLINE bool InterrogateFunctionWrapper::
145parameter_has_name(int n) const {
146 if (n >= 0 && n < (int)_parameters.size()) {
147 return (_parameters[n]._parameter_flags & PF_has_name) != 0;
148 }
149 return false;
150}
151
152/**
153 *
154 */
155INLINE const std::string &InterrogateFunctionWrapper::
156parameter_get_name(int n) const {
157 static std::string bogus_string;
158 if (n >= 0 && n < (int)_parameters.size()) {
159 return _parameters[n]._name;
160 }
161 return bogus_string;
162}
163
164/**
165 *
166 */
167INLINE bool InterrogateFunctionWrapper::
168parameter_is_this(int n) const {
169 if (n >= 0 && n < (int)_parameters.size()) {
170 return (_parameters[n]._parameter_flags & PF_is_this) != 0;
171 }
172 return false;
173}
174
175/**
176 *
177 */
178INLINE bool InterrogateFunctionWrapper::
179parameter_is_optional(int n) const {
180 if (n >= 0 && n < (int)_parameters.size()) {
181 return (_parameters[n]._parameter_flags & PF_is_optional) != 0;
182 }
183 return false;
184}
185
186/**
187 *
188 */
189INLINE const std::string &InterrogateFunctionWrapper::
190get_unique_name() const {
191 return _unique_name;
192}
193
194/**
195 *
196 */
197INLINE bool InterrogateFunctionWrapper::
198has_comment() const {
199 return !_comment.empty();
200}
201
202/**
203 *
204 */
205INLINE const std::string &InterrogateFunctionWrapper::
206get_comment() const {
207 return _comment;
208}
209
210INLINE std::ostream &
211operator << (std::ostream &out, const InterrogateFunctionWrapper &wrapper) {
212 wrapper.output(out);
213 return out;
214}
215
216INLINE std::istream &
217operator >> (std::istream &in, InterrogateFunctionWrapper &wrapper) {
218 wrapper.input(in);
219 return in;
220}
221
222INLINE std::ostream &
223operator << (std::ostream &out, const InterrogateFunctionWrapper::Parameter &p) {
224 p.output(out);
225 return out;
226}
227
228INLINE std::istream &
229operator >> (std::istream &in, InterrogateFunctionWrapper::Parameter &p) {
230 p.input(in);
231 return in;
232}
InterrogateComponent
The base class for things that are part of the interrogate database.
Definition interrogateComponent.h:30
InterrogateFunctionWrapper
An internal representation of a callable function.
Definition interrogateFunctionWrapper.h:28
InterrogateFunctionWrapper::is_coerce_constructor
bool is_coerce_constructor() const
Definition interrogateFunctionWrapper.I:78
InterrogateFunctionWrapper::get_function
FunctionIndex get_function() const
Returns the FunctionIndex of the function that this wrapper corresponds to.
Definition interrogateFunctionWrapper.I:54
InterrogateFunctionWrapper::output
void output(std::ostream &out) const
Formats the InterrogateFunctionWrapper data for output to a data file.
Definition interrogateFunctionWrapper.cxx:45
InterrogateFunctionWrapper::input
void input(std::istream &in)
Reads the data file as previously formatted by output().
Definition interrogateFunctionWrapper.cxx:60
InterrogateFunctionWrapper::is_copy_constructor
bool is_copy_constructor() const
Definition interrogateFunctionWrapper.I:70
InterrogateFunctionWrapper::is_extension
bool is_extension() const
Definition interrogateFunctionWrapper.I:86
InterrogateModuleDef
Definition interrogate_request.h:52