#include "PropertyGroup.h"
Public Member Functions | |
PropertyGroup () | |
Create empty group. | |
PropertyGroup (const PropertyGroup &_other) | |
PropertyGroup (const std::string &_name) | |
Create empty group with name and title. | |
PropertyGroup (const std::string &_name, const std::string &_title) | |
Create empty group with name and title. | |
virtual | ~PropertyGroup () |
Destructor. Destroys the parent group if set. | |
PropertyGroup & | operator= (const PropertyGroup &_other) |
PropertyGroup * | createCopy (bool _includeChilds) const |
virtual void | addToJsonObject (ot::JsonValue &_object, ot::JsonAllocator &_allocator) const override |
Add the object contents to the provided JSON object. | |
virtual void | setFromJsonObject (const ot::ConstJsonObject &_object) override |
Will set the object contents from the provided JSON object. | |
virtual void | mergeWith (const PropertyGroup &_other, bool _replaceExistingProperties) |
Adds the contents of the other configuration to this configuration. If an improved merge is required just subclass and implement. | |
void | setParentGroup (PropertyGroup *_group) |
PropertyGroup * | getParentGroup (void) const |
PropertyGroup * | getRootGroup (void) |
Returns the root group. If this group has no parent returns this group. | |
void | setName (const std::string &_name) |
std::string & | getName (void) |
const std::string & | getName (void) const |
void | setTitle (const std::string &_title) |
std::string & | getTitle (void) |
const std::string & | getTitle (void) const |
void | setProperties (const std::list< Property * > &_properties) |
Set the properties. This group takes ownership of the properties. | |
void | addProperty (Property *_property) |
Add the property. This group takes ownership of the property. | |
void | removeProperty (const std::string &_propertyName) |
Removes the property with the given name. | |
void | forgetProperty (Property *_property) |
Removes the property from the list without destroying it. | |
const std::list< Property * > & | getProperties (void) const |
Group properties. | |
std::list< Property * > | getAllProperties (void) const |
Returns all properties of all groups and nested groups. | |
Property * | findPropertyByPath (std::list< std::string > _path) const |
Returns the property at the given path. The path contains the group names from root to the item. The last path entry must be the property name. | |
void | setChildGroups (const std::list< PropertyGroup * > &_groups) |
Set the child groups. This group takes ownership of the groups. | |
const std::list< PropertyGroup * > & | getChildGroups (void) const |
void | addChildGroup (PropertyGroup *_group) |
Add the provided group as a child. This group takes ownership of the child. | |
PropertyGroup * | findGroup (const std::string &_name) const |
void | forgetChildGroup (PropertyGroup *_propertyGroup) |
Removes the property group from the list without destroying it. | |
void | findPropertiesBySpecialType (const std::string &_specialType, std::list< Property * > &_list) const |
void | clear (bool _keepGroups=false) |
bool | isEmpty (void) const |
Returns false if at least one property exists in this group or any of the child groups. | |
std::string | getGroupPath (char _delimiter='/') const |
Returns the group path. The group path is a string containing all parent groups and this group name (e.g. "Root/Child/ThisGroup"). | |
Public Member Functions inherited from ot::Serializable | |
Serializable () | |
virtual | ~Serializable () |
ot::PropertyGroup::PropertyGroup | ( | ) |
Create empty group.
ot::PropertyGroup::PropertyGroup | ( | const PropertyGroup & | _other | ) |
ot::PropertyGroup::PropertyGroup | ( | const std::string & | _name | ) |
Create empty group with name and title.
_name | Will be set as name and title |
ot::PropertyGroup::PropertyGroup | ( | const std::string & | _name, |
const std::string & | _title ) |
|
virtual |
Destructor. Destroys the parent group if set.
void ot::PropertyGroup::addChildGroup | ( | PropertyGroup * | _group | ) |
Add the provided group as a child. This group takes ownership of the child.
void ot::PropertyGroup::addProperty | ( | Property * | _property | ) |
Add the property. This group takes ownership of the property.
|
overridevirtual |
Add the object contents to the provided JSON object.
_object | Json object reference |
_allocator | Allocator |
Implements ot::Serializable.
void ot::PropertyGroup::clear | ( | bool | _keepGroups = false | ) |
ot::PropertyGroup * ot::PropertyGroup::createCopy | ( | bool | _includeChilds | ) | const |
ot::PropertyGroup * ot::PropertyGroup::findGroup | ( | const std::string & | _name | ) | const |
void ot::PropertyGroup::findPropertiesBySpecialType | ( | const std::string & | _specialType, |
std::list< Property * > & | _list ) const |
ot::Property * ot::PropertyGroup::findPropertyByPath | ( | std::list< std::string > | _path | ) | const |
Returns the property at the given path. The path contains the group names from root to the item. The last path entry must be the property name.
void ot::PropertyGroup::forgetChildGroup | ( | PropertyGroup * | _propertyGroup | ) |
Removes the property group from the list without destroying it.
void ot::PropertyGroup::forgetProperty | ( | Property * | _property | ) |
Removes the property from the list without destroying it.
std::list< ot::Property * > ot::PropertyGroup::getAllProperties | ( | void | ) | const |
Returns all properties of all groups and nested groups.
|
inline |
std::string ot::PropertyGroup::getGroupPath | ( | char | _delimiter = '/' | ) | const |
Returns the group path. The group path is a string containing all parent groups and this group name (e.g. "Root/Child/ThisGroup").
|
inline |
|
inline |
|
inline |
|
inline |
Group properties.
ot::PropertyGroup * ot::PropertyGroup::getRootGroup | ( | void | ) |
Returns the root group. If this group has no parent returns this group.
|
inline |
|
inline |
bool ot::PropertyGroup::isEmpty | ( | void | ) | const |
Returns false if at least one property exists in this group or any of the child groups.
|
virtual |
Adds the contents of the other configuration to this configuration. If an improved merge is required just subclass and implement.
_other | Other group to merge into this. |
_replaceExistingProperties | If enabled existing properties will be replaced with their corresponding property in the other group. Note that the property type may change if the other group contains a different property type. |
ot::PropertyGroup & ot::PropertyGroup::operator= | ( | const PropertyGroup & | _other | ) |
void ot::PropertyGroup::removeProperty | ( | const std::string & | _propertyName | ) |
Removes the property with the given name.
void ot::PropertyGroup::setChildGroups | ( | const std::list< PropertyGroup * > & | _groups | ) |
Set the child groups. This group takes ownership of the groups.
|
overridevirtual |
Will set the object contents from the provided JSON object.
_object | The JSON object containing the information |
Will | throw an exception if the provided object is not valid (members missing or invalid types) |
Implements ot::Serializable.
|
inline |
|
inline |
void ot::PropertyGroup::setProperties | ( | const std::list< Property * > & | _properties | ) |
Set the properties. This group takes ownership of the properties.
|
inline |