13 #include <unordered_map> 14 #include <unordered_set> 16 #define USE_PROPERTYMAP 18 static const char* PropertyName =
"Property";
48 #define MUTABLE_CONTAINER(_class_) \ 50 static bool isMutableStatic() { return true; } \ 53 virtual bool isMutable() const { return true; } 55 #define IMMUTABLE_CONTAINER(_class_) \ 57 friend class Core::PropertyBundle<_class_>; \ 60 static bool isMutableStatic() { return false; } \ 63 virtual bool isMutable() const { return false; } \ 66 Core::PropertyBundle<_class_> getPropertyBundle() const \ 68 Core::PropertyBundle<_class_> dsBundle; \ 69 dsBundle.setPropertyValues(this); \ 100 void addField(
void* base,
char* fieldname,
void* fieldptr);
102 bool fieldsAdded =
false;
116 friend class ObjectExecutor;
118 friend class ::App::ElementTool;
143 void removeAllProperties();
149 virtual const char* getPropertyName(
const Property* prop)
const;
152 template <
typename T>
159 return static_cast<T*>(p);
169 std::vector<std::pair<Core::Property*, std::string> > getPropertiesAndNameByType(
Base::Type type)
const;
170 std::vector<Core::Property*> getPropertiesByType(
Base::Type type)
const;
171 std::vector<Core::Property*> getPropertiesByTypes(
const std::vector<Base::Type>& type)
const;
173 bool setPropertyFromVariant(
const std::string&
name,
const Core::Variant& value);
175 bool setProperty(
const std::string&
name,
double value);
176 bool setProperty(
const std::string&
name,
int value);
177 bool setProperty(
const std::string&
name,
const Geom::Vec& value);
179 bool setProperty(
const std::string&
name,
const Geom::Trsf& value);
180 bool setProperty(
const std::string&
name,
const std::string& value);
181 bool setProperty(
const std::string&
name,
const char* value);
183 bool setProperty(
const std::string&
name,
const Geom::Pnt& value);
185 bool setProperty(
const std::string&
name,
const std::vector<Geom::Pnt>& value);
186 bool setProperty(
const std::string&
name,
const std::vector<Geom::Pnt2d>& value);
189 bool setProperty(
const std::string&
name,
const MD5& value);
190 bool setProperty(
const std::string&
name,
bool value);
194 bool setProperty(
const std::string&
name,
const std::unordered_set<Core::DocObject*>& value);
196 bool setProperty(
const std::string&
name,
const std::vector<int>& value);
197 bool setProperty(
const std::string&
name,
const QFont& value);
198 bool setProperty(
const std::string&
name,
const Draw::DrawStyle& value);
199 bool setProperty(
const std::string&
name,
const Draw::Arrowheads& value);
200 bool setProperty(
const std::string&
name,
const Geom::Dir& value);
203 bool setProperty(
const std::string&
name,
const Geom::Ax1& value);
204 bool setProperty(
const std::string&
name,
const Geom::Ax2& value);
206 bool setProperty(
const std::string&
name,
const Draw::Texture2Transform& value);
208 bool setProperty(
const std::string&
name,
const std::vector<double>& value);
222 virtual void onDeleted();
224 virtual void onNew();
233 bool enableNotify(
const bool enable);
235 bool isNotifyEnabled(
void)
const;
241 bool isDeleted()
const;
243 bool isStatusDeleted()
const;
245 bool isMarkedForDelete()
const;
247 bool isMarkedForDeleteFinal()
const;
249 bool isDeletedFinal()
const;
253 bool isUpdated()
const;
255 bool isValid()
const;
257 bool hasErrors()
const;
259 void setData(
const std::string& key,
void* data);
261 void* getData(
const std::string& key,
bool* ok =
nullptr)
const;
263 void removeData(
const std::string& key);
269 template <
typename T>
281 virtual void ensureIntegrity();
286 void integrityMaintained();
288 void integrityLost();
290 bool checkIntegrity();
296 virtual void checkAfterOnDeleted();
313 #ifndef LXAPI // INTERFACES BELOW ARE -NOT- PART OF THE LEXOCAD API 319 std::map<std::string, Core::Variant> getKeyValueMap()
const;
321 bool setPropertyFromKeyValue(
const std::string& propertyName,
const std::string& key,
const Core::Variant& value);
323 std::set<Core::Property*> getUpdatedProperties()
const;
336 void setMarkedForDelete();
338 void setMarkedForDeleteFinal();
340 void setDeleteFinal();
344 unsigned int getPropertyChangeStatus()
const;
346 void setAllPropertiesValid();
350 std::vector<Core::Property*> getPropertiesOrdered()
const;
352 virtual bool check_lx(
char* f,
char* n);
359 const char*
name = 0,
360 const char*
group = 0,
364 bool hidden =
false);
370 virtual bool removeDynamicProperty(
const char*
name);
371 virtual std::vector<std::string> getDynamicPropertyNames()
const;
377 bool isRestored =
false;
379 #ifdef USE_PROPERTYMAP 385 void saveLastValidPropertyMap();
399 MarkedForDeleteFinal,
405 virtual void setStatus(
Status status);
424 void getPropertyMapSetNotify(
bool v);
426 std::unordered_map<std::string, Core::Property*> _userPropertyMap;
427 #ifdef USE_PROPERTYMAP 428 std::unordered_map<std::string, PropertyValue> _lastValidPropertyMap;
430 std::unordered_map<std::string, void*> _data;
437 bool _integrity =
true;
void breakLinks(Core::DocObject *from)
unsigned int _changedProperties
Definition: PropertyContainer.h:416
T * getPropertyByName(const std::string &name) const
Returns the property of type T with name 'name'. Returns 'nullptr' on failure.
Definition: PropertyContainer.h:153
Definition: PropertyContainer.h:90
Definition: Persistence.h:14
Defines a non-persistent 3D Cartesian point.
Definition: Pnt.h:43
Definition: PropertyContainer.h:95
Definition: PropertyContainer.h:107
Core::PropertyText name
Definition: CoreDocument.h:167
Definition: PropertyContainer.h:92
PropertyType
Definition: PropertyContainer.h:84
std::shared_ptr< Geom::BrepData > pBrepData
Definition: BrepData.h:28
A Utf-16 (windows) or ucs4 (unix) encoded string class.
Definition: String.h:23
Persistence class and root of the type system.
Definition: Persistence.h:23
void restoreProperty(Core::Property *property, const Base::String &name, Base::AbstractXMLReader &reader, Base::PersistenceVersion &version) override
LX_CORE_EXPORT Version & version
Definition: CoreDocument.h:210
Definition: DocObject.h:26
virtual void onBeforeChangeProperty(const Property *prop)
Definition: PropertyContainer.h:300
Definition: DynamicProperty.h:139
T getValue(bool *ok) const
Definition: Variant.h:325
std::unordered_map< std::string, Core::Property * > PropertyMap
Definition: PropertyValue.h:26
Definition: AbstractXMLReader.h:7
std::unordered_map< std::string, ptrdiff_t > m_fieldmap
Definition: PropertyContainer.h:101
std::unordered_map< std::string, PropertyValue > PropertyValueMap
Definition: PropertyValue.h:27
PostInitClass(Core::PropertyContainer *p)
Definition: PropertyContainer.h:446
bool isDerivedFrom() const
Definition: Base.h:108
Definition: PropertyContainer.h:91
Definition: DocObject.h:25
Definition: PropertyContainer.h:89
virtual void onPropertyStatusBitsChanged(const Property &prop, unsigned long oldStatus)
Is called when the Property StatusBits are changed.
Definition: PropertyContainer.h:226
Definition: PropertyContainer.h:87
Defines a non-persistent vector in 3D space.
Definition: Vec.h:44
#define MUTABLE_CONTAINER(_class_)
Definition: PropertyContainer.h:48
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:270
Definition: PropertyContainer.h:443
FieldData(const Core::FieldData *)
Definition: PropertyContainer.h:37
Definition: PropertyContainer.h:34
Definition: Property.h:77
Status
Definition: PropertyContainer.h:393
Core::PropertyContainer * container
Definition: PropertyContainer.h:448
Core::PropertyUser is a class that can hold properties defined by the user. Its value member is a Cor...
Definition: PropertyUser.h:15
Definition: AbstractXMLReader.h:5
Definition: PropertyContainer.h:86
basic_group< entity, Types... > group
Alias declaration for the most common use case.
Definition: entt.hpp:3822
virtual Core::Variant getVariant(void) const =0
Definition: PropertyContainer.h:88
Defines a non-persistent 2D cartesian point.
Definition: Pnt2d.h:33
virtual void onChangedProperty(const Property *prop)
Definition: PropertyContainer.h:301
virtual bool onChangedDebug(Core::DocObject *o, Core::Property *p)
Status
Definition: CoreDocument.h:152
Definition: DocObject.h:51