UFArray Class Reference

UFArray is a UFObject that contain an indexed group of UFObject elements. More...

#include <ufobject.h>

Inheritance diagram for UFArray:
Inheritance graph
[legend]
Collaboration diagram for UFArray:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 UFArray (UFName name, const char *defaultIndex="")
 Construct an empty UFArray, containing no objects.
std::string XML (const char *indent="") const
 Create an XML block for the object.
void Set (const UFObject &object)
void Set (const char *string)
 Set the value of the object from the string value.
const char * StringValue () const
 Translate object to a string.
bool IsDefault () const
 Return true if object has its default value.
void SetDefault ()
 Set the current object value to its default value.
void SetDefault (const char *string)
 Set string as a default string value for the UFArray.
void Reset ()
 Reset the object value to its default value.
bool SetIndex (int index)
 Set the current index position in the array.
int Index () const
 Retriew the current index location in the array.
bool IsEqual (const char *string) const
 Return true if the string index value is equal to string.
UFArrayoperator<< (UFObject *object)
 Add (append) a UFObject to a UFArray.

Detailed Description

UFArray is a UFObject that contain an indexed group of UFObject elements.

The array's elements are indexed by their StringValue(). In the current implementation, the StringValue() should not be changed after the UFObject was added to the UFArray.


Constructor & Destructor Documentation

UFArray::UFArray ( UFName  name,
const char *  defaultIndex = "" 
) [explicit]

Construct an empty UFArray, containing no objects.


Member Function Documentation

std::string UFArray::XML ( const char *  indent = ""  )  const [virtual]

Create an XML block for the object.

If the object value is its default, create and empty XML block.

Parameters:
indent - Controls the XML block indentations.

Reimplemented from UFGroup.

void UFArray::Set ( const UFObject object  ) 

Reimplemented from UFGroup.

void UFArray::Set ( const char *  string  )  [virtual]

Set the value of the object from the string value.

This is the reverse of the StringValue() method. If the value changes, an uf_value_changed event is triggered.

Exceptions:
UFException is thrown if the the string can not be converted to the object type. This could result from a user input error.

Reimplemented from UFGroup.

const char* UFArray::StringValue (  )  const [virtual]

Translate object to a string.

UFObject takes care of the memory allocation and freeing of the string.

Reimplemented from UFObject.

bool UFArray::IsDefault (  )  const [virtual]

Return true if object has its default value.

For numerical objects, the values has to the same up to the prescribed accuracy.

Reimplemented from UFGroup.

void UFArray::SetDefault (  )  [virtual]

Set the current object value to its default value.

A uf_default_changed event is triggered.

Reimplemented from UFGroup.

void UFArray::SetDefault ( const char *  string  ) 

Set string as a default string value for the UFArray.

As opposed to the SetDefault() method with no arguments, this method does not changes the default of the array's elements. A uf_default_changed event is triggered.

void UFArray::Reset (  )  [virtual]

Reset the object value to its default value.

If the value changes, a uf_value_changed event is triggered.

Reimplemented from UFGroup.

bool UFArray::SetIndex ( int  index  ) 

Set the current index position in the array.

Return false if index is out of range.

int UFArray::Index (  )  const

Retriew the current index location in the array.

-1 is returned if the string index value corresponds to no element's label.

bool UFArray::IsEqual ( const char *  string  )  const

Return true if the string index value is equal to string.

UFArray& UFArray::operator<< ( UFObject object  )  [virtual]

Add (append) a UFObject to a UFArray.

If the object belonged to another array before, it will be detached from the original array.

Exceptions:
UFException is thrown if UFArray already contains an object with the same StringValue. This can be avoided with the use of the Has() method.

Reimplemented from UFGroup.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on Wed Mar 17 21:05:32 2010 for UFRaw by  doxygen 1.6.1