OpenLexocad  27.1
PropertyInteger.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vector>
4 
5 #include "Core/Property.h"
6 #include "Core/Variant.h"
7 
8 namespace Core
9 {
10 class LX_CORE_EXPORT PropertyInteger : public Core::Property
11 {
13 
14 public:
15  PropertyInteger(void);
16  virtual ~PropertyInteger(void);
17 
18  inline virtual void setValue(int i);
19  bool setValueFromVariant(const Core::Variant& value);
20  virtual void copyValue(Core::Property* p);
21 
22  int getValue() const;
23  Core::Variant getVariant(void) const;
24 
25  virtual void save(Base::AbstractWriter& writer, Base::PersistenceVersion& save_version);
26  inline virtual void restore(Base::AbstractXMLReader& reader, Base::PersistenceVersion& version);
27  virtual bool isEqual(const Property*) const;
28  virtual bool createSQL(Base::AbstractWriter& writer, Base::PersistenceVersion& save_version, bool data) override;
29  virtual Core::Property* copy(void) const override;
30  virtual void paste(const Core::Property& from) override;
31 
32 protected:
33  int _nValue;
34 };
35 
36 class LX_CORE_EXPORT PropertyLong : public Core::Property
37 {
39 
40 public:
41  PropertyLong(void);
42  virtual ~PropertyLong(void);
43 
44  inline virtual void setValue(long i);
45  bool setValueFromVariant(const Core::Variant& value);
46  virtual void copyValue(Core::Property* p);
47 
48  long getValue() const;
49  Core::Variant getVariant(void) const;
50 
51  virtual void save(Base::AbstractWriter& writer, Base::PersistenceVersion& save_version);
52  inline virtual void restore(Base::AbstractXMLReader& reader, Base::PersistenceVersion& version);
53  virtual bool isEqual(const Property*) const;
54  virtual Core::Property* copy(void) const override;
55  virtual void paste(const Core::Property& from) override;
56 
57 protected:
58  long _nValue;
59 };
60 
61 class LX_CORE_EXPORT PropertyUInt64 : public Core::Property
62 {
64 
65 public:
66  PropertyUInt64(void);
67  virtual ~PropertyUInt64(void);
68 
69  inline virtual void setValue(uint64_t i);
70  bool setValueFromVariant(const Core::Variant& value);
71  virtual void copyValue(Core::Property* p);
72 
73  uint64_t getValue() const;
74  Core::Variant getVariant(void) const;
75 
76  virtual void save(Base::AbstractWriter& writer, Base::PersistenceVersion& save_version);
77  inline virtual void restore(Base::AbstractXMLReader& reader, Base::PersistenceVersion& version);
78  virtual bool isEqual(const Property*) const;
79  virtual Core::Property* copy(void) const override;
80  virtual void paste(const Core::Property& from) override;
81 
82 protected:
83  uint64_t _nValue;
84 };
85 
86 class LX_CORE_EXPORT PropertyUInt32 : public Core::Property
87 {
89 
90 public:
91  PropertyUInt32(void);
92  virtual ~PropertyUInt32(void);
93 
94  inline virtual void setValue(uint32_t i);
95  bool setValueFromVariant(const Core::Variant& value);
96  virtual void copyValue(Core::Property* p);
97 
98  uint32_t getValue() const;
99  Core::Variant getVariant(void) const;
100 
101  virtual void save(Base::AbstractWriter& writer, Base::PersistenceVersion& save_version);
102  inline virtual void restore(Base::AbstractXMLReader& reader, Base::PersistenceVersion& version);
103  virtual bool isEqual(const Property*) const;
104  virtual Core::Property* copy(void) const override;
105  virtual void paste(const Core::Property& from) override;
106 
107 
108 
109 protected:
110  uint32_t _nValue;
111 };
112 
113 class LX_CORE_EXPORT PropertyUInt8 : public Core::Property
114 {
116 
117 public:
118  PropertyUInt8(void);
119  virtual ~PropertyUInt8(void);
120 
121  inline virtual void setValue(uint8_t i);
122  bool setValueFromVariant(const Core::Variant& value);
123  virtual void copyValue(Core::Property* p);
124 
125  uint8_t getValue() const;
126  Core::Variant getVariant(void) const;
127 
128  virtual void save(Base::AbstractWriter& writer, Base::PersistenceVersion& save_version);
129  inline virtual void restore(Base::AbstractXMLReader& reader, Base::PersistenceVersion& version);
130  virtual bool isEqual(const Property*) const;
131  virtual Core::Property* copy(void) const override;
132  virtual void paste(const Core::Property& from) override;
133 
134 protected:
135  uint8_t _nValue;
136 };
137 
138 
139 
140 class LX_CORE_EXPORT PropertyNumberOfDecimals : public Core::PropertyInteger
141 {
143 
144 public:
146  virtual ~PropertyNumberOfDecimals(void);
147 };
148 
149 
150 class LX_CORE_EXPORT PropertyIndex : public Core::PropertyInteger
151 {
153 
154 public:
155  PropertyIndex(void);
156  virtual ~PropertyIndex(void);
157 };
158 
159 class LX_CORE_EXPORT PropertyCountMeasure : public Core::PropertyInteger
160 {
162 
163 public:
164  PropertyCountMeasure(void);
165  virtual ~PropertyCountMeasure(void);
166 };
167 
168 
169 class LX_CORE_EXPORT PropertyIndexList : public Core::Property
170 {
172 
173 public:
175  virtual ~PropertyIndexList();
176 
177  void setValue(const std::vector<int>& list);
178  bool setValueFromVariant(const Core::Variant& value);
179  void copyValue(Core::Property* p);
180 
181  bool hasIndex(int i) const;
182  bool hasIndex(int i, int& order) const;
183  void addIndex(int i);
184  void removeIndex(int i);
185 
186  void setEmpty();
187  bool isEmpty() const;
188  size_t getSize() const;
189 
190  const std::vector<int>& getValue() const;
191 
192  Core::Variant getVariant(void) const { return Core::Variant(_indexList); }
193 
194  virtual void save(Base::AbstractWriter& writer, Base::PersistenceVersion& save_version);
195  inline virtual void restore(Base::AbstractXMLReader& reader, Base::PersistenceVersion& version);
196  virtual bool isEqual(const Property*) const;
197  virtual Core::Property* copy(void) const override;
198  virtual void paste(const Core::Property& from) override;
199 
200 protected:
201  std::vector<int> _indexList;
202 };
203 
204 class LX_CORE_EXPORT PropertyEnum : public Core::PropertyIndex
205 {
207 
208 public:
209  PropertyEnum();
210  virtual ~PropertyEnum();
211 
213 
214 
220  void setEnums(const char** plEnums);
224  void setValue(const char* value);
230  void setValue(int);
232  const char* getValueAsString(void) const;
234  std::vector<std::string> getEnumVector(void) const;
236  const char** getEnums(void) const;
237  virtual void copyValue(Core::Property* p);
238  virtual bool isEqual(const Property*) const;
239 
241 protected:
242  const char** _enumArray;
243 };
244 
245 
246 class LX_CORE_EXPORT PropertyUInt8List : public Core::Property
247 {
249 
250 public:
252  virtual ~PropertyUInt8List();
253 
254  void setValue(const std::vector<uint8_t>& list);
255  bool setValueFromVariant(const Core::Variant& value);
256  void copyValue(Core::Property* p);
257 
258  void setEmpty();
259  bool isEmpty() const;
260 
261  const std::vector<uint8_t>& getValue() const;
262 
263  Core::Variant getVariant(void) const { return Core::Variant(_indexList); }
264 
265  virtual void save(Base::AbstractWriter& writer, Base::PersistenceVersion& save_version);
266  inline virtual void restore(Base::AbstractXMLReader& reader, Base::PersistenceVersion& version);
267  virtual bool isEqual(const Property*) const;
268  virtual Core::Property* copy(void) const override;
269  virtual void paste(const Core::Property& from) override;
270 
271 protected:
272  std::vector<uint8_t> _indexList;
273 };
274 
275 DECLARE_PROPERTY_FACTORY(PropertyInteger_Factory, Core::PropertyInteger);
276 DECLARE_PROPERTY_FACTORY(PropertyNumberOfDecimals_Factory, Core::PropertyNumberOfDecimals);
277 DECLARE_PROPERTY_FACTORY(PropertyIndex_Factory, Core::PropertyIndex);
278 DECLARE_PROPERTY_FACTORY(PropertyIndexList_Factory, Core::PropertyIndexList);
279 DECLARE_PROPERTY_FACTORY(PropertyEnum_Factory, Core::PropertyEnum);
280 DECLARE_PROPERTY_FACTORY(PropertyCountMeasure_Factory, Core::PropertyCountMeasure);
281 
284 
285 
286 } // namespace Core
DECLARE_OPTIONAL_PROPERTY_HEADER(PropertyColorOpt, Core::PropertyColor)
Definition: PropertyInteger.h:140
Definition: PropertyInteger.h:113
Definition: Persistence.h:14
Definition: PropertyInteger.h:169
Definition: PropertyInteger.h:36
Definition: PropertyInteger.h:204
Definition: PropertyInteger.h:86
std::vector< int > _indexList
Definition: PropertyInteger.h:201
const char ** _enumArray
Definition: PropertyInteger.h:242
long _nValue
Definition: PropertyInteger.h:58
LX_CORE_EXPORT Version & version
Definition: Variant.h:87
Core::Variant getVariant(void) const
Definition: PropertyInteger.h:192
Definition: PropertyInteger.h:10
Definition: AbstractXMLReader.h:7
Definition: Base.h:12
int _nValue
Definition: PropertyInteger.h:33
Definition: PropertyInteger.h:61
Definition: Writer.h:16
Core::Variant getVariant(void) const
Definition: PropertyInteger.h:263
uint32_t _nValue
Definition: PropertyInteger.h:110
uint8_t _nValue
Definition: PropertyInteger.h:135
Definition: Property.h:77
Definition: PropertyInteger.h:246
Definition: PropertyInteger.h:150
std::vector< uint8_t > _indexList
Definition: PropertyInteger.h:272
TYPESYSTEM_HEADER()
DECLARE_PROPERTY_FACTORY(PropertyAxis1_Factory, Core::PropertyAxis1)
uint64_t _nValue
Definition: PropertyInteger.h:83
Definition: PropertyInteger.h:159