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  */
18 INLINE bool InterrogateFunction::
19 is_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  */
26 INLINE bool InterrogateFunction::
27 is_virtual() const {
28  return (_flags & F_virtual) != 0;
29 }
30 
31 /**
32  * Returns true if the function is a class method.
33  */
34 INLINE bool InterrogateFunction::
35 is_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  */
43 INLINE bool InterrogateFunction::
44 is_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  */
52 INLINE bool InterrogateFunction::
54  return (_flags & F_operator_typecast) != 0;
55 }
56 
57 /**
58  * Return the class that owns the method, if is_method() returns true.
59  */
60 INLINE TypeIndex InterrogateFunction::
61 get_class() const {
62  return _class;
63 }
64 
65 /**
66  *
67  */
68 INLINE bool InterrogateFunction::
69 has_scoped_name() const {
70  return !_scoped_name.empty();
71 }
72 
73 /**
74  *
75  */
76 INLINE const std::string &InterrogateFunction::
77 get_scoped_name() const {
78  return _scoped_name;
79 }
80 
81 /**
82  *
83  */
84 INLINE bool InterrogateFunction::
85 has_comment() const {
86  return !_comment.empty();
87 }
88 
89 /**
90  *
91  */
92 INLINE const std::string &InterrogateFunction::
93 get_comment() const {
94  return _comment;
95 }
96 
97 /**
98  *
99  */
100 INLINE bool InterrogateFunction::
101 has_prototype() const {
102  return !_prototype.empty();
103 }
104 
105 /**
106  *
107  */
108 INLINE const std::string &InterrogateFunction::
109 get_prototype() const {
110  return _prototype;
111 }
112 
113 /**
114  *
115  */
116 INLINE int InterrogateFunction::
117 number_of_c_wrappers() const {
118  return _c_wrappers.size();
119 }
120 
121 /**
122  *
123  */
124 INLINE FunctionWrapperIndex InterrogateFunction::
125 get_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  */
135 INLINE int InterrogateFunction::
136 number_of_python_wrappers() const {
137  return _python_wrappers.size();
138 }
139 
140 /**
141  *
142  */
143 INLINE FunctionWrapperIndex InterrogateFunction::
144 get_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 
152 INLINE std::ostream &
153 operator << (std::ostream &out, const InterrogateFunction &function) {
154  function.output(out);
155  return out;
156 }
157 
158 INLINE std::istream &
159 operator >> (std::istream &in, InterrogateFunction &function) {
160  function.input(in);
161  return in;
162 }
bool is_global() const
Returns true if the function is marked as 'global'.
bool is_virtual() const
Returns true if the function is virtual, for whatever that'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.