Sourceforge.net - The VCF's Project Host
   The VCF Website Home   |   Online Discussion Forums   |   Sourceforge.net Project Page   

VCF::Property Class Reference

The Property class represents a member attribute of a class. More...

#include <vcf/FoundationKit/Property.h>

List of all members.

Public Member Functions

 Property ()
 Property (const Property &prop)
virtual ~Property ()
Propertyoperator= (const Property &rhs)
virtual Propertyclone ()=0
 makes a copy of the property.
String getName () const
 gets the name of the property.
String getDisplayName () const
 returns the display name, usually something longer and more descriptive than the name alone.
String getDescription () const
 gets a description of the property, telling what the property does or represents.
void setDescription (const String &description)
 sets the description of the property
void setDisplayName (const String &displayName)
 sets the display name of the property
void setName (const String &name)
 sets the name of the property
virtual String getTypeClassName ()=0
 This function returns the class name of the property's type.
PropertyDescriptorType getType () const
 returns the type of the Property.
void setType (const PropertyDescriptorType &type)
 sets the type of the Property
virtual VariantDataget (Object *source)=0
 gets the value of the property for the given instance of source.
virtual void set (Object *source, VariantData *value)=0
 sets a value on an object.
virtual String toString ()
void setSource (Object *source)
 sets the source for the Property instance.
ObjectgetSource ()
 returns the object source that is associated with this property instance.
VariantDataget ()
 returns a VariandData object that represents the value of this property on the source object that was specified in the setSource() method.
void set (VariantData *value)
 sets the value specified in the VariantData object passed in on the source obejct that was specified in the setSource() method.
virtual void set (Object *source, const String &value)
 calls the value_'s setFromString method which converts the string into the right type and then calls set()
void set (const String &value)
 convenience method for calling set on propertys that have their source assigned to a valid pointer.
bool isCollection ()
 returns whether or not the property represents a collection if the result is true, then it is safe to call the hasMoreElements() and nextElement() methods.
virtual bool hasMoreElements (Object *source)
 returns whether or not the property collection has more elements
virtual VariantDatanextElement (Object *source)
 returns the next element in the collection, currently only forward iterating.
virtual void startCollection (Object *source)
 We can't call get() to grab the collection directly, since an Enumerator is a templated class, and this point we don't know the template type.
void startCollection ()
void add (VariantData *value)
virtual void add (Object *source, VariantData *value)
virtual void insert (Object *source, const uint32 &index, VariantData *value)
void insert (const uint32 &index, VariantData *value)
virtual void remove (Object *source, VariantData *value)
void remove (VariantData *value)
virtual void remove (Object *source, const uint32 &index)
void remove (const uint32 &index)
virtual bool collectionSupportsEditing ()
bool isReadOnly ()
bool isBound ()
 returns whether or not the property is "bound" to an object.
void setBound (const bool &bound)

Public Attributes

VCF::Delegate PropertyChanged

Protected Attributes

VariantData value_
bool isCollection_
bool isReadOnly_


Detailed Description

The Property class represents a member attribute of a class.

Properties allow a programmer to dynamically query a class at runtime for all of it attributes with out knowing the exact type of class the object instance is. Property is an abstract base class, and only provides an interface to work with.

Author:
Jim Crafton
Version:
1.0


Constructor & Destructor Documentation

VCF::Property::Property  )  [inline]
 

VCF::Property::Property const Property prop  )  [inline]
 

virtual VCF::Property::~Property  )  [inline, virtual]
 


Member Function Documentation

virtual void VCF::Property::add Object source,
VariantData value
[inline, virtual]
 

void VCF::Property::add VariantData value  )  [inline]
 

virtual Property* VCF::Property::clone  )  [pure virtual]
 

makes a copy of the property.

Implemented in the templated derived classes.

virtual bool VCF::Property::collectionSupportsEditing  )  [inline, virtual]
 

VariantData* VCF::Property::get  )  [inline]
 

returns a VariandData object that represents the value of this property on the source object that was specified in the setSource() method.

virtual VariantData* VCF::Property::get Object source  )  [pure virtual]
 

gets the value of the property for the given instance of source.

Parameters:
Object the object to invoke the get method for that particular property.
Returns:
VariantData the value of the given property for that object (source)

