00001 // Filename: interrogateFunction.I 00002 // Created by: drose (01Aug00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 00016 //////////////////////////////////////////////////////////////////// 00017 // Function: InterrogateFunction::is_global 00018 // Access: Public 00019 // Description: Returns true if the function is marked as 'global'. 00020 // This means only that it should appear in the global 00021 // function list. 00022 //////////////////////////////////////////////////////////////////// 00023 INLINE bool InterrogateFunction:: 00024 is_global() const { 00025 return (_flags & F_global) != 0; 00026 } 00027 00028 //////////////////////////////////////////////////////////////////// 00029 // Function: InterrogateFunction::is_virtual 00030 // Access: Public 00031 // Description: Returns true if the function is virtual, for whatever 00032 // that's worth. 00033 //////////////////////////////////////////////////////////////////// 00034 INLINE bool InterrogateFunction:: 00035 is_virtual() const { 00036 return (_flags & F_virtual) != 0; 00037 } 00038 00039 //////////////////////////////////////////////////////////////////// 00040 // Function: InterrogateFunction::is_method 00041 // Access: Public 00042 // Description: Returns true if the function is a class method. 00043 //////////////////////////////////////////////////////////////////// 00044 INLINE bool InterrogateFunction:: 00045 is_method() const { 00046 return (_flags & F_method) != 0; 00047 } 00048 00049 //////////////////////////////////////////////////////////////////// 00050 // Function: InterrogateFunction::is_unary_op 00051 // Access: Public 00052 // Description: Returns true if the function is flagged as a special 00053 // unary operator, like operator -() with no parameters. 00054 //////////////////////////////////////////////////////////////////// 00055 INLINE bool InterrogateFunction:: 00056 is_unary_op() const { 00057 return (_flags & F_unary_op) != 0; 00058 } 00059 00060 //////////////////////////////////////////////////////////////////// 00061 // Function: InterrogateFunction::is_operator_typecast 00062 // Access: Public 00063 // Description: Returns true if the function is a special typecast 00064 // operator, like operator bool(). 00065 //////////////////////////////////////////////////////////////////// 00066 INLINE bool InterrogateFunction:: 00067 is_operator_typecast() const { 00068 return (_flags & F_operator_typecast) != 0; 00069 } 00070 00071 //////////////////////////////////////////////////////////////////// 00072 // Function: InterrogateFunction::get_class 00073 // Access: Public 00074 // Description: Return the class that owns the method, if is_method() 00075 // returns true. 00076 //////////////////////////////////////////////////////////////////// 00077 INLINE TypeIndex InterrogateFunction:: 00078 get_class() const { 00079 return _class; 00080 } 00081 00082 //////////////////////////////////////////////////////////////////// 00083 // Function: InterrogateFunction::has_scoped_name 00084 // Access: Public 00085 // Description: 00086 //////////////////////////////////////////////////////////////////// 00087 INLINE bool InterrogateFunction:: 00088 has_scoped_name() const { 00089 return !_scoped_name.empty(); 00090 } 00091 00092 //////////////////////////////////////////////////////////////////// 00093 // Function: InterrogateFunction::get_scoped_name 00094 // Access: Public 00095 // Description: 00096 //////////////////////////////////////////////////////////////////// 00097 INLINE const string &InterrogateFunction:: 00098 get_scoped_name() const { 00099 return _scoped_name; 00100 } 00101 00102 //////////////////////////////////////////////////////////////////// 00103 // Function: InterrogateFunction::has_comment 00104 // Access: Public 00105 // Description: 00106 //////////////////////////////////////////////////////////////////// 00107 INLINE bool InterrogateFunction:: 00108 has_comment() const { 00109 return !_comment.empty(); 00110 } 00111 00112 //////////////////////////////////////////////////////////////////// 00113 // Function: InterrogateFunction::get_comment 00114 // Access: Public 00115 // Description: 00116 //////////////////////////////////////////////////////////////////// 00117 INLINE const string &InterrogateFunction:: 00118 get_comment() const { 00119 return _comment; 00120 } 00121 00122 //////////////////////////////////////////////////////////////////// 00123 // Function: InterrogateFunction::has_prototype 00124 // Access: Public 00125 // Description: 00126 //////////////////////////////////////////////////////////////////// 00127 INLINE bool InterrogateFunction:: 00128 has_prototype() const { 00129 return !_prototype.empty(); 00130 } 00131 00132 //////////////////////////////////////////////////////////////////// 00133 // Function: InterrogateFunction::get_prototype 00134 // Access: Public 00135 // Description: 00136 //////////////////////////////////////////////////////////////////// 00137 INLINE const string &InterrogateFunction:: 00138 get_prototype() const { 00139 return _prototype; 00140 } 00141 00142 //////////////////////////////////////////////////////////////////// 00143 // Function: InterrogateFunction::number_of_c_wrappers 00144 // Access: Public 00145 // Description: 00146 //////////////////////////////////////////////////////////////////// 00147 INLINE int InterrogateFunction:: 00148 number_of_c_wrappers() const { 00149 return _c_wrappers.size(); 00150 } 00151 00152 //////////////////////////////////////////////////////////////////// 00153 // Function: InterrogateFunction::get_c_wrapper 00154 // Access: Public 00155 // Description: 00156 //////////////////////////////////////////////////////////////////// 00157 INLINE FunctionWrapperIndex InterrogateFunction:: 00158 get_c_wrapper(int n) const { 00159 if (n >= 0 && n < (int)_c_wrappers.size()) { 00160 return _c_wrappers[n]; 00161 } 00162 return 0; 00163 } 00164 00165 //////////////////////////////////////////////////////////////////// 00166 // Function: InterrogateFunction::number_of_python_wrappers 00167 // Access: Public 00168 // Description: 00169 //////////////////////////////////////////////////////////////////// 00170 INLINE int InterrogateFunction:: 00171 number_of_python_wrappers() const { 00172 return _python_wrappers.size(); 00173 } 00174 00175 //////////////////////////////////////////////////////////////////// 00176 // Function: InterrogateFunction::get_python_wrapper 00177 // Access: Public 00178 // Description: 00179 //////////////////////////////////////////////////////////////////// 00180 INLINE FunctionWrapperIndex InterrogateFunction:: 00181 get_python_wrapper(int n) const { 00182 if (n >= 0 && n < (int)_python_wrappers.size()) { 00183 return _python_wrappers[n]; 00184 } 00185 return 0; 00186 } 00187 00188 00189 INLINE ostream & 00190 operator << (ostream &out, const InterrogateFunction &function) { 00191 function.output(out); 00192 return out; 00193 } 00194 00195 INLINE istream & 00196 operator >> (istream &in, InterrogateFunction &function) { 00197 function.input(in); 00198 return in; 00199 }