OpenLexocad  27.1
PropertyProxy.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 
5 #include "Core/Property.h"
6 #include "Core/Variant.h"
7 
8 
9 namespace Core
10 {
11 /*@brief
12  * A PropertyProxy serves as a placeholder for another property (usually in another class).
13  * It is used to mimic the Properties update mechanism even if the class it is used in does
14  * not have a property of this king.
15  * P.e. it can be used in an Element to do as if it would have a PropertyShape. This way
16  * the updating of shapes can be more easily handled in App.Element.
17  */
18 
19 class LX_CORE_EXPORT PropertyProxy : public Core::Property
20 {
22 
23 public:
24  PropertyProxy(void);
25  virtual ~PropertyProxy(void);
26 
27  inline void setValue(bool b);
28  bool setValueFromVariant(const Core::Variant& value);
29  void copyValue(Core::Property* p);
30 
31  bool getValue() const;
32  Core::Variant getVariant(void) const;
33 
34  virtual void save(Base::AbstractWriter& writer, Base::PersistenceVersion& save_version);
35  inline virtual void restore(Base::AbstractXMLReader& reader, Base::PersistenceVersion& version);
36  virtual bool isEqual(const Property*) const;
37  virtual Core::Property* copy(void) const override;
38  virtual void paste(const Core::Property& from) override;
39 
40 protected:
41  bool _nValue;
42 };
43 
44 DECLARE_PROPERTY_FACTORY(PropertyProxy_Factory, Core::PropertyProxy);
45 
46 } // namespace Core
Definition: Persistence.h:14
bool _nValue
Definition: PropertyProxy.h:41
LX_CORE_EXPORT Version & version
Definition: Variant.h:87
Definition: AbstractXMLReader.h:7
Definition: Base.h:12
Definition: Writer.h:16
Definition: Property.h:77
Definition: PropertyProxy.h:19
TYPESYSTEM_HEADER()
DECLARE_PROPERTY_FACTORY(PropertyAxis1_Factory, Core::PropertyAxis1)