UFGroup is a UFObject that contain a group of UFObject elements. More...
#include <ufobject.h>
Public Member Functions | |
UFGroup (UFName name, const char *label="") | |
Construct an empty UFGroup, containing no objects. | |
~UFGroup () | |
Destroy a UFGroup after destroying all the objects it contains. | |
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. | |
bool | IsDefault () const |
Return true if object has its default value. | |
void | SetDefault () |
Set the current object value to its default value. | |
void | Reset () |
Reset the object value to its default value. | |
bool | Has (UFName name) const |
Return true if the UFGroup contains an object called name. | |
UFObject & | operator[] (UFName name) |
Access a UFObject element in a UFGroup. | |
const UFObject & | operator[] (UFName name) const |
Access a constant UFObject element in a constant UFGroup. | |
virtual UFGroup & | operator<< (UFObject *object) |
Add (append) a UFObject to a UFGroup. | |
UFObject & | Drop (UFName name) |
Drop an object from the group. | |
void | Clear () |
Remove all elements from the group. |
UFGroup is a UFObject that contain a group of UFObject elements.
This object is considered the Patent() of these elements.
UFGroup::UFGroup | ( | UFName | name, | |
const char * | label = "" | |||
) | [explicit] |
UFGroup::~UFGroup | ( | ) |
Destroy a UFGroup after destroying all the objects it contains.
std::string UFGroup::XML | ( | const char * | indent = "" |
) | const [virtual] |
void UFGroup::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. |
Implements UFObject.
Reimplemented in UFArray.
bool UFGroup::IsDefault | ( | ) | const [virtual] |
void UFGroup::SetDefault | ( | ) | [virtual] |
Set the current object value to its default value.
A uf_default_changed event is triggered.
Implements UFObject.
Reimplemented in UFArray.
void UFGroup::Reset | ( | ) | [virtual] |
Reset the object value to its default value.
If the value changes, a uf_value_changed event is triggered.
Implements UFObject.
Reimplemented in UFArray.
Access a UFObject element in a UFGroup.
UFException | is thrown if an element with the given name does not exist. This can be avoided with the use of the Has() method. |
Access a constant UFObject element in a constant UFGroup.
UFException | is thrown if an element with the given name does not exist. This can be avoided with the use of the Has() method. |
Add (append) a UFObject to a UFGroup.
If the object belonged to another group before, it will be detached from the original group.
UFException | is thrown if UFGroup already contains an object with the same name. This can be avoided with the use of the Has() method. |
Reimplemented in UFArray.
Drop an object from the group.
The dropped object is returned. If it is not needed any more it should be deleted to free its memory.
UFException | is thrown if an element with the given name does not exist. This can be avoided with the use of the Has() method. For UFArray, the index does not get updated. |
void UFGroup::Clear | ( | ) |
Remove all elements from the group.
The removed elements are deleted from memory. For UFArray, the index does not get updated.