Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

FunctionRemap Class Reference

This class describes how to remap a C++ function (and its list of parameters and return type) to a wrapped function, for a particular scripting language. More...

#include <functionRemap.h>

List of all members.

Public Types

typedef vector< ParameterParameters
enum  Type {
  T_normal, T_constructor, T_destructor, T_typecast_method,
  T_assignment_method, T_typecast, T_getter, T_setter
}

Public Member Functions

 FunctionRemap (const InterrogateType &itype, const InterrogateFunction &ifunc, CPPInstance *cppfunc, int num_default_parameters, InterfaceMaker *interface)
 ~FunctionRemap ()
string get_parameter_name (int n) const
 Returns a string that will be a suitable name for the nth parameter in the generated code.

string call_function (ostream &out, int indent_level, bool convert_result, const string &container, const vector_string &pexprs=vector_string()) const
 Writes a sequence of commands to the given output stream to call the wrapped function.

void write_orig_prototype (ostream &out, int indent_level) const
 Writes a line describing the original C++ method or function.

FunctionWrapperIndex make_wrapper_entry (FunctionIndex function_index)
 Creates an InterrogateFunctionWrapper object corresponding to this callable instance and stores it in the database.


Public Attributes

Parameters _parameters
ParameterRemap_return_type
bool _void_return
bool _has_this
int _first_true_parameter
int _num_default_parameters
Type _type
string _expression
string _function_signature
string _hash
string _unique_name
string _wrapper_name
FunctionWrapperIndex _wrapper_index
bool _return_value_needs_management
FunctionIndex _return_value_destructor
bool _manage_reference_count
CPPType_cpptype
CPPScope_cppscope
CPPInstance_cppfunc
CPPFunctionType_ftype
bool _is_valid

Private Member Functions

string get_call_str (const string &container, const vector_string &pexprs) const
 Returns a string suitable for calling the wrapped function.

string get_parameter_expr (int n, const vector_string &pexprs) const
 Returns a string that represents the expression associated with the nth parameter.

bool setup_properties (const InterrogateFunction &ifunc, InterfaceMaker *interface)
 Sets up the properties of the function appropriately.


Detailed Description

This class describes how to remap a C++ function (and its list of parameters and return type) to a wrapped function, for a particular scripting language.

The InterfaceMaker class will create one of these for each function, including one for each instance of an overloaded function.

Definition at line 62 of file functionRemap.h.


Member Typedef Documentation

typedef vector<Parameter> FunctionRemap::Parameters
 

Definition at line 97 of file functionRemap.h.


Member Enumeration Documentation

enum FunctionRemap::Type
 

Enumeration values:
T_normal 
T_constructor 
T_destructor 
T_typecast_method 
T_assignment_method 
T_typecast 
T_getter 
T_setter 

Definition at line 86 of file functionRemap.h.


Constructor & Destructor Documentation

FunctionRemap::FunctionRemap const InterrogateType itype,
const InterrogateFunction ifunc,
CPPInstance cppfunc,
int  num_default_parameters,
InterfaceMaker interface
 

Definition at line 46 of file functionRemap.cxx.

FunctionRemap::~FunctionRemap  ) 
 

Definition at line 77 of file functionRemap.cxx.

References ostringstream::str().


Member Function Documentation

string FunctionRemap::call_function ostream &  out,
int  indent_level,
bool  convert_result,
const string &  container,
const vector_string &  pexprs = vector_string()
const
 

Writes a sequence of commands to the given output stream to call the wrapped function.

The parameter values are taken from pexprs, if it is nonempty, or are assumed to be simply the names of the parameters, if it is empty.

The return value is the expression to return, if we are returning a value, or the empty string if we return nothing.

Definition at line 126 of file functionRemap.cxx.

string FunctionRemap::get_call_str const string &  container,
const vector_string &  pexprs
const [private]
 

Returns a string suitable for calling the wrapped function.

If pexprs is nonempty, it represents the list of expressions that will evaluate to each parameter value.

Definition at line 379 of file functionRemap.cxx.

References _parameters, and get_parameter_expr().

string FunctionRemap::get_parameter_expr int  n,
const vector_string &  pexprs
const [private]
 

Returns a string that represents the expression associated with the nth parameter.

This is just the nth element of pexprs if it is nonempty, or the name of the nth parameter is it is empty.

Definition at line 447 of file functionRemap.cxx.

References _cpptype, _first_true_parameter, CPPFunctionType::_flags, _ftype, FunctionRemap::Parameter::_has_name, FunctionRemap::Parameter::_name, _parameters, FunctionRemap::Parameter::_remap, and CPPFunctionType::F_const_method.

Referenced by get_call_str().

