OpenLexocad  27.1
DbgInfo.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <Base/String.h>
4 #include <Base/md5.h>
5 #include <Core/DocObject.h>
6 
7 #include <memory>
8 #include <vector>
9 
10 
11 class QUuid;
12 namespace Core
13 {
14 class DbgInfo;
15 }
16 
17 
18 typedef std::shared_ptr<Core::DbgInfo> pDbgInfo;
19 
20 namespace Core
21 {
22 class LX_CORE_EXPORT DbgInfo
23 
24 #ifndef SWIG
25  : public std::enable_shared_from_this<Core::DbgInfo>
26 #endif
27 
28 {
29 public:
30  friend class DocObject;
31 
32  DbgInfo();
33  virtual ~DbgInfo() {}
34 
35  // Creates a DbgInfo and calls createMD5()
36  template <typename T>
37  static std::shared_ptr<T> createDbgInfo(const Base::String& name, const Base::String& value, const Base::String& type, pDbgInfo parent = nullptr)
38  {
39  std::shared_ptr<T> mp1 = std::make_shared<T>();
40  mp1->name = name;
41  mp1->value = value;
42  mp1->type = type;
43  if (parent)
44  {
45  parent->addChild(mp1);
46  }
47  return mp1;
48  }
49 
54 
55  void addChild(pDbgInfo child);
56  std::vector<pDbgInfo> getChildren() const;
57  // Creates a 'unique' MD5
58  void createMD5(const Base::String& prefix);
59 
60 private:
61  void getNameForMD5(Base::String& md5_name);
62  std::vector<pDbgInfo> children;
63  pDbgInfo parent;
64 };
65 
66 // DbgInfo that points to s DocObject
67 class LX_CORE_EXPORT DbgInfoLink : public Core::DbgInfo
68 {
69 public:
70  virtual ~DbgInfoLink() {}
71  const Core::DocObject* object = nullptr;
72 };
73 
74 // DbgInfo for a shape
75 class LX_CORE_EXPORT DbgInfoShape : public Core::DbgInfo
76 {
77 public:
78  virtual ~DbgInfoShape() {}
80 };
81 
82 
83 } // namespace Core
Base::String name
Definition: DbgInfo.h:51
Definition: md5.h:69
Core::PropertyText name
Definition: CoreDocument.h:167
std::shared_ptr< Core::DbgInfo > pDbgInfo
Definition: DbgInfo.h:18
static std::shared_ptr< T > createDbgInfo(const Base::String &name, const Base::String &value, const Base::String &type, pDbgInfo parent=nullptr)
Definition: DbgInfo.h:37
A Utf-16 (windows) or ucs4 (unix) encoded string class.
Definition: String.h:23
virtual ~DbgInfoShape()
Definition: DbgInfo.h:78
Definition: DbgInfo.h:22
Base::String type
Definition: DbgInfo.h:53
Definition: Base.h:12
MD5 dbginfo_md5
Definition: DbgInfo.h:50
virtual ~DbgInfo()
Definition: DbgInfo.h:33
Definition: DbgInfo.h:75
MD5 LX_BASE_EXPORT createMD5(const std::string &filename)
pConstShape shape
Definition: DbgInfo.h:79
std::shared_ptr< Topo::Shape const > pConstShape
Definition: Variant.h:77
Base::String value
Definition: DbgInfo.h:52
Definition: DocObject.h:51