OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
PropertyString.h
Go to the documentation of this file.
1
4// ###########################################################################################################################################################################################################################################################################################################################
5
6#pragma once
7
8// OpenTwin header
9#include "OTGui/Property.h"
10
11// std header
12#include <string>
13
14namespace ot {
15
18 public:
19 PropertyString(const PropertyString* _other);
20 PropertyString(const PropertyBase& _base);
22 PropertyString(const std::string& _value, PropertyFlags _flags = PropertyFlags(NoFlags));
23 PropertyString(const std::string& _name, const std::string& _value, PropertyFlags _flags = PropertyFlags(NoFlags));
24 virtual ~PropertyString() {};
25
26 static std::string propertyTypeString(void) { return "String"; };
27 virtual std::string getPropertyType(void) const override { return PropertyString::propertyTypeString(); };
28
29 virtual Property* createCopy(void) const override;
30
31 void setValue(const std::string& _value) { m_value = _value; };
32 const std::string& getValue(void) const { return m_value; };
33
34 void setPlaceholderText(const std::string& _text) { m_placeholderText = _text; };
35 const std::string& getPlaceholderText(void) const { return m_placeholderText; };
36
37 void setMaxLength(int _length) { m_maxLength = _length; };
38 int getMaxLength(void) const { return m_maxLength; };
39
40 protected:
45 virtual void getPropertyData(ot::JsonValue& _object, ot::JsonAllocator& _allocator) const override;
46
50 virtual void setPropertyData(const ot::ConstJsonObject& _object) override;
51
52 private:
53 std::string m_value;
54 std::string m_placeholderText;
55 unsigned int m_maxLength;
56 };
57
58}
#define OT_DECL_NOCOPY(___class)
Removes the default copy constructor and assignment operator.
Definition OTClassHelper.h:14
#define OT_GUI_API_EXPORT
Definition OTGuiAPIExport.h:9
The PropertyBase class is used to hold general Property information.
Definition PropertyBase.h:25
The Property class is used as a base class for all Properties that can be displayed and modified in t...
Definition Property.h:21
Definition PropertyString.h:16
void setMaxLength(int _length)
Definition PropertyString.h:37
void setValue(const std::string &_value)
Definition PropertyString.h:31
const std::string & getValue(void) const
Definition PropertyString.h:32
int getMaxLength(void) const
Definition PropertyString.h:38
const std::string & getPlaceholderText(void) const
Definition PropertyString.h:35
virtual std::string getPropertyType(void) const override
Definition PropertyString.h:27
virtual ~PropertyString()
Definition PropertyString.h:24
static std::string propertyTypeString(void)
Definition PropertyString.h:26
void setPlaceholderText(const std::string &_text)
Definition PropertyString.h:34
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