OpenLexocad  28.0
PropertyInteger.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <Core/Property.h>
4 
5 namespace Core
6 {
7 class LX_CORE_EXPORT PropertyInteger : public Core::Property
8 {
10 
11 public:
12  virtual void setValue(int i);
13  bool setValueFromVariant(const Core::Variant& value);
14  virtual void copyValue(Core::Property* p);
15 
16  int getValue() const;
18 
19  virtual void save(Base::AbstractWriter& writer, Base::PersistenceVersion& save_version);
21  virtual bool isEqual(const Property*) const;
22  virtual bool createSQL(Base::AbstractWriter& writer, Base::PersistenceVersion& save_version, bool data) override;
23  virtual Core::Property* copy(void) const override;
24  virtual void paste(const Core::Property& from) override;
25 
26 protected:
27  int _nValue = 0;
28 };
29 
30 class LX_CORE_EXPORT PropertyLong : public Core::Property
31 {
33 
34 public:
35  virtual void setValue(long i);
36  bool setValueFromVariant(const Core::Variant& value);
37  virtual void copyValue(Core::Property* p);
38 
39  long getValue() const;
41 
42  virtual void save(Base::AbstractWriter& writer, Base::PersistenceVersion& save_version);
44  virtual bool isEqual(const Property*) const;
45  virtual Core::Property* copy(void) const override;
46  virtual void paste(const Core::Property& from) override;
47 
48 protected:
49  long _nValue = 0L;
50 };
51 
52 class LX_CORE_EXPORT PropertyUInt64 : public Core::Property
53 {
55 
56 public:
57  virtual void setValue(uint64_t i);
58  bool setValueFromVariant(const Core::Variant& value);
59  virtual void copyValue(Core::Property* p);
60 
61  uint64_t getValue() const;
63 
64  virtual void save(Base::AbstractWriter& writer, Base::PersistenceVersion& save_version);
66  virtual bool isEqual(const Property*) const;
67  virtual Core::Property* copy(void) const override;
68  virtual void paste(const Core::Property& from) override;
69 
70 protected:
71  uint64_t _nValue = 0;
72 };
73 
74 class LX_CORE_EXPORT PropertyUInt32 : public Core::Property
75 {
77 
78 public:
79  virtual void setValue(uint32_t i);
80  bool setValueFromVariant(const Core::Variant& value);
81  virtual void copyValue(Core::Property* p);
82 
83  uint32_t getValue() const;
85 
86  virtual void save(Base::AbstractWriter& writer, Base::PersistenceVersion& save_version);
88  virtual bool isEqual(const Property*) const;
89  virtual Core::Property* copy(void) const override;
90  virtual void paste(const Core::Property& from) override;
91 
92 
93 
94 protected:
95  uint32_t _nValue = 0;
96 };
97 
98 class LX_CORE_EXPORT PropertyUInt8 : public Core::Property
99 {
101 
102 public:
103  virtual void setValue(uint8_t i);
104  bool setValueFromVariant(const Core::Variant& value);
105  virtual void copyValue(Core::Property* p);
106 
107  uint8_t getValue() const;
109 
110  virtual void save(Base::AbstractWriter& writer, Base::PersistenceVersion& save_version);
112  virtual bool isEqual(const Property*) const;
113  virtual Core::Property* copy(void) const override;
114  virtual void paste(const Core::Property& from) override;
115 
116 protected:
117  uint8_t _nValue = 0;
118 };
119 
120 
121 
122 class LX_CORE_EXPORT PropertyNumberOfDecimals : public Core::PropertyInteger
123 {
125 };
126 
127 
128 class LX_CORE_EXPORT PropertyIndex : public Core::PropertyInteger
129 {
131 };
132 
133 class LX_CORE_EXPORT PropertyCountMeasure : public Core::PropertyInteger
134 {
136 };
137 
138 
139 class LX_CORE_EXPORT PropertyIndexList : public Core::Property
140 {
142 
143 public:
144  void setValue(const std::vector<int>& list);
145  bool setValueFromVariant(const Core::Variant& value);
147 
148  bool hasIndex(int i) const;
149  bool hasIndex(int i, int& order) const;
150  void addIndex(int i);
151  void removeIndex(int i);
152 
153  void setEmpty();
154  bool isEmpty() const;
155  size_t getSize() const;
156 
157  const std::vector<int>& getValue() const;
158 
159  Core::Variant getVariant(void) const { return Core::Variant(_indexList); }
160 
161  virtual void save(Base::AbstractWriter& writer, Base::PersistenceVersion& save_version);
163  virtual bool isEqual(const Property*) const;
164  virtual Core::Property* copy(void) const override;
165  virtual void paste(const Core::Property& from) override;
166 
167 protected:
168  std::vector<int> _indexList;
169 };
170 
171 class LX_CORE_EXPORT PropertyEnum : public Core::PropertyIndex
172 {
174 
175 public:
177 
178 
184  void setEnums(const char** plEnums);
188  void setValue(const char* value);
194  void setValue(int);
196  const char* getValueAsString(void) const;
198  std::vector<std::string> getEnumVector(void) const;
200  const char** getEnums(void) const;
201  virtual void copyValue(Core::Property* p);
202  virtual bool isEqual(const Property*) const;
203 
205 protected:
206  const char** _enumArray = nullptr;
207 };
208 
209 
210 class LX_CORE_EXPORT PropertyUInt8List : public Core::Property
211 {
213 
214 public:
215  void setValue(const std::vector<uint8_t>& list);
216  bool setValueFromVariant(const Core::Variant& value);
218 
219  void setEmpty();
220  bool isEmpty() const;
221 
222  const std::vector<uint8_t>& getValue() const;
223 
224  Core::Variant getVariant(void) const { return Core::Variant(_indexList); }
225 
226  virtual void save(Base::AbstractWriter& writer, Base::PersistenceVersion& save_version);
228  virtual bool isEqual(const Property*) const;
229  virtual Core::Property* copy(void) const override;
230  virtual void paste(const Core::Property& from) override;
231 
232 protected:
233  std::vector<uint8_t> _indexList;
234 };
235 
237 DECLARE_PROPERTY_FACTORY(PropertyNumberOfDecimals_Factory, Core::PropertyNumberOfDecimals);
242 
245 
246 
247 } // namespace Core
Core::PropertyIndexList::isEqual
virtual bool isEqual(const Property *) const
compare properties
Property.h
Core::PropertyUInt8List::isEmpty
bool isEmpty() const
Core::PropertyUInt8List::getVariant
Core::Variant getVariant(void) const
Definition: PropertyInteger.h:224
Core::PropertyEnum::getValueAsString
const char * getValueAsString(void) const
get the value as string
Core::PropertyEnum::setValue
void setValue(int)
Core::PropertyUInt64::restore
virtual void restore(Base::AbstractXMLReader &reader, Base::PersistenceVersion &version)
This method is used to restore properties from an XML document.
Core::PropertyUInt8::getValue
uint8_t getValue() const
Core::PropertyUInt8List
Definition: PropertyInteger.h:211
Core::PropertyIndexList::setEmpty
void setEmpty()
Core::PropertyInteger::createSQL
virtual bool createSQL(Base::AbstractWriter &writer, Base::PersistenceVersion &save_version, bool data) override
This method is used to save properties or very small amounts of data to an XML document.
Core::PropertyUInt32::save
virtual void save(Base::AbstractWriter &writer, Base::PersistenceVersion &save_version)
This method is used to save properties or very small amounts of data to an XML document.
Core::PropertyIndexList::save
virtual void save(Base::AbstractWriter &writer, Base::PersistenceVersion &save_version)
This method is used to save properties or very small amounts of data to an XML document.
Core::PropertyUInt8List::_indexList
std::vector< uint8_t > _indexList
Definition: PropertyInteger.h:233
Core::PropertyUInt8::setValue
virtual void setValue(uint8_t i)
Core::PropertyInteger::restore
virtual void restore(Base::AbstractXMLReader &reader, Base::PersistenceVersion &version)
This method is used to restore properties from an XML document.
Core::PropertyUInt64::getValue
uint64_t getValue() const
Core::PropertyIndexList::copy
virtual Core::Property * copy(void) const override
Returns a new copy of the property (mainly for Undo/Redo and transactions). The copy has no container...
Core::PropertyIndexList::isEmpty
bool isEmpty() const
Core::PropertyUInt32::getValue
uint32_t getValue() const
Core::PropertyEnum::copyValue
virtual void copyValue(Core::Property *p)
Core::PropertyUInt32::paste
virtual void paste(const Core::Property &from) override
Paste the value from the property (mainly for Undo/Redo and transactions)
Core::PropertyUInt32::setValueFromVariant
bool setValueFromVariant(const Core::Variant &value)
Core::PropertyIndexList::_indexList
std::vector< int > _indexList
Definition: PropertyInteger.h:168
Core::PropertyEnum::setValue
void setValue(const char *value)
Core::PropertyLong::save
virtual void save(Base::AbstractWriter &writer, Base::PersistenceVersion &save_version)
This method is used to save properties or very small amounts of data to an XML document.
Core::PropertyUInt8::paste
virtual void paste(const Core::Property &from) override
Paste the value from the property (mainly for Undo/Redo and transactions)
Core::PropertyIndexList::getSize
size_t getSize() const
Core::PropertyEnum::getEnumVector
std::vector< std::string > getEnumVector(void) const
get all possible enum values as vector of strings
Core::PropertyUInt8List::setValue
void setValue(const std::vector< uint8_t > &list)
Core::PropertyLong::copyValue
virtual void copyValue(Core::Property *p)
Core::PropertyUInt8List::paste
virtual void paste(const Core::Property &from) override
Paste the value from the property (mainly for Undo/Redo and transactions)
Core::PropertyIndexList::getVariant
Core::Variant getVariant(void) const
Definition: PropertyInteger.h:159
Core::PropertyUInt8List::copy
virtual Core::Property * copy(void) const override
Returns a new copy of the property (mainly for Undo/Redo and transactions). The copy has no container...
Core::PropertyIndexList::paste
virtual void paste(const Core::Property &from) override
Paste the value from the property (mainly for Undo/Redo and transactions)
Core::PropertyEnum::setEnums
void setEnums(const char **plEnums)
Enumeration methods.
Base::PersistenceVersion
Definition: Persistence.h:13
Core::PropertyIndexList
Definition: PropertyInteger.h:140
Core::PropertyUInt8::getVariant
Core::Variant getVariant(void) const
Core
Definition: Base.h:5
Core::PropertyIndexList::addIndex
void addIndex(int i)
Core::PropertyInteger::save
virtual void save(Base::AbstractWriter &writer, Base::PersistenceVersion &save_version)
This method is used to save properties or very small amounts of data to an XML document.
Core::PropertyLong::paste
virtual void paste(const Core::Property &from) override
Paste the value from the property (mainly for Undo/Redo and transactions)
Core::Variant
Definition: Variant.h:78
Core::PropertyUInt32::restore
virtual void restore(Base::AbstractXMLReader &reader, Base::PersistenceVersion &version)
This method is used to restore properties from an XML document.
Core::PropertyLong::restore
virtual void restore(Base::AbstractXMLReader &reader, Base::PersistenceVersion &version)
This method is used to restore properties from an XML document.
Core::PropertyUInt64::isEqual
virtual bool isEqual(const Property *) const
compare properties
Core::PropertyLong::setValueFromVariant
bool setValueFromVariant(const Core::Variant &value)
Base::AbstractWriter
Definition: Writer.h:13
Core::PropertyUInt32::isEqual
virtual bool isEqual(const Property *) const
compare properties
Core::PropertyUInt8List::save
virtual void save(Base::AbstractWriter &writer, Base::PersistenceVersion &save_version)
This method is used to save properties or very small amounts of data to an XML document.
Core::PropertyUInt8List::getValue
const std::vector< uint8_t > & getValue() const
Core::PropertyLong::getValue
long getValue() const
Core::PropertyLong::setValue
virtual void setValue(long i)
Base::AbstractXMLReader
Definition: AbstractXMLReader.h:7
Core::PropertyUInt64::setValue
virtual void setValue(uint64_t i)
Core::PropertyUInt64::save
virtual void save(Base::AbstractWriter &writer, Base::PersistenceVersion &save_version)
This method is used to save properties or very small amounts of data to an XML document.
Core::PropertyIndexList::hasIndex
bool hasIndex(int i) const
Core::PropertyUInt32::getVariant
Core::Variant getVariant(void) const
Core::PropertyUInt8::save
virtual void save(Base::AbstractWriter &writer, Base::PersistenceVersion &save_version)
This method is used to save properties or very small amounts of data to an XML document.
Core::PropertyIndexList::restore
virtual void restore(Base::AbstractXMLReader &reader, Base::PersistenceVersion &version)
This method is used to restore properties from an XML document.
Core::PropertyUInt8List::copyValue
void copyValue(Core::Property *p)
Core::PropertyUInt64::getVariant
Core::Variant getVariant(void) const
Core::PropertyCountMeasure
Definition: PropertyInteger.h:134
Core::PropertyInteger::copy
virtual Core::Property * copy(void) const override
Returns a new copy of the property (mainly for Undo/Redo and transactions). The copy has no container...
Core::PropertyUInt8::copy
virtual Core::Property * copy(void) const override
Returns a new copy of the property (mainly for Undo/Redo and transactions). The copy has no container...
Core::PropertyIndexList::removeIndex
void removeIndex(int i)
Core::PropertyIndexList::getValue
const std::vector< int > & getValue() const
Core::PropertyLong::getVariant
Core::Variant getVariant(void) const
Core::PropertyIndexList::hasIndex
bool hasIndex(int i, int &order) const
Core::PropertyUInt32::copyValue
virtual void copyValue(Core::Property *p)
Core::PropertyNumberOfDecimals
Definition: PropertyInteger.h:123
Core::PropertyLong
Definition: PropertyInteger.h:31
Core::PropertyInteger::isEqual
virtual bool isEqual(const Property *) const
compare properties
Core::PropertyUInt8::copyValue
virtual void copyValue(Core::Property *p)
Core::PropertyInteger::setValue
virtual void setValue(int i)
Core::version
LX_CORE_EXPORT Version & version
Core::PropertyEnum
Definition: PropertyInteger.h:172
Core::PropertyInteger::paste
virtual void paste(const Core::Property &from) override
Paste the value from the property (mainly for Undo/Redo and transactions)
Core::PropertyInteger::getValue
int getValue() const
Core::PropertyIndex
Definition: PropertyInteger.h:129
Core::PropertyLong::copy
virtual Core::Property * copy(void) const override
Returns a new copy of the property (mainly for Undo/Redo and transactions). The copy has no container...
Core::PropertyUInt64::paste
virtual void paste(const Core::Property &from) override
Paste the value from the property (mainly for Undo/Redo and transactions)
Core::PropertyUInt8
Definition: PropertyInteger.h:99
Core::Property
Definition: Property.h:72
Core::PropertyIndexList::setValueFromVariant
bool setValueFromVariant(const Core::Variant &value)
Core::PropertyUInt8List::setValueFromVariant
bool setValueFromVariant(const Core::Variant &value)
Core::PropertyEnum::isEqual
virtual bool isEqual(const Property *) const
compare properties
Core::PropertyInteger::setValueFromVariant
bool setValueFromVariant(const Core::Variant &value)
Core::PropertyUInt32::setValue
virtual void setValue(uint32_t i)
Core::PropertyInteger::copyValue
virtual void copyValue(Core::Property *p)
Core::PropertyUInt64::setValueFromVariant
bool setValueFromVariant(const Core::Variant &value)
Core::PropertyUInt8List::isEqual
virtual bool isEqual(const Property *) const
compare properties
Core::PropertyIndexList::setValue
void setValue(const std::vector< int > &list)
Core::DECLARE_OPTIONAL_PROPERTY_HEADER
DECLARE_OPTIONAL_PROPERTY_HEADER(PropertyColorOpt, Core::PropertyColor)
Core::PropertyUInt8List::restore
virtual void restore(Base::AbstractXMLReader &reader, Base::PersistenceVersion &version)
This method is used to restore properties from an XML document.
Core::PropertyUInt8::isEqual
virtual bool isEqual(const Property *) const
compare properties
Core::PropertyUInt32
Definition: PropertyInteger.h:75
TYPESYSTEM_HEADER
#define TYPESYSTEM_HEADER()
define for subclassing Base::BaseClass
Definition: Base.h:12
Core::DECLARE_PROPERTY_FACTORY
DECLARE_PROPERTY_FACTORY(PropertyAxis1_Factory, Core::PropertyAxis1)
Core::PropertyInteger::getVariant
Core::Variant getVariant(void) const
Core::PropertyUInt8List::setEmpty
void setEmpty()
Core::PropertyUInt8::setValueFromVariant
bool setValueFromVariant(const Core::Variant &value)
Core::PropertyIndexList::copyValue
void copyValue(Core::Property *p)
Core::PropertyUInt64::copyValue
virtual void copyValue(Core::Property *p)
Core::PropertyUInt32::copy
virtual Core::Property * copy(void) const override
Returns a new copy of the property (mainly for Undo/Redo and transactions). The copy has no container...
Core::PropertyUInt8::restore
virtual void restore(Base::AbstractXMLReader &reader, Base::PersistenceVersion &version)
This method is used to restore properties from an XML document.
Core::PropertyInteger
Definition: PropertyInteger.h:8
Core::PropertyLong::isEqual
virtual bool isEqual(const Property *) const
compare properties
Core::PropertyUInt64::copy
virtual Core::Property * copy(void) const override
Returns a new copy of the property (mainly for Undo/Redo and transactions). The copy has no container...
Core::PropertyUInt64
Definition: PropertyInteger.h:53
Core::PropertyEnum::getEnums
const char ** getEnums(void) const
get the pointer to the enum list