Panda3D
Loading...
Searching...
No Matches
interrogateFunction.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 interrogateFunction.I
10 * @author drose
11 * @date 2000-08-01
12 */
13
14/**
15 * Returns true if the function is marked as 'global'. This means only that it
16 * should appear in the global function list.
17 */
19is_global() const {
20 return (_flags & F_global) != 0;
21}
22
23/**
24 * Returns true if the function is virtual, for whatever that's worth.
25 */
27is_virtual() const {
28 return (_flags & F_virtual) != 0;
29}
30
31/**
32 * Returns true if the function is a class method.
33 */
35is_method() const {
36 return (_flags & F_method) != 0;
37}
38
39/**
40 * Returns true if the function is flagged as a special unary operator, like
41 * operator -() with no parameters.
42 */
44is_unary_op() const {
45 return (_flags & F_unary_op) != 0;
46}
47
48/**
49 * Returns true if the function is a special typecast operator, like operator
50 * bool().
51 */
54 return (_flags & F_operator_typecast) != 0;
55}
56
57/**
58 * Returns true if the function is a constructor.
59 */
61is_constructor() const {
62 return (_flags & F_constructor) != 0;
63}
64
65/**
66 * Returns true if the function is a destructor.
67 */
69is_destructor() const {
70 return (_flags & F_destructor) != 0;
71}
72
73/**
74 * Return the class that owns the method, if is_method() returns true.
75 */
76INLINE TypeIndex InterrogateFunction::
77get_class() const {
78 return _class;
79}
80
81/**
82 *
83 */
84INLINE bool InterrogateFunction::
85has_scoped_name() const {
86 return !_scoped_name.empty();
87}
88
89/**
90 *
91 */
92INLINE const std::string &InterrogateFunction::
93get_scoped_name() const {
94 return _scoped_name;
95}
96
97/**
98 *
99 */
100INLINE bool InterrogateFunction::
101has_comment() const {
102 return !_comment.empty();
103}
104
105/**
106 *
107 */
108INLINE const std::string &InterrogateFunction::
109get_comment() const {
110 return _comment;
111}
112
113/**
114 *
115 */
116INLINE bool InterrogateFunction::
117has_prototype() const {
118 return !_prototype.empty();
119}
120
121/**
122 *
123 */
124INLINE const std::string &InterrogateFunction::
125get_prototype() const {
126 return _prototype;
127}
128
129/**
130 *
131 */
132INLINE int InterrogateFunction::
133number_of_c_wrappers() const {
134 return _c_wrappers.size();
135}
136
137/**
138 *
139 */
140INLINE FunctionWrapperIndex InterrogateFunction::
141get_c_wrapper(int n) const {
142 if (n >= 0 && n < (int)_c_wrappers.size()) {
143 return _c_wrappers[n];
144 }
145 return 0;
146}
147
148/**
149 *
150 */
151INLINE int InterrogateFunction::
152number_of_python_wrappers() const {
153 return _python_wrappers.size();
154}
155
156/**
157 *
158 */
159INLINE FunctionWrapperIndex InterrogateFunction::
160get_python_wrapper(int n) const {
161 if (n >= 0 && n < (int)_python_wrappers.size()) {
162 return _python_wrappers[n];
163 }
164 return 0;
165}
166
167
168INLINE std::ostream &
169operator << (std::ostream &out, const InterrogateFunction &function) {
170 function.output(out);
171 return out;
172}
173
174INLINE std::istream &
175operator >> (std::istream &in, InterrogateFunction &function) {
176 function.input(in);
177 return in;
178}
An internal representation of a function.
bool is_method() const
Returns true if the function is a class method.
bool is_destructor() const
Returns true if the function is a destructor.
bool is_global() const
Returns true if the function is marked as 'global'.
TypeIndex get_class() const
Return the class that owns the method, if is_method() returns true.
bool is_constructor() const
Returns true if the function is a constructor.
void output(std::ostream &out) const
Formats the InterrogateFunction data for output to a data file.
void input(std::istream &in)
Reads the data file as previously formatted by output().
bool is_unary_op() const
Returns true if the function is flagged as a special unary operator, like operator -() with no parame...
bool is_virtual() const
Returns true if the function is virtual, for whatever that's worth.
bool is_operator_typecast() const
Returns true if the function is a special typecast operator, like operator bool().