UFArray is a UFObject that contain an indexed group of UFObject elements. More...
#include <ufobject.h>
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. | |
UFArray & | operator<< (UFObject *object) |
Add (append) a UFObject to a UFArray. |
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.
UFArray::UFArray | ( | UFName | name, | |
const char * | defaultIndex = "" | |||
) | [explicit] |
Construct an empty UFArray, containing no objects.
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.
indent | - Controls the XML block indentations. |
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.
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] |
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.
Add (append) a UFObject to a UFArray.
If the object belonged to another array before, it will be detached from the original array.
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.