OpenLexocad  28.0
PropertyContainer.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <Core/PropertyMacros.h>
4 #include <Core/DynamicProperty.h>
5 #include <Core/Property.h>
6 namespace Base { class AbstractWriter; }
7 namespace Base { class AbstractXMLReader; }
8 
9 #define USE_PROPERTYMAP
10 
11 constexpr const char* PropertyName = "Property";
12 
13 class QFont;
14 
15 
16 namespace Core
17 {
18 class FieldData
19 {
20 public:
21  FieldData(const Core::FieldData* /*fd*/){};
22 };
23 } // namespace Core
24 
25 namespace App
26 {
27 class ElementTool;
28 }
29 namespace Draw
30 {
31 } // namespace Draw
32 namespace Geom
33 {
34 }
35 
36 
37 #define MUTABLE_CONTAINER(_class_) \
38 public: \
39  static bool isMutableStatic() { return true; } \
40 \
41 public: \
42  virtual bool isMutable() const { return true; }
43 
44 #define IMMUTABLE_CONTAINER(_class_) \
45 public: \
46  friend class Core::PropertyBundle<_class_>; \
47 \
48 public: \
49  static bool isMutableStatic() { return false; } \
50 \
51 public: \
52  virtual bool isMutable() const { return false; } \
53 \
54 public: \
55  Core::PropertyBundle<_class_> getPropertyBundle() const \
56  { \
57  Core::PropertyBundle<_class_> dsBundle; \
58  dsBundle.setPropertyValues(this); \
59  return dsBundle; \
60  }
61 
62 
63 namespace Core
64 {
65 class CoreDocument;
66 class DocObject;
67 class PropertyUser;
68 
70 {
71  Prop_None = 0,
78 };
79 
80 class LX_CORE_EXPORT LxFieldData
81 {
82 public:
83  LxFieldData(void);
85  void addField(void* base, const char* fieldname, void* fieldptr);
86  std::unordered_map<std::string, ptrdiff_t> m_fieldmap;
87  bool fieldsAdded = false;
88 };
89 
90 
91 
92 class LX_CORE_EXPORT PropertyContainer : public Base::Persistence
93 {
97 
98 public:
99  friend class PostInitClass;
100  friend class CoreDocument;
101  friend class ObjectExecutor;
102  friend class Property;
103  friend class ::App::ElementTool;
104 
106  // //
107  // --------------------- BEGIN API --------------------- //
108  // //
109  // ATTENTION: DO NOT CHANGE ANY SIGNATURES IN THE API ! //
110  // //
112 
114  // Copy constructor
116  virtual ~PropertyContainer(void) = default;
117 
120  bool addProperty(Core::Property* p, const std::string& name);
122  Core::Property* addProperty(Base::Type t, const std::string& name, const Core::Variant& defaultValue);
124  Core::PropertyUser* addPropertyUser(const std::string& name, const Core::Variant& value);
126  void removeProperty(Core::Property* p, std::string pName);
130  inline Core::Property* getPropertyByName(const std::string& name) const;
132  inline Core::Property* getPropertyByName(const Base::String& name) const;
134  virtual const char* getPropertyName(const Property* prop) const;
135 
137  template <typename T>
138  T* getPropertyByName(const std::string& name) const
139  {
140  Core::Property* p = getPropertyByName(name);
141 
142  if (p && dynamic_cast<T*>(p))
143  {
144  return static_cast<T*>(p);
145  }
146 
147  return nullptr;
148  }
149 
153  std::vector<std::pair<Core::Property*, std::string> > getPropertiesAndNameByType(Base::Type type) const;
154  std::vector<Core::Property*> getPropertiesByType(Base::Type type) const;
155  void getLinkProperties( std::vector<Core::Property*>& properties1,
156  std::vector<Core::Property*>& properties2,
157  std::vector<Core::Property*>& properties3) const;
158  void getPropertiesByType(Base::Type type, std::vector<Core::Property*>& props) const;
159  std::vector<Core::Property*> getPropertiesByTypes(const std::vector<Base::Type>& type) const;
161  bool setPropertyFromVariant(const std::string& name, const Core::Variant& value);
162 
163  bool setProperty(const std::string& name, double value);
164  bool setProperty(const std::string& name, int value);
165  bool setProperty(const std::string& name, const Geom::Vec& value);
166  bool setProperty(const std::string& name, const std::list<Geom::Vec>& value);
167  bool setProperty(const std::string& name, const Geom::Trsf& value);
168  bool setProperty(const std::string& name, const std::string& value);
169  bool setProperty(const std::string& name, const char* value);
170  bool setProperty(const std::string& name, const Base::String& value);
171  bool setProperty(const std::string& name, const Geom::Pnt& value);
172  bool setProperty(const std::string& name, const Geom::Pnt2d& value);
173  bool setProperty(const std::string& name, const std::vector<Geom::Pnt>& value);
174  bool setProperty(const std::string& name, const std::vector<Geom::Pnt2d>& value);
175  // bool setProperty(const std::string& name, const std::list<std::string>& value);
176  // bool setProperty(const std::string& name, const Core::Placement& value);
177  bool setProperty(const std::string& name, const MD5& value);
178  bool setProperty(const std::string& name, bool value);
179  bool setProperty(const std::string& name, Core::DocObject* value);
180  // without this method, method setProperty(const std::string& name, bool value) is called for const Core::DocObject
181  bool setProperty(const std::string& name, const Core::DocObject* value);
182  bool setProperty(const std::string& name, const std::unordered_set<Core::DocObject*>& value);
183  bool setProperty(const std::string& name, const std::list<Core::DocObject*>& value);
184  bool setProperty(const std::string& name, const std::vector<int>& value);
185  bool setProperty(const std::string& name, const QFont& value);
186  bool setProperty(const std::string& name, const Draw::DrawStyle& value);
187  bool setProperty(const std::string& name, const Draw::Arrowheads& value);
188  bool setProperty(const std::string& name, const Geom::Dir& value);
189  bool setProperty(const std::string& name, const Geom::Dir2d& value);
190  bool setProperty(const std::string& name, const Base::Color& value);
191  bool setProperty(const std::string& name, const Geom::Ax1& value);
192  bool setProperty(const std::string& name, const Geom::Ax2& value);
193  // bool setProperty(const std::string& name, const gp_Ax22d& value);
194  bool setProperty(const std::string& name, const Draw::Texture2Transform& value);
195  bool setProperty(const std::string& name, const std::list<std::list<Geom::Pnt> >& value);
196  bool setProperty(const std::string& name, const std::vector<double>& value);
197  bool setProperty(const std::string& name, pBrepData& value);
198 
199 
200 
206  virtual bool onBeforeChange(Core::Property* p, const Core::Variant& newValue = Core::Variant());
208  virtual void onChanged(Core::Property* p);
210  virtual void onDeleted();
212  virtual void onNew();
214  virtual void onPropertyStatusBitsChanged(const Property& /*prop*/, unsigned long /*oldStatus*/) {}
221  bool enableNotify(const bool enable);
223  bool isNotifyEnabled(void) const;
225  void touch();
226 
229  bool isDeleted() const;
231  bool isStatusDeleted() const;
233  bool isMarkedForDelete() const;
237  bool isDeletedFinal() const;
239  bool isNew() const;
241  bool isUpdated() const;
243  bool isValid() const;
245  bool hasErrors() const;
247  void setData(const std::string& key, void* data);
249  void* getData(const std::string& key, bool* ok = nullptr) const;
251  void removeData(const std::string& key);
253  bool hasSameValuesAs(const PropertyContainer* container) const;
257  template <typename T>
258  T getPropertyValueByName(const std::string& propertyName, bool* ok = 0) const
259  {
260  Core::Property* p = getPropertyByName(propertyName);
261  if (p)
262  return p->getVariant().getValue<T>(ok);
263  else
264  return Core::Variant().getValue<T>(ok);
265  }
266 
269  virtual void ensureIntegrity();
279 
280 
282  virtual bool onChangedDebug( Core::Property* p );
283 
284  virtual void checkAfterOnDeleted();
285 
286 
287 protected:
288  virtual void onBeforeChangeProperty(const Property* /*prop*/) {}
289  virtual void onChangedProperty(const Property* /*prop*/) {}
290 
293 
295  // //
296  // ---------------------- END API ---------------------- //
297  // //
299 
300 
301 #ifndef LXAPI // INTERFACES BELOW ARE -NOT- PART OF THE LEXOCAD API
302 
303 public:
307  std::map<std::string, Core::Variant> getKeyValueMap() const;
309  bool setPropertyFromKeyValue(const std::string& propertyName, const std::string& key, const Core::Variant& value);
311  std::set<Core::Property*> getUpdatedProperties() const;
313  void setUpdated();
314  void setUpdated(const Core::Property* p);
316  void setHasErrors();
318  void setNew();
320  void setValid();
322  void setDeleted();
330  virtual void breakLinks();
331 
332  unsigned int getPropertyChangeStatus() const;
333  unsigned int getLastPropertyChangeStatus() const;
339  std::vector<Core::Property*> getPropertiesOrdered() const;
340 
341  virtual bool check_lx(const char* f, const char* n);
342 
345  // HPK: Do not use DynamicProperty. This is for
346  // testing transactions only.
347  virtual Core::Property* addDynamicProperty(const char* type,
348  const char* name = 0,
349  const char* group = 0,
350  const char* doc = 0,
351  short attr = 0,
352  bool ro = false,
353  bool hidden = false);
354 
355 #ifndef SWIG
357 #endif
358 
359  virtual bool removeDynamicProperty(const char* name);
360  virtual std::vector<std::string> getDynamicPropertyNames() const;
361  virtual Core::Property* getDynamicPropertyByName(const char* name) const;
363 
364 
365 
366  bool isRestored = false;
367 
368 #ifdef USE_PROPERTYMAP
369 
371  bool rollBack();
372 
375 
378 #endif
379 
380 
381 protected:
382  enum class Status
383  {
384  New = 1,
385  Updated = 2,
386  Valid = 3,
387  MarkedForDelete = 4,
388  MarkedForDeleteFinal,
389  Deleted,
390  DeletedFinal,
391  Error
392  };
393 
394  virtual void setStatus(Status status);
395  Status getStatus() const;
396 
398 
400  virtual void restoreProperty(Core::Property* property,
401  const Base::String& name,
402  Base::AbstractXMLReader& reader,
404 
405 
406  void addChangedProperties(unsigned int propertiesflags);
407 
408 private:
409 
410  unsigned int _changedProperties;
411  unsigned int _lastChangedProperties;
412 
414  void _setPropertyValues(const Core::PropertyValueMap& pmap, bool isInit = false);
416  void _setPropertyValues(const Core::PropertyContainer* other, bool isInit = false);
417  void getPropertyMapSetNotify(bool v);
418 
419  std::unordered_map<std::string, Core::Property*> _userPropertyMap;
420 #ifdef USE_PROPERTYMAP
421  std::unordered_map<std::string, PropertyValue> _lastValidPropertyMap;
422 #endif
423  std::unordered_map<std::string, void*> _data;
424  Status _status = Status::New;
425  bool _notify = true;
426 
430  bool _integrity = true;
431 #endif
432 };
433 
434 
435 
436 class LX_CORE_EXPORT PostInitClass
437 {
438 public:
442 };
443 
444 } // namespace Core
Core::PropertyContainer::getLastValidPropertyMap
const Core::PropertyValueMap & getLastValidPropertyMap() const
Returns the last valid PropertyValueMap.
Core::PropertyContainer::setAllPropertiesValid
void setAllPropertiesValid()
Sets the status of all properties to 'Valid'.
Core::PropertyContainer::setProperty
bool setProperty(const std::string &name, const QFont &value)
Base::Type
Definition: Type.h:51
Property.h
Core::PropertyContainer::setDeleteFinal
void setDeleteFinal()
Sets the status to 'DeleteFinal'.
Base::Color
Definition: Color.h:39
Core::PropertyContainer::onBeforeChange
virtual bool onBeforeChange(Core::Property *p, const Core::Variant &newValue=Core::Variant())
Core::PropertyContainer::checkAfterOnDeleted
virtual void checkAfterOnDeleted()
Core::PropertyContainer::getLinkProperties
void getLinkProperties(std::vector< Core::Property * > &properties1, std::vector< Core::Property * > &properties2, std::vector< Core::Property * > &properties3) const
Core::PropertyMap
std::unordered_map< std::string, Core::Property * > PropertyMap
Definition: PropertyValue.h:25
Draw
Definition: PropertyContainer.h:30
Core::PropertyContainer::setProperty
bool setProperty(const std::string &name, const Geom::Ax1 &value)
Core::CoreDocument
Definition: CoreDocument.h:269
Core::PropertyContainer::isValid
bool isValid() const
Returns true if the status is set to 'Valid'.
Core::PropertyContainer::getPropertyMap
void getPropertyMap(Core::PropertyMap &) const
Fills a PropertyMap.
Core::PropertyContainer::getPropertiesByType
std::vector< Core::Property * > getPropertiesByType(Base::Type type) const
Core::PropertyContainer::setStatus
virtual void setStatus(Status status)
Core::PropertyContainer::setProperty
bool setProperty(const std::string &name, pBrepData &value)
Core::PropertyContainer::isMarkedForDelete
bool isMarkedForDelete() const
Returns true if the status is set to 'MarkedForDelete'.
Core::PropertyUser
Core::PropertyUser is a class that can hold properties defined by the user. Its value member is a Cor...
Definition: PropertyUser.h:15
Core::PropertyContainer::breakLinks
virtual void breakLinks()
Sets all links of this container to null.
Core::PropertyContainer::hasSameValuesAs
bool hasSameValuesAs(const PropertyContainer *container) const
Returns 'true' if all values in 'container' match the corresponding property in this PropertyContaine...
Geom::Vec
Defines a non-persistent vector in 3D space.
Definition: Vec.h:41
Core::PropertyContainer::setProperty
bool setProperty(const std::string &name, const Base::Color &value)
Core::PropertyContainer::setProperty
bool setProperty(const std::string &name, int value)
Core::PropertyContainer::setProperty
bool setProperty(const std::string &name, const Geom::Pnt2d &value)
Base::Persistence
Persistence class and root of the type system.
Definition: Persistence.h:22
Core::PropertyContainer::addProperty
bool addProperty(Core::Property *p, const std::string &name)
Core::PropertyContainer::checkForAlreadyExistingProperty
bool checkForAlreadyExistingProperty(Core::Property *property)
Core::Prop_Hidden
@ Prop_Hidden
Definition: PropertyContainer.h:74
Core::PropertyContainer::addDynamicProperty
virtual Core::Property * addDynamicProperty(const char *type, const char *name=0, const char *group=0, const char *doc=0, short attr=0, bool ro=false, bool hidden=false)
Core::PropertyContainer::getUpdatedProperties
std::set< Core::Property * > getUpdatedProperties() const
Returns all properties that were updated since the last recompute.
Core::PropertyContainer::setPropertyFromKeyValue
bool setPropertyFromKeyValue(const std::string &propertyName, const std::string &key, const Core::Variant &value)
Sets the key in a property to value.
Core::PropertyContainer::addPropertiesFrom
void addPropertiesFrom(const Core::PropertyContainer *other)
Adds copy of all properties from other to this PropertyContainer.
Core::PropertyContainer::PropertyContainer
PropertyContainer(void)
Core::PropertyContainer::getPropertyValueByName
T getPropertyValueByName(const std::string &propertyName, bool *ok=0) const
Returns the property value T with this name. If ok=true T holds a valid value.
Definition: PropertyContainer.h:258
Core::PropertyContainer::setHasErrors
void setHasErrors()
Sets the status to 'Error'.
Core::Prop_ReadOnly
@ Prop_ReadOnly
Definition: PropertyContainer.h:72
Core::PropertyContainer::isNotifyEnabled
bool isNotifyEnabled(void) const
Returns whether notification of changes to the field values in the container is propagated to its aud...
Core::PropertyContainer::setProperty
bool setProperty(const std::string &name, const std::vector< Geom::Pnt2d > &value)
Core::PropertyContainer::setProperty
bool setProperty(const std::string &name, bool value)
pBrepData
std::shared_ptr< Geom::BrepData > pBrepData
Definition: PropertyBrepData.h:5
Core::PropertyContainer::isDeletedFinal
bool isDeletedFinal() const
Returns true if the status is set to 'DeletedFinal'.
Core::FieldData
Definition: PropertyContainer.h:19
Geom::Ax1
Definition: Ax1.h:50
Core::PropertyContainer::setMarkedForDelete
void setMarkedForDelete()
Sets the status to 'MarkedForDelete'.
Core::PropertyContainer::getPropertyName
virtual const char * getPropertyName(const Property *prop) const
get the name of a property
Core::PropertyContainer::setProperty
bool setProperty(const std::string &name, const Geom::Ax2 &value)
entt::group
basic_group< entity, Types... > group
Alias declaration for the most common use case.
Definition: entt.hpp:3822
Core::PropertyContainer::restoreProperty
virtual void restoreProperty(Core::Property *property, const Base::String &name, Base::AbstractXMLReader &reader, Base::PersistenceVersion &version)
Restores property from from reader in specified version.
Core::PropertyContainer::setUpdated
void setUpdated()
Sets the status to 'Updated' if the old status was 'Valid'.
Core::PropertyContainer::setProperty
bool setProperty(const std::string &name, const std::list< Geom::Vec > &value)
Core::PropertyContainer::hasErrors
bool hasErrors() const
Returns true if the status is set to 'Error'.
Core::PropertyContainer::getPropertiesByType
void getPropertiesByType(Base::Type type, std::vector< Core::Property * > &props) const
Core::PropertyContainer::setProperty
bool setProperty(const std::string &name, const char *value)
Geom::Dir
Definition: Dir.h:45
Core::PropertyContainer::Status
Status
Definition: PropertyContainer.h:383
Core::PropertyContainer
Definition: PropertyContainer.h:93
Core::PropertyContainer::isDeleted
bool isDeleted() const
Core::New
@ New
Definition: DocObject.h:18
Core::PropertyContainer::setProperty
bool setProperty(const std::string &name, const MD5 &value)
Core::DocObject
Definition: DocObject.h:54
Core::PropertyContainer::~PropertyContainer
virtual ~PropertyContainer(void)=default
Core::PropertyContainer::setProperty
bool setProperty(const std::string &name, const std::vector< int > &value)
Core::LxFieldData::m_fieldmap
std::unordered_map< std::string, ptrdiff_t > m_fieldmap
Definition: PropertyContainer.h:86
Core::Prop_None
@ Prop_None
Definition: PropertyContainer.h:71
Core::PropertyContainer::rollBack
bool rollBack()
Brings back the PropertyContainer to its last valid status.
Core::PropertyContainer::setProperty
bool setProperty(const std::string &name, const Draw::Texture2Transform &value)
Geom::Dir2d
Definition: Dir2d.h:42
Base::PersistenceVersion
Definition: Persistence.h:13
Core::PropertyContainer::setProperty
bool setProperty(const std::string &name, const Base::String &value)
Core::DynamicProperty::PropData
Definition: DynamicProperty.h:131
Core::PropertyContainer::setValid
void setValid()
Sets the status to 'Valid'.
Core
Definition: Base.h:5
Core::PropertyContainer::isStatusDeleted
bool isStatusDeleted() const
Returns true if the status is set to 'Deleted'.
Core::Variant
Definition: Variant.h:78
Core::PropertyContainer::getPropertyValueMap
Core::PropertyValueMap getPropertyValueMap() const
Returns a map with the name of the property and its PropertyValue as a struct of the property type an...
Core::PropertyContainer::getPropertiesAndNameByType
std::vector< std::pair< Core::Property *, std::string > > getPropertiesAndNameByType(Base::Type type) const
Returns all properties of type 'type'.
Geom::Pnt
Defines a non-persistent 3D Cartesian point.
Definition: Pnt.h:44
Core::PropertyContainer::isMarkedForDeleteFinal
bool isMarkedForDeleteFinal() const
Returns true if the status is set to 'MarkedForDeleteFinal'.
Geom::Ax2
Definition: Ax2.h:66
Core::PostInitClass
Definition: PropertyContainer.h:437
MD5
Definition: md5.h:70
Core::PropertyContainer::integrityLost
void integrityLost()
Sets _integrity to false.
LX_NODE_HEADER
#define LX_NODE_HEADER()
Definition: PropertyMacros.h:7
Core::PropertyContainer::getPropertiesOrdered
std::vector< Core::Property * > getPropertiesOrdered() const
Returns the properties in the init order.
Core::PropertyContainer::setData
void setData(const std::string &key, void *data)
Adds arbitrary data for this key to the PropertyContainer (Used in SDK)
Core::PropertyContainer::setProperty
bool setProperty(const std::string &name, const Draw::DrawStyle &value)
Base::AbstractWriter
Definition: Writer.h:13
Core::PostInitClass::~PostInitClass
~PostInitClass()
Core::PropertyContainer::addPropertyUser
Core::PropertyUser * addPropertyUser(const std::string &name, const Core::Variant &value)
Convenience method for Python bindings.
MUTABLE_CONTAINER
#define MUTABLE_CONTAINER(_class_)
Definition: PropertyContainer.h:37
Core::FieldData::FieldData
FieldData(const Core::FieldData *)
Definition: PropertyContainer.h:21
Core::PropertyContainer::PropertyContainer
PropertyContainer(const PropertyContainer &rhs)
Core::PropertyContainer::saveLastValidPropertyMap
void saveLastValidPropertyMap()
Saves the last valid property map, p.e. before a recompute to enable a rollback.
Core::Variant::getValue
T getValue(bool *ok) const
Definition: Variant.h:329
Core::PropertyContainer::removeAllProperties
void removeAllProperties()
Removes all properties from the PropertyContainer and deletes them.
Core::PropertyContainer::isUpdated
bool isUpdated() const
Returns true if the status is set to 'Updated'.
Core::LxFieldData::LxFieldData
LxFieldData(const LxFieldData *fd)
Base::AbstractXMLReader
Definition: AbstractXMLReader.h:7
Core::Prop_NoRecompute
@ Prop_NoRecompute
Definition: PropertyContainer.h:76
Core::PropertyContainer::getPropertyByName
T * getPropertyByName(const std::string &name) const
Returns the property of type T with name 'name'. Returns 'nullptr' on failure.
Definition: PropertyContainer.h:138
Core::PropertyContainer::getPropertyByName
Core::Property * getPropertyByName(const std::string &name) const
Returns the property with name 'name'. Returns '0' on failure.
Core::Property::getVariant
virtual Core::Variant getVariant(void) const =0
Core::PropertyContainer::restore
virtual void restore(Base::AbstractXMLReader &reader, Base::PersistenceVersion &version)
Restores the PropertyContainer from reader in specified version.
PropertyName
constexpr const char * PropertyName
Definition: PropertyContainer.h:11
Core::PropertyContainer::setPropertyValues
void setPropertyValues(const PropertyContainer *other)
Copies the property values from 'other' PropertyContainer to this PropertyContainer.
Core::PropertyContainer::getKeyValueMap
std::map< std::string, Core::Variant > getKeyValueMap() const
Returns all keys and sub keys with their values of this container.
Core::PropertyContainer::setDeleted
void setDeleted()
Sets the status to 'Delete'.
Core::PostInitClass::PostInitClass
PostInitClass(Core::PropertyContainer *p)
Definition: PropertyContainer.h:439
Core::PropertyContainer::getPropertiesByTypes
std::vector< Core::Property * > getPropertiesByTypes(const std::vector< Base::Type > &type) const
Core::PropertyContainer::setProperty
bool setProperty(const std::string &name, const std::string &value)
Core::PropertyContainer::onDeleted
virtual void onDeleted()
Is called when a PropertyContainer's status is set to MarkedForDelete.
Core::PropertyContainer::getDynamicPropertyNames
virtual std::vector< std::string > getDynamicPropertyNames() const
Core::PropertyContainer::touch
void touch()
Sets all properties of this PropertyContainer to updated.
Core::Error
@ Error
Definition: DocObject.h:17
Core::LxFieldData
Definition: PropertyContainer.h:81
Core::PropertyContainer::checkIntegrity
bool checkIntegrity()
Returns the value of _integrity.
Core::PropertyContainer::setProperty
bool setProperty(const std::string &name, double value)
Core::PropertyContainer::setProperty
bool setProperty(const std::string &name, const std::vector< double > &value)
Core::PropertyContainer::onPropertyStatusBitsChanged
virtual void onPropertyStatusBitsChanged(const Property &, unsigned long)
Is called when the Property StatusBits are changed.
Definition: PropertyContainer.h:214
Core::PropertyContainer::setPropertyFromVariant
bool setPropertyFromVariant(const std::string &name, const Core::Variant &value)
Sets a property to value.
Core::Prop_NoPersist
@ Prop_NoPersist
Definition: PropertyContainer.h:77
Core::PropertyContainer::removeData
void removeData(const std::string &key)
Removes the data from the PropertyContainer (Used in SDK)
Core::PropertyContainer::isNew
bool isNew() const
Returns true if the status is set to 'New'.
DynamicProperty.h
Core::PropertyContainer::enableNotify
bool enableNotify(const bool enable)
Core::PropertyContainer::onChangedDebug
virtual bool onChangedDebug(Core::Property *p)
Is called after a property in a PropertyContainers has been changed, it ignores notify-flag.
Core::PropertyContainer::getDynamicPropertyByName
virtual Core::Property * getDynamicPropertyByName(const char *name) const
Core::PropertyContainer::getData
void * getData(const std::string &key, bool *ok=nullptr) const
Returns data for this key from the PropertyContainer (Used in SDK)
Core::PropertyContainer::onNew
virtual void onNew()
Is called when a PropertyContainer's status is set to New.
Core::version
LX_CORE_EXPORT Version & version
Core::PropertyContainer::addProperty
Core::Property * addProperty(Base::Type t, const std::string &name, const Core::Variant &defaultValue)
Adds a property to the PropertyContainer. Returns the added property on success, '0' on failure.
Core::PropertyContainer::getLastPropertyChangeStatus
unsigned int getLastPropertyChangeStatus() const
Core::PropertyContainer::setProperty
bool setProperty(const std::string &name, const std::unordered_set< Core::DocObject * > &value)
Core::Prop_Output
@ Prop_Output
Definition: PropertyContainer.h:75
Core::PropertyContainer::removeProperty
void removeProperty(Core::Property *p, std::string pName)
Removes a property from the PropertyContainer and deletes it.
PropertyMacros.h
Core::PropertyContainer::getPropertyChangeStatus
unsigned int getPropertyChangeStatus() const
Core::PropertyContainer::removeDynamicProperty
virtual bool removeDynamicProperty(const char *name)
Core::Property
Definition: Property.h:72
Core::PropertyContainer::getDynamicPropertyData
DynamicProperty::PropData getDynamicPropertyData(const Property *prop) const
Core::PropertyContainer::setProperty
bool setProperty(const std::string &name, const Core::DocObject *value)
Core::PropertyContainer::setPropertyValues
void setPropertyValues(const Core::PropertyValueMap &other)
Copies the property values from a Core::PropertyValueMap to this PropertyContainer.
Core::PropertyContainer::setProperty
bool setProperty(const std::string &name, Core::DocObject *value)
Core::PropertyContainer::setProperty
bool setProperty(const std::string &name, const Geom::Dir2d &value)
Core::PropertyContainer::onChangedProperty
virtual void onChangedProperty(const Property *)
Definition: PropertyContainer.h:289
Geom::Trsf
Definition: Trsf.h:58
Base::String
A Utf-16 (windows) or ucs4 (unix) encoded string class.
Definition: String.h:18
Core::PropertyContainer::setProperty
bool setProperty(const std::string &name, const std::list< std::list< Geom::Pnt > > &value)
Core::PropertyContainer::integrityMaintained
void integrityMaintained()
Core::PostInitClass::container
Core::PropertyContainer * container
Definition: PropertyContainer.h:441
Geom::Pnt2d
Defines a non-persistent 2D cartesian point.
Definition: Pnt2d.h:34
Core::PropertyContainer::save
virtual void save(Base::AbstractWriter &writer, Base::PersistenceVersion &version)
Saves the PropertyContainer to writer.
Core::PropertyContainer::setProperty
bool setProperty(const std::string &name, const std::list< Core::DocObject * > &value)
Core::PropertyContainer::setUpdated
void setUpdated(const Core::Property *p)
Core::PropertyType
PropertyType
Definition: PropertyContainer.h:70
Core::PropertyContainer::getPropertyByName
Core::Property * getPropertyByName(const Base::String &name) const
Returns the property with name 'name'. Returns '0' on failure.
TYPESYSTEM_HEADER
#define TYPESYSTEM_HEADER()
define for subclassing Base::BaseClass
Definition: Base.h:12
Core::LxFieldData::addField
void addField(void *base, const char *fieldname, void *fieldptr)
Core::PropertyContainer::setProperty
bool setProperty(const std::string &name, const Geom::Dir &value)
Core::PropertyContainer::getStatus
Status getStatus() const
Core::PropertyContainer::addChangedProperties
void addChangedProperties(unsigned int propertiesflags)
Core::PropertyContainer::onBeforeChangeProperty
virtual void onBeforeChangeProperty(const Property *)
Definition: PropertyContainer.h:288
Core::PropertyContainer::setProperty
bool setProperty(const std::string &name, const std::vector< Geom::Pnt > &value)
Core::Prop_Transient
@ Prop_Transient
Definition: PropertyContainer.h:73
Core::PropertyContainer::check_lx
virtual bool check_lx(const char *f, const char *n)
Core::PropertyContainer::setProperty
bool setProperty(const std::string &name, const Geom::Pnt &value)
Core::PropertyContainer::setNew
void setNew()
Sets the status to 'New'.
Core::PropertyContainer::ensureIntegrity
virtual void ensureIntegrity()
Core::PropertyContainer::setProperty
bool setProperty(const std::string &name, const Geom::Vec &value)
Core::LxFieldData::LxFieldData
LxFieldData(void)
Core::PropertyContainer::onChanged
virtual void onChanged(Core::Property *p)
Is called after a property in a PropertyContainer has been changed.
Base
Definition: AbstractXMLReader.h:5
Core::PropertyContainer::setProperty
bool setProperty(const std::string &name, const Draw::Arrowheads &value)
Geom
Definition: PropertyContainer.h:33
Core::PropertyContainer::setProperty
bool setProperty(const std::string &name, const Geom::Trsf &value)
Core::PropertyContainer::setMarkedForDeleteFinal
void setMarkedForDeleteFinal()
Sets the status to 'MarkedForDeleteFinal'.
Core::PropertyValueMap
std::unordered_map< std::string, Core::PropertyValue > PropertyValueMap
Definition: PropertyValue.h:26