OpenLexocad  27.0
PropertyGUID.h
Go to the documentation of this file.
1 #pragma once
2 #include <Base/Color.h>
3 #include <Base/Enums.h>
4 #include <Base/Exception.h>
5 #include <Base/GlobalId.h>
6 #include <Core/Property.h>
7 #include <Core/Variant.h>
8 #include <Core/core_defines2.h>
9 
10 class QUuid;
11 
12 namespace Core
13 {
26 {
28 
29 public:
30  PropertyGUID(void);
31  virtual ~PropertyGUID(void);
32 
33 
34  void setValue(const Base::GlobalId& id); // throws Base::GuidInUseException if GUID is already in use.
35  void setValue(const QUuid& id);
37  void setValue(const Base::String& base64);
39  void setValue(const char* aGuid);
40  bool setValueFromVariant(const Core::Variant& value) override;
41 
42  void copyValue(Core::Property* p) override;
43 
45  Base::GlobalId createAndSetGUID();
46 
47  const Base::GlobalId& getValue() const;
48  Core::Variant getVariant(void) const override;
49 
50  unsigned int getData1() const;
51  unsigned short getData2() const;
52  unsigned short getData3() const;
53  void getData4(unsigned char value[8]) const;
54 
55  virtual bool createSQL(Base::AbstractWriter& writer, Base::PersistanceVersion& save_version, bool data) override;
56  virtual void save(Base::AbstractWriter& writer, Base::PersistanceVersion& save_version) override;
57  virtual void restore(Base::AbstractXMLReader& reader, Base::PersistanceVersion& version) override;
58  virtual bool isEqual(const Property*) const override;
59 
60  void toUuid(QUuid& uuid) const;
61  Base::String toBase64String() const;
62  Base::String toString() const;
63 
64  virtual std::shared_ptr<Core::DbgInfo> getDbgInfo() const override;
65 
66 protected:
67  void check_and_save_or_throw(const Base::GlobalId& id);
69 };
70 
71 
72 
73 DECLARE_PROPERTY_FACTORY(PropertyGUID_Factory, Core::PropertyGUID);
74 
75 } // namespace Core
76 
77 
78 
79 // class CORE_EXPORT PropertyGuidBase : public Core::Property
80 //{
81 // TYPESYSTEM_HEADER();
82 
83 // public:
84 // PropertyGuidBase(void);
85 // virtual ~PropertyGuidBase(void);
86 
87 // void setValue(const Base::GlobalId& id);
88 // bool setValueFromVariant(const Core::Variant &value) override;
89 // void copyValue(Core::Property* p) override;
90 // const Base::GlobalId& getValue() const;
91 // Core::Variant getVariant(void) const override;
92 
93 // virtual void save(Base::AbstractWriter & writer, Base::PersistanceVersion& save_version) override;
94 // virtual void restore(Base::AbstractXMLReader &reader, Base::PersistanceVersion& version) override;
95 // virtual bool isEqual(const Property*) const override;
96 
97 // virtual std::shared_ptr<Core::DbgInfo> getDbgInfo() const override;
98 // protected:
99 
100 // Base::GlobalId _value;
101 
102 //};
#define CORE_EXPORT
Definition: core_defines2.h:10
The PropertyGUID class saves and restores GUIDs. It also handles the management of GUIDs in the Docum...
Definition: PropertyGUID.h:25
A Utf-16 (windows) or ucs4 (unix) encoded string class.
Definition: String.h:29
Definition: Persistance.h:20
LX_CORE_EXPORT Version & version
Definition: Variant.h:90
Base::GlobalId _value
Definition: PropertyGUID.h:68
Definition: AbstractXMLReader.h:10
Definition: GlobalId.h:32
Definition: Base.h:19
Definition: Writer.h:27
Definition: Property.h:81
TYPESYSTEM_HEADER()
DECLARE_PROPERTY_FACTORY(PropertyAxis1_Factory, Core::PropertyAxis1)
friend class PropertyGUID
Definition: CoreDocument.h:132