OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
PropertyGroup.h
Go to the documentation of this file.
1
4// ###########################################################################################################################################################################################################################################################################################################################
5
6#pragma once
7
8// OpenTwin header
9#include "OTCore/Color.h"
10#include "OTCore/Serializable.h"
13
14// std header
15#include <list>
16
17#pragma warning(disable:4251)
18
19namespace ot {
20
21 class Property;
22
24 public:
27
28 PropertyGroup(const PropertyGroup& _other);
29
32 PropertyGroup(const std::string& _name);
33
37 PropertyGroup(const std::string& _name, const std::string& _title);
38
41 virtual ~PropertyGroup();
42
43 PropertyGroup& operator = (const PropertyGroup& _other);
44
45 PropertyGroup* createCopy(bool _includeChilds) const;
46
50 virtual void addToJsonObject(ot::JsonValue& _object, ot::JsonAllocator& _allocator) const override;
51
55 virtual void setFromJsonObject(const ot::ConstJsonObject& _object) override;
56
61 virtual void mergeWith(const PropertyGroup& _other, bool _replaceExistingProperties);
62
63 void setParentGroup(PropertyGroup* _group) { m_parentGroup = _group; };
64 PropertyGroup* getParentGroup(void) const { return m_parentGroup; };
65
68 PropertyGroup* getRootGroup(void);
69
70 void setName(const std::string& _name) { m_name = _name; };
71 std::string& getName(void) { return m_name; };
72 const std::string& getName(void) const { return m_name; };
73
74 void setTitle(const std::string& _title) { m_title = _title; };
75 std::string& getTitle(void) { return m_title; };
76 const std::string& getTitle(void) const { return m_title; };
77
80 void setProperties(const std::list<Property*>& _properties);
81
84 void addProperty(Property* _property);
85
87 void removeProperty(const std::string& _propertyName);
88
90 void forgetProperty(Property* _property);
91
93 const std::list<Property*>& getProperties(void) const { return m_properties; };
94
96 std::list<Property*> getAllProperties(void) const;
97
101 Property* findPropertyByPath(std::list<std::string> _path) const;
102
105 void setChildGroups(const std::list<PropertyGroup*>& _groups);
106
107 const std::list<PropertyGroup*>& getChildGroups(void) const { return m_childGroups; };
108
111 void addChildGroup(PropertyGroup* _group);
112
113 PropertyGroup* findGroup(const std::string& _name) const;
114
116 void forgetChildGroup(PropertyGroup* _propertyGroup);
117
118 void findPropertiesBySpecialType(const std::string& _specialType, std::list<Property*>& _list) const;
119
120 void clear(bool _keepGroups = false);
121
123 bool isEmpty(void) const;
124
127 std::string getGroupPath(char _delimiter = '/') const;
128
129 private:
130 PropertyGroup* m_parentGroup;
131
132 std::string m_name;
133 std::string m_title;
134 std::list<Property*> m_properties;
135 std::list<PropertyGroup*> m_childGroups;
136 };
137
138}
This file contains defines that may be used simplyfy class creation.
#define OT_GUI_API_EXPORT
Definition OTGuiAPIExport.h:9
Definition PropertyGroup.h:23
const std::string & getName(void) const
Definition PropertyGroup.h:72
const std::string & getTitle(void) const
Definition PropertyGroup.h:76
std::string & getName(void)
Definition PropertyGroup.h:71
const std::list< PropertyGroup * > & getChildGroups(void) const
Definition PropertyGroup.h:107
std::string & getTitle(void)
Definition PropertyGroup.h:75
void setName(const std::string &_name)
Definition PropertyGroup.h:70
void setTitle(const std::string &_title)
Definition PropertyGroup.h:74
void setParentGroup(PropertyGroup *_group)
Definition PropertyGroup.h:63
PropertyGroup * getParentGroup(void) const
Definition PropertyGroup.h:64
const std::list< Property * > & getProperties(void) const
Group properties.
Definition PropertyGroup.h:93
The Property class is used as a base class for all Properties that can be displayed and modified in t...
Definition Property.h:21
The Serializable class is the default interface of serializable objects.
Definition Serializable.h:17
Definition Connector.h:8
rapidjson::Value JsonValue
Writable JSON value.
Definition JSON.h:27
rapidjson::GenericObject< true, rapidjson::GenericValue< rapidjson::UTF8<>, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > > > ConstJsonObject
Read only JSON Object.
Definition JSON.h:35
rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > JsonAllocator
Allocator used for writing to JSON values.
Definition JSON.h:30