#include <parameterRemap.h>
Inheritance diagram for ParameterRemap:
Public Member Functions | |
ParameterRemap (CPPType *orig_type) | |
virtual | ~ParameterRemap () |
bool | is_valid () const |
CPPType * | get_orig_type () const |
Returns the type of the original, C++ parameter or return value. | |
CPPType * | get_new_type () const |
Returns the type of the wrapper's parameter or return value. | |
CPPType * | get_temporary_type () const |
Returns the type of any temporary variables used to hold the return value before returning it. | |
bool | has_default_value () const |
Returns true if this particular parameter has a default value defined. | |
CPPExpression * | get_default_value () const |
Returns the expression corresponding to this parameter's default value. | |
void | set_default_value (CPPExpression *expr) |
Records a default value to be associated with this parameter. | |
virtual void | pass_parameter (ostream &out, const string &variable_name) |
Outputs an expression that converts the indicated variable from the original type to the new type, for passing into the actual C++ function. | |
virtual string | prepare_return_expr (ostream &out, int indent_level, const string &expression) |
This will be called immediately before get_return_expr(). | |
virtual string | get_return_expr (const string &expression) |
Returns an expression that evalutes to the appropriate value type for returning from the function, given an expression of the original type. | |
virtual string | temporary_to_return (const string &temporary) |
Returns the string that converts the expression stored in the indicated temporary variable to the appropriate return value type. | |
virtual bool | return_value_needs_management () |
Returns true if the return value represents a value that was newly allocated, and hence must be explicitly deallocated later by the caller. | |
virtual FunctionIndex | get_return_value_destructor () |
If return_value_needs_management() returns true, this should return the index of the function that should be called when it is time to destruct the return value. | |
virtual bool | return_value_should_be_simple () |
This is a hack around a problem VC++ has with overly-complex expressions, particularly in conjunction with the 'new' operator. | |
virtual bool | new_type_is_atomic_string () |
Returns true if the type represented by the conversion is now the atomic string type. | |
virtual bool | is_this () |
Returns true if this is the "this" parameter. | |
Protected Attributes | |
bool | _is_valid |
CPPType * | _orig_type |
CPPType * | _new_type |
CPPType * | _temporary_type |
CPPExpression * | _default_value |
Certain kinds of function parameters that are legal in C++ (for instance, passing by reference, or passing structures as concrete values) are not legal for a typical scripting language. We map these types of parameters to something equivalent (for instance, a reference becomes a pointer).
For each kind of possible remapping, we define a class derived from ParameterRemap that defines the exact nature of the remap.
Definition at line 65 of file parameterRemap.h.
|
Definition at line 31 of file parameterRemap.I. References _default_value, _temporary_type, and NULL. |
|
Definition at line 33 of file parameterRemap.cxx. |
|
Returns the expression corresponding to this parameter's default value.
Definition at line 135 of file parameterRemap.I. |
|
Returns the type of the wrapper's parameter or return value. This is the type that will be reported in the interrogate database, and the type that the scripting language is expected to deal with. Definition at line 82 of file parameterRemap.I. References _temporary_type. |
|
Returns the type of the original, C++ parameter or return value.
Definition at line 63 of file parameterRemap.I. References _new_type, and INLINE. Referenced by FunctionRemap::get_parameter_name(). |
|
Returns an expression that evalutes to the appropriate value type for returning from the function, given an expression of the original type.
Reimplemented in ParameterRemapBasicStringRefToString, ParameterRemapBasicStringToString, ParameterRemapConcreteToPointer, ParameterRemapConstToNonConst, ParameterRemapEnumToInt, ParameterRemapPTToPointer, ParameterRemapReferenceToConcrete, ParameterRemapReferenceToPointer, ParameterRemapThis, and ParameterRemapToString. Definition at line 87 of file parameterRemap.cxx. |
|
If return_value_needs_management() returns true, this should return the index of the function that should be called when it is time to destruct the return value. It will generally be the same as the destructor for the class we just returned a pointer to. Reimplemented in ParameterRemapConcreteToPointer. Definition at line 152 of file parameterRemap.cxx. |
|
Returns the type of any temporary variables used to hold the return value before returning it. This is normally the same as get_new_type(), but in some circumstances it may need to be different. Definition at line 101 of file parameterRemap.I. References _default_value, and INLINE. |
|
Returns true if this particular parameter has a default value defined.
Definition at line 120 of file parameterRemap.I. |
|
Returns true if this is the "this" parameter.
Reimplemented in ParameterRemapThis. Definition at line 214 of file parameterRemap.cxx. |
|
Definition at line 48 of file parameterRemap.I. References _orig_type, and INLINE. |
|
Returns true if the type represented by the conversion is now the atomic string type. We have to have this crazy method for representing atomic string, because there's no such type in C (and hence no corresponding CPPType *). Reimplemented in ParameterRemapToString. Definition at line 201 of file parameterRemap.cxx. |
|
Outputs an expression that converts the indicated variable from the original type to the new type, for passing into the actual C++ function.
Reimplemented in ParameterRemapBasicStringRefToString, ParameterRemapBasicStringToString, ParameterRemapConcreteToPointer, ParameterRemapConstToNonConst, ParameterRemapEnumToInt, ParameterRemapPTToPointer, ParameterRemapReferenceToConcrete, ParameterRemapReferenceToPointer, ParameterRemapThis, and ParameterRemapToString. Definition at line 49 of file parameterRemap.cxx. |
|
This will be called immediately before get_return_expr(). It outputs whatever lines the remapper needs to the function to set up its return value, e.g. to declare a temporary variable or something. It should return the modified expression. Reimplemented in ParameterRemapBasicStringToString. Definition at line 70 of file parameterRemap.cxx. |
|
Returns true if the return value represents a value that was newly allocated, and hence must be explicitly deallocated later by the caller.
Reimplemented in ParameterRemapConcreteToPointer. Definition at line 129 of file parameterRemap.cxx. |
|
This is a hack around a problem VC++ has with overly-complex expressions, particularly in conjunction with the 'new' operator. If this parameter type is one that will probably give VC++ a headache, this should be set true to indicate that the code generator should save the return value expression into a temporary variable first, and pass the temporary variable name in instead. Reimplemented in ParameterRemapConcreteToPointer. Definition at line 179 of file parameterRemap.cxx. |
|
Records a default value to be associated with this parameter.
Definition at line 150 of file parameterRemap.I. |
|
Returns the string that converts the expression stored in the indicated temporary variable to the appropriate return value type. This is normally a pass-through, but in cases when the temporary variable type must be different than the return type (i.e. get_temporary_type() != get_new_type()), this might perform some operation. Reimplemented in ParameterRemapPTToPointer. Definition at line 112 of file parameterRemap.cxx. |
|
Definition at line 96 of file parameterRemap.h. Referenced by get_temporary_type(), and ParameterRemap(). |
|
Definition at line 91 of file parameterRemap.h. |
|
Definition at line 94 of file parameterRemap.h. Referenced by get_orig_type(). |
|
Definition at line 93 of file parameterRemap.h. Referenced by is_valid(), and ParameterRemapConcreteToPointer::pass_parameter(). |
|
Definition at line 95 of file parameterRemap.h. Referenced by get_new_type(), and ParameterRemap(). |