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.
void setSource (const Object *source)
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 ()
 Indicates whether or not the property is a collection.
virtual uint32 getCollectionCount ()
 Returns the number of elements in the property's collection.
virtual uint32 getCollectionCount (const VariantData &key)
virtual uint32 getCollectionCount (Object *source)
virtual uint32 getCollectionCount (Object *source, const VariantData &key)
virtual uint32 getCollectionKeys (Object *source, std::vector< VariantData > &keys)
virtual VariantDatagetAtKey (const VariantData &key)
 Returns the element at the specified key.
virtual VariantDatagetAtKey (const VariantData &key, Object *source)
 Returns the element of the collection at the specified index.
virtual void setAtKey (const VariantData &key, VariantData *value)
 Sets the value of the element at the specified index.
virtual void setAtKey (const VariantData &key, const String &value)
virtual void setAtKey (const VariantData &key, VariantData *value, Object *source)
virtual void setAtKey (const VariantData &key, const String &value, Object *source)
void add (VariantData *value)
 Adds an element to the property collection.
virtual void add (Object *source, VariantData *value)
 Adds an element to the property collection.
virtual void insert (const VariantData &key, VariantData *value, Object *source)
 Inserts an element into the property collection.
void insert (const VariantData &key, VariantData *value)
 Inserts an element into the property collection.
virtual void remove (const VariantData &key, Object *source)
 Removes an element from the property collection at the specified index.
void remove (const VariantData &key)
 Removes an element from the property collection at the specified index.
virtual bool collectionSupportsEditing ()
 This indicates whether or not the property for the collection will allow any modifications (add/insert/remove) to take place.
bool isReadOnly ()
PropertyChanged bool isBound ()
 returns whether or not the property is "bound" to an object.
void setBound (const bool &bound)
uint32 sizeOf () const

Public Attributes

VCF::Delegate PropertyChangeDelegate

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]
 

Adds an element to the property collection.

Note that the default implementation is to do nothing. Implementers will need to reimplement this function to provide for correct behavior.

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

Adds an element to the property collection.

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]
 

This indicates whether or not the property for the collection will allow any modifications (add/insert/remove) to take place.

The default behavior is to disallow these functions.

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)

virtual VariantData* VCF::Property::getAtKey const VariantData key,
Object source
[inline, virtual]
 

Returns the element of the collection at the specified index.

If the index is out of bounds (greater than or equal to the total number of elements in the collection) then an exception is thrown.

virtual VariantData* VCF::Property::getAtKey const VariantData key  )  [inline, virtual]
 

Returns the element at the specified key.

Typically this is an index into some array like container, but it's possibly it could be a key into a container like a map or Dictionary.

virtual uint32 VCF::Property::getCollectionCount Object source,
const VariantData key
[inline, virtual]
 

virtual uint32 VCF::Property::getCollectionCount Object source  )  [inline, virtual]
 

virtual uint32 VCF::Property::getCollectionCount const VariantData key  )  [inline, virtual]
 

virtual uint32 VCF::Property::getCollectionCount  )  [inline, virtual]
 

Returns the number of elements in the property's collection.

virtual uint32 VCF::Property::getCollectionKeys Object source,
std::vector< VariantData > &  keys
[inline, virtual]
 

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

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

Inserts an element into the property collection.

Note that the default implementation is to do nothing. Implementers will need to reimplement this function to provide for correct behavior.

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

Inserts an element into the property collection.

Note that the default implementation is to do nothing. Implementers will need to reimplement this function to provide for correct behavior.

PropertyChanged 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]
 

Indicates whether or not the property is a collection.

Most properties will obviously return false. If the property supports a collection, then it should return true.

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

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

void VCF::Property::remove const VariantData key  )  [inline]
 

Removes an element from the property collection at the specified index.

Note that the default implementation is to do nothing. Implementers will need to reimplement this function to provide for correct behavior.

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

Removes an element from the property collection at the specified index.

Note that the default implementation is to do nothing. Implementers will need to reimplement this function to provide for correct behavior.

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.

virtual void VCF::Property::setAtKey const VariantData key,
const String value,
Object source
[inline, virtual]
 

virtual void VCF::Property::setAtKey const VariantData key,
VariantData value,
Object source
[inline, virtual]
 

virtual void VCF::Property::setAtKey const VariantData key,
const String value
[inline, virtual]
 

virtual void VCF::Property::setAtKey const VariantData key,
VariantData value
[inline, virtual]
 

Sets the value of the element at the specified index.

If the index is out of bounds (greater than or equal to the total number of elements in the collection) then an exception is thrown.

Parameters:
VariantData the key, frequently just an index
VariantData the value

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 const Object source  )  [inline]
 

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

uint32 VCF::Property::sizeOf  )  const [inline]
 

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


Member Data Documentation

bool VCF::Property::isCollection_ [protected]
 

bool VCF::Property::isReadOnly_ [protected]
 

VCF::Delegate VCF::Property::PropertyChangeDelegate
 

VariantData VCF::Property::value_ [protected]
 


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