OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
ot::PropertyGroup Class Reference

#include "PropertyGroup.h"

Inheritance diagram for ot::PropertyGroup:
ot::Serializable

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.
 
PropertyGroupoperator= (const PropertyGroup &_other)
 
PropertyGroupcreateCopy (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)
 
PropertyGroupgetParentGroup (void) const
 
PropertyGroupgetRootGroup (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.
 
PropertyfindPropertyByPath (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.
 
PropertyGroupfindGroup (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 ()
 

Constructor & Destructor Documentation

◆ PropertyGroup() [1/4]

ot::PropertyGroup::PropertyGroup ( )

Create empty group.

◆ PropertyGroup() [2/4]

ot::PropertyGroup::PropertyGroup ( const PropertyGroup & _other)

◆ PropertyGroup() [3/4]

ot::PropertyGroup::PropertyGroup ( const std::string & _name)

Create empty group with name and title.

Parameters
_nameWill be set as name and title

◆ PropertyGroup() [4/4]

ot::PropertyGroup::PropertyGroup ( const std::string & _name,
const std::string & _title )

Create empty group with name and title.

Parameters
_nameGroup name
_titleGroup title

◆ ~PropertyGroup()

ot::PropertyGroup::~PropertyGroup ( )
virtual

Destructor. Destroys the parent group if set.

Member Function Documentation

◆ addChildGroup()

void ot::PropertyGroup::addChildGroup ( PropertyGroup * _group)

Add the provided group as a child. This group takes ownership of the child.

◆ addProperty()

void ot::PropertyGroup::addProperty ( Property * _property)

Add the property. This group takes ownership of the property.

◆ addToJsonObject()

void ot::PropertyGroup::addToJsonObject ( ot::JsonValue & _object,
ot::JsonAllocator & _allocator ) const
overridevirtual

Add the object contents to the provided JSON object.

Parameters
_objectJson object reference
_allocatorAllocator

Implements ot::Serializable.

◆ clear()

void ot::PropertyGroup::clear ( bool _keepGroups = false)

◆ createCopy()

ot::PropertyGroup * ot::PropertyGroup::createCopy ( bool _includeChilds) const

◆ findGroup()

ot::PropertyGroup * ot::PropertyGroup::findGroup ( const std::string & _name) const

◆ findPropertiesBySpecialType()

void ot::PropertyGroup::findPropertiesBySpecialType ( const std::string & _specialType,
std::list< Property * > & _list ) const

◆ findPropertyByPath()

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.

◆ forgetChildGroup()

void ot::PropertyGroup::forgetChildGroup ( PropertyGroup * _propertyGroup)

Removes the property group from the list without destroying it.

◆ forgetProperty()

void ot::PropertyGroup::forgetProperty ( Property * _property)

Removes the property from the list without destroying it.

◆ getAllProperties()

std::list< ot::Property * > ot::PropertyGroup::getAllProperties ( void ) const

Returns all properties of all groups and nested groups.

◆ getChildGroups()

const std::list< PropertyGroup * > & ot::PropertyGroup::getChildGroups ( void ) const
inline

◆ getGroupPath()

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").

◆ getName() [1/2]

std::string & ot::PropertyGroup::getName ( void )
inline

◆ getName() [2/2]

const std::string & ot::PropertyGroup::getName ( void ) const
inline

◆ getParentGroup()

PropertyGroup * ot::PropertyGroup::getParentGroup ( void ) const
inline

◆ getProperties()

const std::list< Property * > & ot::PropertyGroup::getProperties ( void ) const
inline

Group properties.

◆ getRootGroup()

ot::PropertyGroup * ot::PropertyGroup::getRootGroup ( void )

Returns the root group. If this group has no parent returns this group.

◆ getTitle() [1/2]

std::string & ot::PropertyGroup::getTitle ( void )
inline

◆ getTitle() [2/2]

const std::string & ot::PropertyGroup::getTitle ( void ) const
inline

◆ isEmpty()

bool ot::PropertyGroup::isEmpty ( void ) const

Returns false if at least one property exists in this group or any of the child groups.

◆ mergeWith()

void ot::PropertyGroup::mergeWith ( const PropertyGroup & _other,
bool _replaceExistingProperties )
virtual

Adds the contents of the other configuration to this configuration. If an improved merge is required just subclass and implement.

Parameters
_otherOther group to merge into this.
_replaceExistingPropertiesIf 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.

◆ operator=()

ot::PropertyGroup & ot::PropertyGroup::operator= ( const PropertyGroup & _other)

◆ removeProperty()

void ot::PropertyGroup::removeProperty ( const std::string & _propertyName)

Removes the property with the given name.

◆ setChildGroups()

void ot::PropertyGroup::setChildGroups ( const std::list< PropertyGroup * > & _groups)

Set the child groups. This group takes ownership of the groups.

◆ setFromJsonObject()

void ot::PropertyGroup::setFromJsonObject ( const ot::ConstJsonObject & _object)
overridevirtual

Will set the object contents from the provided JSON object.

Parameters
_objectThe JSON object containing the information
Exceptions
Willthrow an exception if the provided object is not valid (members missing or invalid types)

Implements ot::Serializable.

◆ setName()

void ot::PropertyGroup::setName ( const std::string & _name)
inline

◆ setParentGroup()

void ot::PropertyGroup::setParentGroup ( PropertyGroup * _group)
inline

◆ setProperties()

void ot::PropertyGroup::setProperties ( const std::list< Property * > & _properties)

Set the properties. This group takes ownership of the properties.

◆ setTitle()

void ot::PropertyGroup::setTitle ( const std::string & _title)
inline

The documentation for this class was generated from the following files: