Go to the documentation of this file.
6 namespace Base {
class AbstractWriter; }
7 namespace Base {
class AbstractXMLReader; }
9 #define USE_PROPERTYMAP
37 #define MUTABLE_CONTAINER(_class_) \
39 static bool isMutableStatic() { return true; } \
42 virtual bool isMutable() const { return true; }
44 #define IMMUTABLE_CONTAINER(_class_) \
46 friend class Core::PropertyBundle<_class_>; \
49 static bool isMutableStatic() { return false; } \
52 virtual bool isMutable() const { return false; } \
55 Core::PropertyBundle<_class_> getPropertyBundle() const \
57 Core::PropertyBundle<_class_> dsBundle; \
58 dsBundle.setPropertyValues(this); \
85 void addField(
void* base,
const char* fieldname,
void* fieldptr);
87 bool fieldsAdded =
false;
101 friend class ObjectExecutor;
103 friend class ::App::ElementTool;
137 template <
typename T>
142 if (p &&
dynamic_cast<T*
>(p))
144 return static_cast<T*
>(p);
156 std::vector<Core::Property*>& properties2,
157 std::vector<Core::Property*>& properties3)
const;
166 bool setProperty(
const std::string& name,
const std::list<Geom::Vec>& value);
168 bool setProperty(
const std::string& name,
const std::string& 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);
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);
186 bool setProperty(
const std::string& name,
const Draw::DrawStyle& value);
187 bool setProperty(
const std::string& name,
const Draw::Arrowheads& 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);
247 void setData(
const std::string& key,
void* data);
249 void*
getData(
const std::string& key,
bool* ok =
nullptr)
const;
257 template <
typename T>
301 #ifndef LXAPI // INTERFACES BELOW ARE -NOT- PART OF THE LEXOCAD API
341 virtual bool check_lx(
const char* f,
const char* n);
348 const char* name = 0,
349 const char*
group = 0,
353 bool hidden =
false);
366 bool isRestored =
false;
368 #ifdef USE_PROPERTYMAP
388 MarkedForDeleteFinal,
410 unsigned int _changedProperties;
411 unsigned int _lastChangedProperties;
417 void getPropertyMapSetNotify(
bool v);
419 std::unordered_map<std::string, Core::Property*> _userPropertyMap;
420 #ifdef USE_PROPERTYMAP
421 std::unordered_map<std::string, PropertyValue> _lastValidPropertyMap;
423 std::unordered_map<std::string, void*> _data;
430 bool _integrity =
true;
const Core::PropertyValueMap & getLastValidPropertyMap() const
Returns the last valid PropertyValueMap.
void setAllPropertiesValid()
Sets the status of all properties to 'Valid'.
bool setProperty(const std::string &name, const QFont &value)
void setDeleteFinal()
Sets the status to 'DeleteFinal'.
virtual bool onBeforeChange(Core::Property *p, const Core::Variant &newValue=Core::Variant())
virtual void checkAfterOnDeleted()
void getLinkProperties(std::vector< Core::Property * > &properties1, std::vector< Core::Property * > &properties2, std::vector< Core::Property * > &properties3) const
std::unordered_map< std::string, Core::Property * > PropertyMap
Definition: PropertyValue.h:25
Definition: PropertyContainer.h:30
bool setProperty(const std::string &name, const Geom::Ax1 &value)
Definition: CoreDocument.h:269
bool isValid() const
Returns true if the status is set to 'Valid'.
void getPropertyMap(Core::PropertyMap &) const
Fills a PropertyMap.
std::vector< Core::Property * > getPropertiesByType(Base::Type type) const
virtual void setStatus(Status status)
bool setProperty(const std::string &name, pBrepData &value)
bool isMarkedForDelete() const
Returns true if the status is set to 'MarkedForDelete'.
Core::PropertyUser is a class that can hold properties defined by the user. Its value member is a Cor...
Definition: PropertyUser.h:15
virtual void breakLinks()
Sets all links of this container to null.
bool hasSameValuesAs(const PropertyContainer *container) const
Returns 'true' if all values in 'container' match the corresponding property in this PropertyContaine...
Defines a non-persistent vector in 3D space.
Definition: Vec.h:41
bool setProperty(const std::string &name, const Base::Color &value)
bool setProperty(const std::string &name, int value)
bool setProperty(const std::string &name, const Geom::Pnt2d &value)
Persistence class and root of the type system.
Definition: Persistence.h:22
bool addProperty(Core::Property *p, const std::string &name)
bool checkForAlreadyExistingProperty(Core::Property *property)
@ Prop_Hidden
Definition: PropertyContainer.h:74
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)
std::set< Core::Property * > getUpdatedProperties() const
Returns all properties that were updated since the last recompute.
bool setPropertyFromKeyValue(const std::string &propertyName, const std::string &key, const Core::Variant &value)
Sets the key in a property to value.
void addPropertiesFrom(const Core::PropertyContainer *other)
Adds copy of all properties from other to this PropertyContainer.
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
void setHasErrors()
Sets the status to 'Error'.
@ Prop_ReadOnly
Definition: PropertyContainer.h:72
bool isNotifyEnabled(void) const
Returns whether notification of changes to the field values in the container is propagated to its aud...
bool setProperty(const std::string &name, const std::vector< Geom::Pnt2d > &value)
bool setProperty(const std::string &name, bool value)
std::shared_ptr< Geom::BrepData > pBrepData
Definition: PropertyBrepData.h:5
bool isDeletedFinal() const
Returns true if the status is set to 'DeletedFinal'.
Definition: PropertyContainer.h:19
void setMarkedForDelete()
Sets the status to 'MarkedForDelete'.
virtual const char * getPropertyName(const Property *prop) const
get the name of a property
bool setProperty(const std::string &name, const Geom::Ax2 &value)
basic_group< entity, Types... > group
Alias declaration for the most common use case.
Definition: entt.hpp:3822
virtual void restoreProperty(Core::Property *property, const Base::String &name, Base::AbstractXMLReader &reader, Base::PersistenceVersion &version)
Restores property from from reader in specified version.
void setUpdated()
Sets the status to 'Updated' if the old status was 'Valid'.
bool setProperty(const std::string &name, const std::list< Geom::Vec > &value)
bool hasErrors() const
Returns true if the status is set to 'Error'.
void getPropertiesByType(Base::Type type, std::vector< Core::Property * > &props) const
bool setProperty(const std::string &name, const char *value)
Status
Definition: PropertyContainer.h:383
Definition: PropertyContainer.h:93
@ New
Definition: DocObject.h:18
bool setProperty(const std::string &name, const MD5 &value)
Definition: DocObject.h:54
virtual ~PropertyContainer(void)=default
bool setProperty(const std::string &name, const std::vector< int > &value)
std::unordered_map< std::string, ptrdiff_t > m_fieldmap
Definition: PropertyContainer.h:86
@ Prop_None
Definition: PropertyContainer.h:71
bool rollBack()
Brings back the PropertyContainer to its last valid status.
bool setProperty(const std::string &name, const Draw::Texture2Transform &value)
Definition: Persistence.h:13
bool setProperty(const std::string &name, const Base::String &value)
Definition: DynamicProperty.h:131
void setValid()
Sets the status to 'Valid'.
bool isStatusDeleted() const
Returns true if the status is set to 'Deleted'.
Core::PropertyValueMap getPropertyValueMap() const
Returns a map with the name of the property and its PropertyValue as a struct of the property type an...
std::vector< std::pair< Core::Property *, std::string > > getPropertiesAndNameByType(Base::Type type) const
Returns all properties of type 'type'.
Defines a non-persistent 3D Cartesian point.
Definition: Pnt.h:44
bool isMarkedForDeleteFinal() const
Returns true if the status is set to 'MarkedForDeleteFinal'.
Definition: PropertyContainer.h:437
void integrityLost()
Sets _integrity to false.
#define LX_NODE_HEADER()
Definition: PropertyMacros.h:7
std::vector< Core::Property * > getPropertiesOrdered() const
Returns the properties in the init order.
void setData(const std::string &key, void *data)
Adds arbitrary data for this key to the PropertyContainer (Used in SDK)
bool setProperty(const std::string &name, const Draw::DrawStyle &value)
Core::PropertyUser * addPropertyUser(const std::string &name, const Core::Variant &value)
Convenience method for Python bindings.
#define MUTABLE_CONTAINER(_class_)
Definition: PropertyContainer.h:37
FieldData(const Core::FieldData *)
Definition: PropertyContainer.h:21
PropertyContainer(const PropertyContainer &rhs)
void saveLastValidPropertyMap()
Saves the last valid property map, p.e. before a recompute to enable a rollback.
T getValue(bool *ok) const
Definition: Variant.h:329
void removeAllProperties()
Removes all properties from the PropertyContainer and deletes them.
bool isUpdated() const
Returns true if the status is set to 'Updated'.
LxFieldData(const LxFieldData *fd)
Definition: AbstractXMLReader.h:7
@ Prop_NoRecompute
Definition: PropertyContainer.h:76
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::Property * getPropertyByName(const std::string &name) const
Returns the property with name 'name'. Returns '0' on failure.
virtual Core::Variant getVariant(void) const =0
virtual void restore(Base::AbstractXMLReader &reader, Base::PersistenceVersion &version)
Restores the PropertyContainer from reader in specified version.
constexpr const char * PropertyName
Definition: PropertyContainer.h:11
void setPropertyValues(const PropertyContainer *other)
Copies the property values from 'other' PropertyContainer to this PropertyContainer.
std::map< std::string, Core::Variant > getKeyValueMap() const
Returns all keys and sub keys with their values of this container.
void setDeleted()
Sets the status to 'Delete'.
PostInitClass(Core::PropertyContainer *p)
Definition: PropertyContainer.h:439
std::vector< Core::Property * > getPropertiesByTypes(const std::vector< Base::Type > &type) const
bool setProperty(const std::string &name, const std::string &value)
virtual void onDeleted()
Is called when a PropertyContainer's status is set to MarkedForDelete.
virtual std::vector< std::string > getDynamicPropertyNames() const
void touch()
Sets all properties of this PropertyContainer to updated.
@ Error
Definition: DocObject.h:17
Definition: PropertyContainer.h:81
bool checkIntegrity()
Returns the value of _integrity.
bool setProperty(const std::string &name, double value)
bool setProperty(const std::string &name, const std::vector< double > &value)
virtual void onPropertyStatusBitsChanged(const Property &, unsigned long)
Is called when the Property StatusBits are changed.
Definition: PropertyContainer.h:214
bool setPropertyFromVariant(const std::string &name, const Core::Variant &value)
Sets a property to value.
@ Prop_NoPersist
Definition: PropertyContainer.h:77
void removeData(const std::string &key)
Removes the data from the PropertyContainer (Used in SDK)
bool isNew() const
Returns true if the status is set to 'New'.
bool enableNotify(const bool enable)
virtual bool onChangedDebug(Core::Property *p)
Is called after a property in a PropertyContainers has been changed, it ignores notify-flag.
virtual Core::Property * getDynamicPropertyByName(const char *name) const
void * getData(const std::string &key, bool *ok=nullptr) const
Returns data for this key from the PropertyContainer (Used in SDK)
virtual void onNew()
Is called when a PropertyContainer's status is set to New.
LX_CORE_EXPORT Version & version
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.
unsigned int getLastPropertyChangeStatus() const
bool setProperty(const std::string &name, const std::unordered_set< Core::DocObject * > &value)
@ Prop_Output
Definition: PropertyContainer.h:75
void removeProperty(Core::Property *p, std::string pName)
Removes a property from the PropertyContainer and deletes it.
unsigned int getPropertyChangeStatus() const
virtual bool removeDynamicProperty(const char *name)
Definition: Property.h:72
DynamicProperty::PropData getDynamicPropertyData(const Property *prop) const
bool setProperty(const std::string &name, const Core::DocObject *value)
void setPropertyValues(const Core::PropertyValueMap &other)
Copies the property values from a Core::PropertyValueMap to this PropertyContainer.
bool setProperty(const std::string &name, Core::DocObject *value)
bool setProperty(const std::string &name, const Geom::Dir2d &value)
virtual void onChangedProperty(const Property *)
Definition: PropertyContainer.h:289
A Utf-16 (windows) or ucs4 (unix) encoded string class.
Definition: String.h:18
bool setProperty(const std::string &name, const std::list< std::list< Geom::Pnt > > &value)
void integrityMaintained()
Core::PropertyContainer * container
Definition: PropertyContainer.h:441
Defines a non-persistent 2D cartesian point.
Definition: Pnt2d.h:34
virtual void save(Base::AbstractWriter &writer, Base::PersistenceVersion &version)
Saves the PropertyContainer to writer.
bool setProperty(const std::string &name, const std::list< Core::DocObject * > &value)
void setUpdated(const Core::Property *p)
PropertyType
Definition: PropertyContainer.h:70
Core::Property * getPropertyByName(const Base::String &name) const
Returns the property with name 'name'. Returns '0' on failure.
#define TYPESYSTEM_HEADER()
define for subclassing Base::BaseClass
Definition: Base.h:12
void addField(void *base, const char *fieldname, void *fieldptr)
bool setProperty(const std::string &name, const Geom::Dir &value)
void addChangedProperties(unsigned int propertiesflags)
virtual void onBeforeChangeProperty(const Property *)
Definition: PropertyContainer.h:288
bool setProperty(const std::string &name, const std::vector< Geom::Pnt > &value)
@ Prop_Transient
Definition: PropertyContainer.h:73
virtual bool check_lx(const char *f, const char *n)
bool setProperty(const std::string &name, const Geom::Pnt &value)
void setNew()
Sets the status to 'New'.
virtual void ensureIntegrity()
bool setProperty(const std::string &name, const Geom::Vec &value)
virtual void onChanged(Core::Property *p)
Is called after a property in a PropertyContainer has been changed.
Definition: AbstractXMLReader.h:5
bool setProperty(const std::string &name, const Draw::Arrowheads &value)
Definition: PropertyContainer.h:33
bool setProperty(const std::string &name, const Geom::Trsf &value)
void setMarkedForDeleteFinal()
Sets the status to 'MarkedForDeleteFinal'.
std::unordered_map< std::string, Core::PropertyValue > PropertyValueMap
Definition: PropertyValue.h:26