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