String VCF::Property::getDescription  )  const [inline]
 

gets a description of the property, telling what the property does or represents.

String VCF::Property::getDisplayName  )  const [inline]
 

returns the display name, usually something longer and more descriptive than the name alone.

String VCF::Property::getName  )  const [inline]
 

gets the name of the property.

Object* VCF::Property::getSource  )  [inline]
 

returns the object source that is associated with this property instance.

PropertyDescriptorType VCF::Property::getType  )  const [inline]
 

returns the type of the Property.

These are the same types as VariantData::type. They can be int, long, uint32, short, float, double, char, bool, string, enums or Object*.

virtual String VCF::Property::getTypeClassName  )  [pure virtual]
 

This function returns the class name of the property's type.

For primitive types it will return the primitive type name, i.e. for a property of type long it will return "long", while a property of type Color will return "VCF::Color".

Returns:
String the name of the class that the property represents

virtual bool VCF::Property::hasMoreElements Object source  )  [inline, virtual]
 

returns whether or not the property collection has more elements

void VCF::Property::insert const uint32 index,
VariantData value
[inline]
 

virtual void VCF::Property::insert Object source,
const uint32 index,
VariantData value
[inline, virtual]
 

bool VCF::Property::isBound  )  [inline]
 

returns whether or not the property is "bound" to an object.

"Bound" properties cause a onPropertyChanged() method to be fired in any listeners whenever the property's set() method is called

bool VCF::Property::isCollection  )  [inline]
 

returns whether or not the property represents a collection if the result is true, then it is safe to call the hasMoreElements() and nextElement() methods.

bool VCF::Property::isReadOnly  )  [inline]
 

virtual VariantData* VCF::Property::nextElement Object source  )  [inline, virtual]
 

returns the next element in the collection, currently only forward iterating.

Also no support for getting an item from an index

Property& VCF::Property::operator= const Property rhs  )  [inline]
 

void VCF::Property::remove const uint32 index  )  [inline]
 

virtual void VCF::Property::remove Object source,
const uint32 index
[inline, virtual]
 

void VCF::Property::remove VariantData value  )  [inline]
 

virtual void VCF::Property::remove Object source,
VariantData value
[inline, virtual]
 

void VCF::Property::set const String value  )  [inline]
 

convenience method for calling set on propertys that have their source assigned to a valid pointer.

virtual void VCF::Property::set Object source,
const String value
[inline, virtual]
 

calls the value_'s setFromString method which converts the string into the right type and then calls set()

void VCF::Property::set VariantData value  )  [inline]
 

sets the value specified in the VariantData object passed in on the source obejct that was specified in the setSource() method.

virtual void VCF::Property::set Object source,
VariantData value
[pure virtual]
 

sets a value on an object.

void VCF::Property::setBound const bool &  bound  )  [inline]
 

void VCF::Property::setDescription const String description  )  [inline]
 

sets the description of the property

void VCF::Property::setDisplayName const String displayName  )  [inline]
 

sets the display name of the property

void VCF::Property::setName const String name  )  [inline]
 

sets the name of the property

void VCF::Property::setSource Object source  )  [inline]
 

sets the source for the Property instance.

Parameters:
Object the source object the property instance is associated with. get() and set() calls will be performed on this source object.

void VCF::Property::setType const PropertyDescriptorType type  )  [inline]
 

sets the type of the Property

void VCF::Property::startCollection  )  [inline]
 

virtual void VCF::Property::startCollection Object source  )  [inline, virtual]
 

We can't call get() to grab the collection directly, since an Enumerator is a templated class, and this point we don't know the template type.

So instead, we call startCollection() to invoke the some getXXX function that returns an enumerator. This will mean that derived classes will now have the enumerator and can start calling methods on it. The base class implementation does nothing.

virtual String VCF::Property::toString  )  [inline, virtual]
 


Member Data Documentation

bool VCF::Property::isCollection_ [protected]
 

bool VCF::Property::isReadOnly_ [protected]
 

VCF::Delegate VCF::Property::PropertyChanged
 

VariantData VCF::Property::value_ [protected]
 


The documentation for this class was generated from the following file:
   Comments or Suggestions?    License Information