00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef FUNCTIONREMAP_H
00020 #define FUNCTIONREMAP_H
00021
00022 #include "dtoolbase.h"
00023
00024 #include "interrogate_interface.h"
00025 #include "vector_string.h"
00026
00027 #include <vector>
00028
00029 class InterrogateBuilder;
00030 class InterrogateType;
00031 class InterrogateFunction;
00032 class ParameterRemap;
00033 class CPPType;
00034 class CPPInstance;
00035 class CPPStructType;
00036 class CPPScope;
00037 class CPPFunctionType;
00038 class InterfaceMaker;
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 class FunctionRemap {
00051 public:
00052 FunctionRemap(const InterrogateType &itype,
00053 const InterrogateFunction &ifunc,
00054 CPPInstance *cppfunc, int num_default_parameters,
00055 InterfaceMaker *interface);
00056 ~FunctionRemap();
00057
00058 string get_parameter_name(int n) const;
00059 string call_function(ostream &out, int indent_level,
00060 bool convert_result, const string &container,
00061 const vector_string &pexprs = vector_string()) const;
00062
00063 void write_orig_prototype(ostream &out, int indent_level) const;
00064
00065 FunctionWrapperIndex make_wrapper_entry(FunctionIndex function_index);
00066
00067 class Parameter {
00068 public:
00069 bool _has_name;
00070 string _name;
00071 ParameterRemap *_remap;
00072 };
00073
00074 enum Type {
00075 T_normal,
00076 T_constructor,
00077 T_destructor,
00078 T_typecast_method,
00079 T_assignment_method,
00080 T_typecast,
00081 T_getter,
00082 T_setter
00083 };
00084
00085 typedef vector<Parameter> Parameters;
00086
00087 Parameters _parameters;
00088 ParameterRemap *_return_type;
00089 bool _void_return;
00090 bool _has_this;
00091 int _first_true_parameter;
00092 int _num_default_parameters;
00093 Type _type;
00094 string _expression;
00095 string _function_signature;
00096 string _hash;
00097 string _unique_name;
00098 string _wrapper_name;
00099 FunctionWrapperIndex _wrapper_index;
00100
00101 bool _return_value_needs_management;
00102 FunctionIndex _return_value_destructor;
00103 bool _manage_reference_count;
00104
00105 CPPType *_cpptype;
00106 CPPScope *_cppscope;
00107 CPPInstance *_cppfunc;
00108 CPPFunctionType *_ftype;
00109
00110 bool _is_valid;
00111
00112 private:
00113 string
00114 get_call_str(const string &container, const vector_string &pexprs) const;
00115
00116 string
00117 get_parameter_expr(int n, const vector_string &pexprs) const;
00118
00119 bool
00120 setup_properties(const InterrogateFunction &ifunc, InterfaceMaker *interface);
00121 };
00122
00123 #endif