osgIntrospection::PropertyInfo Class Reference

Inheritance diagram for osgIntrospection::PropertyInfo:

osgIntrospection::CustomAttributeProvider List of all members.

Public Member Functions

 PropertyInfo (const Type &decltype, const Type &ptype, const std::string &name, const MethodInfo *getm, const MethodInfo *setm)
 PropertyInfo (const Type &decltype, const Type &ptype, const std::string &name, const MethodInfo *getm, const MethodInfo *setm, const MethodInfo *numm, const MethodInfo *addm, const MethodInfo *remm)
int getNumIndices () const
 Returns the number of indices.
virtual const std::string & getName () const
 Returns the name of the property being described.
virtual const TypegetDeclaringType () const
 Returns the type that declares the property.
const TypegetPropertyType () const
 Returns the type of the reflected property.
const MethodInfogetGetMethod () const
 Returns the getter method.
const MethodInfogetSetMethod () const
 Returns the setter method.
const MethodInfogetCountMethod () const
 Returns the counter method.
const MethodInfogetAddMethod () const
 Returns the adder method.
const MethodInfogetRemoveMethod () const
 Returns the remover method.
bool canGet () const
 Returns whether the property's value can be retrieved.
bool canSet () const
 Returns whether the property's value can be set.
bool canCount () const
 Returns whether the property's array of values can be counted.
bool canAdd () const
 Returns whether items can be added to the array property.
bool canRemove () const
 Returns whether items can be removed from the array property.
bool isSimple () const
 Returns whether the property is simple.
bool isIndexed () const
 Returns whether the property is indexed.
bool isArray () const
 Returns whether the property is an array.
const ParameterInfoListgetIndexParameters () const
void getIndexValueSet (int whichindex, const Value &instance, ValueList &values) const
Value getValue (const Value &instance) const
Value getValue (Value &instance) const
void setValue (Value &instance, const Value &value) const
Value getIndexedValue (Value &instance, ValueList &indices) const
Value getIndexedValue (const Value &instance, ValueList &indices) const
void setIndexedValue (Value &instance, ValueList &indices, const Value &value) const
int getNumArrayItems (const Value &instance) const
Value getArrayItem (const Value &instance, int i) const
Value getArrayItem (Value &instance, int i) const
void setArrayItem (Value &instance, int i, const Value &value) const
void addArrayItem (Value &instance, const Value &value) const
void removeArrayItem (Value &instance, int i) const
Value getDefaultValue () const

Protected Member Functions

virtual void getInheritedProviders (CustomAttributeProviderList &providers) const

Detailed Description

This class keeps information about a class' property. A property is defined by a name and a set of methods that store and retrieve values. When the user wants to "get" the value of a property, the getter method will be invoked and its value returned. When the user wants to "set" the value of a property, the setter method will be called. There are three kinds of property: simple (get/set), indexed (get[i1, i2, ...]/set[i1, i2, ...]), and array (count/add/get[i]/ set[i]). Objects of class PropertyInfo can't be modified once they have been created, but they can be queried without restrictions. You can either retrieve the accessor methods and invoke them manually, or you can call getValue() / setValue() etc. methods to perform direct operations on the property, given an instance of the declaring type to work on. The latter technique is preferred because it checks for custom attributes associated to the PropertyInfo object and passes control to them when needed.


Constructor & Destructor Documentation

osgIntrospection::PropertyInfo::PropertyInfo ( const Type decltype,
const Type ptype,
const std::string &  name,
const MethodInfo getm,
const MethodInfo setm 
) [inline]

Direct initialization constructor for simple and indexed properties. You must pass the Type object associated to the class that declares the property, the Type object that describes the type of the property's value, the property name and the getter/setter methods. Either the setter or the getter can be null, meaning a restricted access. If both are null, the user is expected to add a custom accessor attribute to this PropertyInfo object. If the getter method has parameters, the property is considered to be indexed. The same is true if the getter is null and the setter has more than one parameter.

osgIntrospection::PropertyInfo::PropertyInfo ( const Type decltype,
const Type ptype,
const std::string &  name,
const MethodInfo getm,
const MethodInfo setm,
const MethodInfo numm,
const MethodInfo addm,
const MethodInfo remm 
) [inline]

Direct initialization constructor for "array" properties. You must pass the Type object associated to the type that declares the property, the Type object that describes the type of the property's value, the property name and the getter/setter/counter/adder/remover methods.


Member Function Documentation

void osgIntrospection::PropertyInfo::addArrayItem ( Value instance,
const Value value 
) const

Invokes the adder method on the given instance and adds an item to the array property. If a custom adder attribute is defined, it will be invoked instead.

bool osgIntrospection::PropertyInfo::canAdd (  )  const [inline]

Returns whether items can be added to the array property.

bool osgIntrospection::PropertyInfo::canCount (  )  const [inline]

Returns whether the property's array of values can be counted.

bool osgIntrospection::PropertyInfo::canGet (  )  const [inline]

Returns whether the property's value can be retrieved.

bool osgIntrospection::PropertyInfo::canRemove (  )  const [inline]

Returns whether items can be removed from the array property.

bool osgIntrospection::PropertyInfo::canSet (  )  const [inline]

