Panda3D
interrogateFunction.I
1 // Filename: interrogateFunction.I
2 // Created by: drose (01Aug00)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: InterrogateFunction::is_global
18 // Access: Public
19 // Description: Returns true if the function is marked as 'global'.
20 // This means only that it should appear in the global
21 // function list.
22 ////////////////////////////////////////////////////////////////////
23 INLINE bool InterrogateFunction::
24 is_global() const {
25  return (_flags & F_global) != 0;
26 }
27 
28 ////////////////////////////////////////////////////////////////////
29 // Function: InterrogateFunction::is_virtual
30 // Access: Public
31 // Description: Returns true if the function is virtual, for whatever
32 // that's worth.
33 ////////////////////////////////////////////////////////////////////
34 INLINE bool InterrogateFunction::
35 is_virtual() const {
36  return (_flags & F_virtual) != 0;
37 }
38 
39 ////////////////////////////////////////////////////////////////////
40 // Function: InterrogateFunction::is_method
41 // Access: Public
42 // Description: Returns true if the function is a class method.
43 ////////////////////////////////////////////////////////////////////
44 INLINE bool InterrogateFunction::
45 is_method() const {
46  return (_flags & F_method) != 0;
47 }
48 
49 ////////////////////////////////////////////////////////////////////
50 // Function: InterrogateFunction::is_unary_op
51 // Access: Public
52 // Description: Returns true if the function is flagged as a special
53 // unary operator, like operator -() with no parameters.
54 ////////////////////////////////////////////////////////////////////
55 INLINE bool InterrogateFunction::
56 is_unary_op() const {
57  return (_flags & F_unary_op) != 0;
58 }
59 
60 ////////////////////////////////////////////////////////////////////
61 // Function: InterrogateFunction::is_operator_typecast
62 // Access: Public
63 // Description: Returns true if the function is a special typecast
64 // operator, like operator bool().
65 ////////////////////////////////////////////////////////////////////
66 INLINE bool InterrogateFunction::
68  return (_flags & F_operator_typecast) != 0;
69 }
70 
71 ////////////////////////////////////////////////////////////////////
72 // Function: InterrogateFunction::get_class
73 // Access: Public
74 // Description: Return the class that owns the method, if is_method()
75 // returns true.
76 ////////////////////////////////////////////////////////////////////
77 INLINE TypeIndex InterrogateFunction::
78 get_class() const {
79  return _class;
80 }
81 
82 ////////////////////////////////////////////////////////////////////
83 // Function: InterrogateFunction::has_scoped_name
84 // Access: Public
85 // Description:
86 ////////////////////////////////////////////////////////////////////
87 INLINE bool InterrogateFunction::
88 has_scoped_name() const {
89  return !_scoped_name.empty();
90 }
91 
92 ////////////////////////////////////////////////////////////////////
93 // Function: InterrogateFunction::get_scoped_name
94 // Access: Public
95 // Description:
96 ////////////////////////////////////////////////////////////////////
97 INLINE const string &InterrogateFunction::
98 get_scoped_name() const {
99  return _scoped_name;
100 }
101 
102 ////////////////////////////////////////////////////////////////////
103 // Function: InterrogateFunction::has_comment
104 // Access: Public
105 // Description:
106 ////////////////////////////////////////////////////////////////////
107 INLINE bool InterrogateFunction::
108 has_comment() const {
109  return !_comment.empty();
110 }
111 
112 ////////////////////////////////////////////////////////////////////
113 // Function: InterrogateFunction::get_comment
114 // Access: Public
115 // Description:
116 ////////////////////////////////////////////////////////////////////
117 INLINE const string &InterrogateFunction::
118 get_comment() const {
119  return _comment;
120 }
121 
122 ////////////////////////////////////////////////////////////////////
123 // Function: InterrogateFunction::has_prototype
124 // Access: Public
125 // Description:
126 ////////////////////////////////////////////////////////////////////
127 INLINE bool InterrogateFunction::
128 has_prototype() const {
129  return !_prototype.empty();
130 }
131 
132 ////////////////////////////////////////////////////////////////////
133 // Function: InterrogateFunction::get_prototype
134 // Access: Public
135 // Description:
136 ////////////////////////////////////////////////////////////////////
137 INLINE const string &InterrogateFunction::
138 get_prototype() const {
139  return _prototype;
140 }
141 
142 ////////////////////////////////////////////////////////////////////
143 // Function: InterrogateFunction::number_of_c_wrappers
144 // Access: Public
145 // Description:
146 ////////////////////////////////////////////////////////////////////
147 INLINE int InterrogateFunction::
148 number_of_c_wrappers() const {
149  return _c_wrappers.size();
150 }
151 
152 ////////////////////////////////////////////////////////////////////
153 // Function: InterrogateFunction::get_c_wrapper
154 // Access: Public
155 // Description:
156 ////////////////////////////////////////////////////////////////////
157 INLINE FunctionWrapperIndex InterrogateFunction::
158 get_c_wrapper(int n) const {
159  if (n >= 0 && n < (int)_c_wrappers.size()) {
160  return _c_wrappers[n];
161  }
162  return 0;
163 }
164 
165 ////////////////////////////////////////////////////////////////////
166 // Function: InterrogateFunction::number_of_python_wrappers
167 // Access: Public
168 // Description:
169 ////////////////////////////////////////////////////////////////////
170 INLINE int InterrogateFunction::
171 number_of_python_wrappers() const {
172  return _python_wrappers.size();
173 }
174 
175 ////////////////////////////////////////////////////////////////////
176 // Function: InterrogateFunction::get_python_wrapper
177 // Access: Public
178 // Description:
179 ////////////////////////////////////////////////////////////////////
180 INLINE FunctionWrapperIndex InterrogateFunction::
181 get_python_wrapper(int n) const {
182  if (n >= 0 && n < (int)_python_wrappers.size()) {
183  return _python_wrappers[n];
184  }
185  return 0;
186 }
187 
188 
189 INLINE ostream &
190 operator << (ostream &out, const InterrogateFunction &function) {
191  function.output(out);
192  return out;
193 }
194 
195 INLINE istream &
196 operator >> (istream &in, InterrogateFunction &function) {
197  function.input(in);
198  return in;
199 }
bool is_global() const
Returns true if the function is marked as &#39;global&#39;.
bool is_virtual() const
Returns true if the function is virtual, for whatever that&#39;s worth.
bool is_method() const
Returns true if the function is a class method.
bool is_unary_op() const
Returns true if the function is flagged as a special unary operator, like operator -() with no parame...
An internal representation of a function.
bool is_operator_typecast() const
Returns true if the function is a special typecast operator, like operator bool().
TypeIndex get_class() const
Return the class that owns the method, if is_method() returns true.