The Property class is used as a base class for all Properties that can be displayed and modified in the frontend. More...
#include "Property.h"
Public Member Functions | |
Property (const Property *_other) | |
Property (const PropertyBase &_base) | |
Property (PropertyFlags _flags=PropertyFlags(NoFlags)) | |
Property (const std::string &_name, PropertyFlags _flags=PropertyFlags(NoFlags)) | |
virtual | ~Property () |
Destructor. Destroys the parent group if set. | |
virtual std::string | getPropertyType (void) const =0 |
virtual Property * | createCopy (void) const =0 |
Creates a copy of this property. | |
Property * | createCopyWithParents (void) const |
brief Creates a copy of this property and all parent groups excluding other properties and group paths. The created property will have all the parent groups set up to the root group. | |
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. | |
void | setParentGroup (PropertyGroup *_group) |
PropertyGroup * | getParentGroup (void) const |
PropertyGroup * | getRootGroup (void) const |
Returns the root group. If this item has no parent group returns 0. | |
std::string | getPropertyPath (char _delimiter='/') const |
Returns the property path. The property path is a string containing all parent groups and the property name (e.g. "RootGroup/ChildGroup/ThisItem"). | |
Public Member Functions inherited from ot::PropertyBase | |
PropertyBase (PropertyFlags _flags=PropertyFlags(NoFlags)) | |
Default constructor. | |
PropertyBase (const std::string &_name, PropertyFlags _flags=PropertyFlags(NoFlags)) | |
Assignment constructor. | |
PropertyBase (const PropertyBase &_other) | |
Copy constructor. | |
virtual | ~PropertyBase () |
Destructor. | |
PropertyBase & | operator= (const PropertyBase &_other) |
Assignment operator. | |
void | setPropertyName (const std::string &_name) |
const std::string & | getPropertyName (void) const |
void | setPropertyTitle (const std::string &_title) |
Set the property title If no title set the name will be used as title. | |
const std::string & | getPropertyTitle (void) const |
Property title If no title set the name will be used as title. | |
void | setPropertyTip (const std::string &_tip) |
std::string & | getPropertyTip (void) |
const std::string & | getPropertyTip (void) const |
void | setPropertyFlag (PropertyFlag _flag, bool _active=true) |
void | setPropertyFlags (PropertyFlags _flags) |
PropertyFlags & | getPropertyFlags (void) |
const PropertyFlags & | getPropertyFlags (void) const |
void | setSpecialType (const std::string &_type) |
const std::string & | getSpecialType (void) const |
void | addAdditionalPropertyData (const std::string &_key, const std::string &_data) |
void | setAdditionalPropertyData (const std::map< std::string, std::string > &_data) |
const std::map< std::string, std::string > & | getAllAdditionalPropertyData (void) const |
std::string | getAdditionalPropertyData (const std::string &_key) const |
Public Member Functions inherited from ot::Serializable | |
Serializable () | |
virtual | ~Serializable () |
Protected Member Functions | |
virtual void | getPropertyData (ot::JsonValue &_object, ot::JsonAllocator &_allocator) const =0 |
Add the property data to the provided JSON object The property type is already added. | |
virtual void | setPropertyData (const ot::ConstJsonObject &_object)=0 |
Set the property data from the provided JSON object. | |
Additional Inherited Members | |
Public Types inherited from ot::PropertyBase | |
enum | PropertyFlag { NoFlags = 0x0000 , IsReadOnly = 0x0001 , IsProtected = 0x0002 , IsHidden = 0x0004 , HasMultipleValues = 0x0008 , HasInputError = 0x0010 , IsDeletable = 0x0020 , AllowCustomValues = 0x1000 , AllowMultiselection = 0x2000 } |
The PropertyFlag enum contains different settings for properties. More... | |
typedef Flags< PropertyFlag > | PropertyFlags |
The PropertyFlag enum contains different settings for properties. | |
Static Public Member Functions inherited from ot::PropertyBase | |
static std::string | toString (PropertyFlag _flag) |
Creates a string representation of the provided PropertyFlag. | |
static PropertyFlag | stringToFlag (const std::string &_flag) |
Returns the PropertyFlag that is represented by the string. | |
static std::list< std::string > | toStringList (PropertyFlags _flags) |
Creates a list containing strings that represent the set PropertyFlags. | |
static PropertyFlags | stringListToFlags (const std::list< std::string > &_flags) |
Returns the PropertyFlags that are represented by the string list. | |
The Property class is used as a base class for all Properties that can be displayed and modified in the frontend.
ot::Property::Property | ( | const Property * | _other | ) |
ot::Property::Property | ( | const PropertyBase & | _base | ) |
ot::Property::Property | ( | PropertyFlags | _flags = PropertyFlags(NoFlags) | ) |
ot::Property::Property | ( | const std::string & | _name, |
PropertyFlags | _flags = PropertyFlags(NoFlags) ) |
|
virtual |
Destructor. Destroys the parent group if set.
|
overridevirtual |
Add the object contents to the provided JSON object.
_object | Json object reference |
_allocator | Allocator |
Reimplemented from ot::PropertyBase.
|
pure virtual |
Creates a copy of this property.
Implemented in ot::PropertyBool, ot::PropertyColor, ot::PropertyDirectory, ot::PropertyDouble, ot::PropertyFilePath, ot::PropertyInt, ot::PropertyPainter2D, ot::PropertyString, and ot::PropertyStringList.
ot::Property * ot::Property::createCopyWithParents | ( | void | ) | const |
brief Creates a copy of this property and all parent groups excluding other properties and group paths. The created property will have all the parent groups set up to the root group.
Assume you have the following structure:
Root +--> ChildGroup1 +--> Property1 +--> ChildGroup2 +--> <This Property> +--> ChildGroup3 +--> Property3 Then the new structure will be: Root +--> ChildGroup2 +--> <This Property>
|
inline |
|
protectedpure virtual |
Add the property data to the provided JSON object The property type is already added.
_object | Json object reference |
_allocator | Allocator |
Implemented in ot::PropertyBool, ot::PropertyColor, ot::PropertyDirectory, ot::PropertyDouble, ot::PropertyFilePath, ot::PropertyInt, ot::PropertyPainter2D, ot::PropertyString, and ot::PropertyStringList.
std::string ot::Property::getPropertyPath | ( | char | _delimiter = '/' | ) | const |
Returns the property path. The property path is a string containing all parent groups and the property name (e.g. "RootGroup/ChildGroup/ThisItem").
|
pure virtual |
ot::PropertyGroup * ot::Property::getRootGroup | ( | void | ) | const |
Returns the root group. If this item has no parent group returns 0.
|
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) |
Reimplemented from ot::PropertyBase.
|
inline |
|
protectedpure virtual |
Set the property data 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) |
Implemented in ot::PropertyBool, ot::PropertyColor, ot::PropertyDirectory, ot::PropertyDouble, ot::PropertyFilePath, ot::PropertyInt, ot::PropertyPainter2D, ot::PropertyString, and ot::PropertyStringList.