Panda3D
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 * Return the class that owns the method, if is_method() returns true.
59 */
60INLINE TypeIndex InterrogateFunction::
61get_class() const {
62 return _class;
63}
64
65/**
66 *
67 */
68INLINE bool InterrogateFunction::
69has_scoped_name() const {
70 return !_scoped_name.empty();
71}
72
73/**
74 *
75 */
76INLINE const std::string &InterrogateFunction::
77get_scoped_name() const {
78 return _scoped_name;
79}
80
81/**
82 *
83 */
84INLINE bool InterrogateFunction::
85has_comment() const {
86 return !_comment.empty();
87}
88
89/**
90 *
91 */
92INLINE const std::string &InterrogateFunction::
93get_comment() const {
94 return _comment;
95}
96
97/**
98 *
99 */
100INLINE bool InterrogateFunction::
101has_prototype() const {
102 return !_prototype.empty();
103}
104
105/**
106 *
107 */
108INLINE const std::string &InterrogateFunction::
109get_prototype() const {
110 return _prototype;
111}
112
113/**
114 *
115 */
116INLINE int InterrogateFunction::
117number_of_c_wrappers() const {
118 return _c_wrappers.size();
119}
120
121/**
122 *
123 */
124INLINE FunctionWrapperIndex InterrogateFunction::
125get_c_wrapper(int n) const {
126 if (n >= 0 && n < (int)_c_wrappers.size()) {
127 return _c_wrappers[n];
128 }
129 return 0;
130}
131
132/**
133 *
134 */
135INLINE int InterrogateFunction::
136number_of_python_wrappers() const {
137 return _python_wrappers.size();
138}
139
140/**
141 *
142 */
143INLINE FunctionWrapperIndex InterrogateFunction::
144get_python_wrapper(int n) const {
145 if (n >= 0 && n < (int)_python_wrappers.size()) {
146 return _python_wrappers[n];
147 }
148 return 0;
149}
150
151
152INLINE std::ostream &
153operator << (std::ostream &out, const InterrogateFunction &function) {
154 function.output(out);
155 return out;
156}
157
158INLINE std::istream &
159operator >> (std::istream &in, InterrogateFunction &function) {
160 function.input(in);
161 return in;
162}
An internal representation of a function.
bool is_method() const
Returns true if the function is a class method.
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_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().