Returns whether the property's value can be set.

const MethodInfo* osgIntrospection::PropertyInfo::getAddMethod (  )  const [inline]

Returns the adder method.

Value osgIntrospection::PropertyInfo::getArrayItem ( Value instance,
int  i 
) const

Invokes the getter method on the given instance and returns the i-th item of the array property. If a custom getter attribute us defined, it will be invoked instead.

Value osgIntrospection::PropertyInfo::getArrayItem ( const Value instance,
int  i 
) const

Invokes the getter method on the given const instance and returns the i-th item of the array property. If a custom getter attribute us defined, it will be invoked instead.

const MethodInfo* osgIntrospection::PropertyInfo::getCountMethod (  )  const [inline]

Returns the counter method.

virtual const Type& osgIntrospection::PropertyInfo::getDeclaringType (  )  const [inline, virtual]

Returns the type that declares the property.

Value osgIntrospection::PropertyInfo::getDefaultValue (  )  const

Returns the default value associated to the reflected property. If no default value has been specified, this method tries to create an instance of the property type and then returns its value. There are some attributes that change the behavior of this method, for example NoDefaultValueAttribute.

const MethodInfo* osgIntrospection::PropertyInfo::getGetMethod (  )  const [inline]

Returns the getter method.

Value osgIntrospection::PropertyInfo::getIndexedValue ( const Value instance,
ValueList indices 
) const

Invokes the getter method on the given instance passing a list of indices and returns the indexed property's value. If a custom getter attribute is defined, it will be invoked instead.

Value osgIntrospection::PropertyInfo::getIndexedValue ( Value instance,
ValueList indices 
) const

Invokes the getter method on the given const instance passing a list of indices and returns the indexed property's value. If a custom getter attribute is defined, it will be invoked instead.

const ParameterInfoList& osgIntrospection::PropertyInfo::getIndexParameters (  )  const

Returns the list of index parameters. If the property is not indexed, this list is empty. If neither the get method nor the set method are defined, this list is empty unless a custom indexing attribute is defined.

void osgIntrospection::PropertyInfo::getIndexValueSet ( int  whichindex,
const Value instance,
ValueList values 
) const

Returns a list of valid values that can be used for the specified index. If a custom indexing attribute is defined for this property, then it will be queried for the index set, otherwise the index will be treated as an enumeration and the set of enumeration values will be returned.

virtual void osgIntrospection::PropertyInfo::getInheritedProviders ( CustomAttributeProviderList providers  )  const [protected, virtual]

Implements osgIntrospection::CustomAttributeProvider.

virtual const std::string& osgIntrospection::PropertyInfo::getName (  )  const [inline, virtual]

Returns the name of the property being described.

int osgIntrospection::PropertyInfo::getNumArrayItems ( const Value instance  )  const

Invokes the counter method on the given instance and returns the number of items of the array property. If a custom counter attribute is defined, it will be invoked instead.

int osgIntrospection::PropertyInfo::getNumIndices (  )  const [inline]

Returns the number of indices.

const Type& osgIntrospection::PropertyInfo::getPropertyType (  )  const [inline]

Returns the type of the reflected property.

const MethodInfo* osgIntrospection::PropertyInfo::getRemoveMethod (  )  const [inline]

Returns the remover method.

const MethodInfo* osgIntrospection::PropertyInfo::getSetMethod (  )  const [inline]

Returns the setter method.

Value osgIntrospection::PropertyInfo::getValue ( Value instance  )  const

Invokes the getter method on the given instance and returns the property's value. If a custom getter attribute is defined, it will be invoked instead.

Value osgIntrospection::PropertyInfo::getValue ( const Value instance  )  const

Invokes the getter method on the given const instance and returns the property's value. If a custom getter attribute is defined, it will be invoked instead.

bool osgIntrospection::PropertyInfo::isArray (  )  const [inline]

Returns whether the property is an array.

bool osgIntrospection::PropertyInfo::isIndexed (  )  const [inline]

Returns whether the property is indexed.

bool osgIntrospection::PropertyInfo::isSimple (  )  const [inline]

Returns whether the property is simple.

void osgIntrospection::PropertyInfo::removeArrayItem ( Value instance,
int  i 
) const

Invokes the remover method on the given instance and removes an item from the array property. If a custom remover attribute is defined, it will be invoked instead.

void osgIntrospection::PropertyInfo::setArrayItem ( Value instance,
int  i,
const Value value 
) const

Invokes the setter method on the given instance and sets the i-th item of the array property. If a custom setter attribute is defined, it will be invoked instead.

void osgIntrospection::PropertyInfo::setIndexedValue ( Value instance,
ValueList indices,
const Value value 
) const

Invokes the setter method on the given instance passing a list of indices and sets the indexed property's value. If a custom setter attribute is defined, it will be invoked instead.

void osgIntrospection::PropertyInfo::setValue ( Value instance,
const Value value 
) const

Invokes the setter method on the given instance and sets the property's value. If a custom setter attribute is defined, it will be invoked instead.


The documentation for this class was generated from the following file:
Generated on Sun Oct 1 13:17:10 2006 for openscenegraph by  doxygen 1.4.7