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