/home/gian/Progetti/falcon/core/include/falcon/reflectfunc.h File Reference

Generic property reflection function definition. More...

#include <falcon/setup.h>

Include dependency graph for reflectfunc.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


Namespaces

namespace  Falcon
 CONST.

Defines

#define FALCON_REFLECT_INTEGER_FROM(obj, accessor)   property = (int64) obj->accessor();\
 Little macro to automatize reflection of integers.
#define FALCON_REFLECT_INTEGER_TO(obj, accessor)
 Little macro to automatize reflection of integers.
#define FALCON_REFLECT_STRING_FROM(obj, accessor)
 Little macro to automatize reflection of strings.
#define FALCON_REFLECT_STRING_TO(obj, accessor)
 Little macro to automatize reflection of strings.

Typedefs

typedef void(* Falcon::reflectionFunc )(CoreObject *instance, void *user_data, Item &property, const PropEntry &entry)
 Callback function for reflective properties needing complete reflection.
typedef void Falcon::reflectionFuncDecl (CoreObject *instance, void *user_data, Item &property, const PropEntry &entry)

Enumerations

enum  Falcon::t_reflection {
  Falcon::e_reflectNone = 0, Falcon::e_reflectBool, Falcon::e_reflectByte, Falcon::e_reflectChar,
  Falcon::e_reflectShort, Falcon::e_reflectUShort, Falcon::e_reflectInt, Falcon::e_reflectUInt,
  Falcon::e_reflectLong, Falcon::e_reflectULong, Falcon::e_reflectLL, Falcon::e_reflectULL,
  Falcon::e_reflectFloat, Falcon::e_reflectDouble, Falcon::e_reflectFunc, Falcon::e_reflectSetGet
}
 Reflection type enumeration. More...


Detailed Description

Generic property reflection function definition.


Define Documentation

#define FALCON_REFLECT_INTEGER_FROM ( obj,
accessor   )     property = (int64) obj->accessor();\

Little macro to automatize reflection of integers.

See also:
FALCON_REFLECT_STRING_FROM
Parameters:
obj the object (pointer) containing the string to be reflected.
accessor the name of the accessor used to read the variable.

#define FALCON_REFLECT_INTEGER_TO ( obj,
accessor   ) 

Value:

if ( ! property.isOrdinal() ) {\
      throw new ParamError( ErrorParam( e_inv_params ).extra( "N" ) );\
   }\
   obj->accessor( (uint32) property.forceInteger() );\
Little macro to automatize reflection of integers.

See also:
FALCON_REFLECT_STRING_TO
Parameters:
obj the object (pointer) containing the string to be reflected.
accessor the name of the accessor used to read the variable.

#define FALCON_REFLECT_STRING_FROM ( obj,
accessor   ) 

Value:

if( ! property.isString() )\
      property = new CoreString( obj->accessor() );\
   else\
      property.asString()->bufferize( obj->accessor() );
Little macro to automatize reflection of strings.

This is not a very clean programming technique, but is effective. Used inside a reflectionFunc with parameters named as the standard one (i.e. as those provided in the function declaration), it is able to correctly reflect a string property into an object which provides an accessor to a Falcon::String.

The macro raises a standard parameter error if the property is not a string during setting, and checks for the property being unchanged before resetting it to a new string during reading. As it raises a ParamError, proper .h files (falcon/error.h) must be included.

Used mainly by the engine, users may find it useful.

Parameters:
obj the object (pointer) containing the string to be reflected.
accessor the name of the accessor used to read the variable.

#define FALCON_REFLECT_STRING_TO ( obj,
accessor   ) 

Value:

if ( ! property.isString() ) {\
      throw new ParamError( ErrorParam( e_inv_params ).extra( "S" ) );\
   }\
   obj->accessor( *property.asString() );\
Little macro to automatize reflection of strings.

This stores the data coming from the engine into the object via an accessor.

Used mainly by the engine, users may find it useful.

See also:
FALCON_REFLECT_STRING_FROM
Parameters:
obj the object (pointer) containing the string to be reflected.
accessor the name of the accessor used to read the variable.


Generated on Mon Oct 19 10:11:20 2009 for Falcon_Core by  doxygen 1.5.8