string FunctionRemap::get_parameter_name int  n  )  const
 

Returns a string that will be a suitable name for the nth parameter in the generated code.

This may not correspond to the name of the parameter in the original code.

Definition at line 95 of file functionRemap.cxx.

References _cpptype, _return_type, _type, CPPType::get_local_name(), ParameterRemap::get_orig_type(), InterfaceMaker::indent(), TypeManager::is_reference_count(), NULL, parser, T_destructor, and T_typecast_method.

Referenced by InterfaceMakerPythonObj::write_function_for().

FunctionWrapperIndex FunctionRemap::make_wrapper_entry FunctionIndex  function_index  ) 
 

Creates an InterrogateFunctionWrapper object corresponding to this callable instance and stores it in the database.

Definition at line 283 of file functionRemap.cxx.

References InterrogateFunctionWrapper::PF_has_name.

Referenced by InterfaceMaker::get_wrapper_name().

bool FunctionRemap::setup_properties const InterrogateFunction ifunc,
InterfaceMaker interface
[private]
 

Sets up the properties of the function appropriately.

Returns true if successful, or false if there is something unacceptable about the function.

Definition at line 467 of file functionRemap.cxx.

References _type, and T_assignment_method.

void FunctionRemap::write_orig_prototype ostream &  out,
int  indent_level
const
 

Writes a line describing the original C++ method or function.

This is generally useful only within a comment.

Definition at line 266 of file functionRemap.cxx.

References InterrogateFunctionWrapper::F_callable_by_name.

Referenced by InterfaceMakerPythonObj::write_function_for().


Member Data Documentation

CPPInstance* FunctionRemap::_cppfunc
 

Definition at line 119 of file functionRemap.h.

Referenced by InterfaceMakerPythonObj::write_function_for().

CPPScope* FunctionRemap::_cppscope
 

Definition at line 118 of file functionRemap.h.

CPPType* FunctionRemap::_cpptype
 

Definition at line 117 of file functionRemap.h.

Referenced by get_parameter_expr(), and get_parameter_name().

string FunctionRemap::_expression
 

Definition at line 106 of file functionRemap.h.

int FunctionRemap::_first_true_parameter
 

Definition at line 103 of file functionRemap.h.

Referenced by get_parameter_expr().

CPPFunctionType* FunctionRemap::_ftype
 

Definition at line 120 of file functionRemap.h.

Referenced by get_parameter_expr().

string FunctionRemap::_function_signature
 

Definition at line 107 of file functionRemap.h.

bool FunctionRemap::_has_this
 

Definition at line 102 of file functionRemap.h.

Referenced by InterfaceMaker::get_wrapper_name().

string FunctionRemap::_hash
 

Definition at line 108 of file functionRemap.h.

Referenced by InterfaceMaker::synthesize_this_parameter().

bool FunctionRemap::_is_valid
 

Definition at line 122 of file functionRemap.h.

Referenced by InterfaceMaker::synthesize_this_parameter().

bool FunctionRemap::_manage_reference_count
 

Definition at line 115 of file functionRemap.h.

int FunctionRemap::_num_default_parameters
 

Definition at line 104 of file functionRemap.h.

Parameters FunctionRemap::_parameters
 

Definition at line 99 of file functionRemap.h.

Referenced by get_call_str(), get_parameter_expr(), and InterfaceMakerPythonObj::write_function_for().

ParameterRemap* FunctionRemap::_return_type
 

Definition at line 100 of file functionRemap.h.

Referenced by get_parameter_name().

FunctionIndex FunctionRemap::_return_value_destructor
 

Definition at line 114 of file functionRemap.h.

bool FunctionRemap::_return_value_needs_management
 

Definition at line 113 of file functionRemap.h.

Type FunctionRemap::_type
 

Definition at line 105 of file functionRemap.h.

Referenced by get_parameter_name(), and setup_properties().

string FunctionRemap::_unique_name
 

Definition at line 109 of file functionRemap.h.

Referenced by InterfaceMaker::synthesize_this_parameter(), and InterfaceMakerPythonSimple::write_functions().

bool FunctionRemap::_void_return
 

Definition at line 101 of file functionRemap.h.

FunctionWrapperIndex FunctionRemap::_wrapper_index
 

Definition at line 111 of file functionRemap.h.

string FunctionRemap::_wrapper_name
 

Definition at line 110 of file functionRemap.h.

Referenced by InterfaceMakerPythonSimple::get_wrapper_prefix(), InterfaceMaker::synthesize_this_parameter(), and InterfaceMakerPythonSimple::write_functions().


The documentation for this class was generated from the following files:
Generated on Thu May 1 22:13:33 2003 for DTool by doxygen1.3