Editor API
UnigineEditor public API
UniginePluginInfo.h
1 // Copyright (C), UNIGINE. All rights reserved.
2 #pragma once
3 
4 
5 #include <editor/UnigineEditorGlobal.h>
6 
7 #include <UnigineString.h>
8 
9 #include <QPluginLoader>
10 
12 // Forward decl.
14 namespace UnigineEditor
15 {
16 class Plugin;
17 class PluginManager;
18 class PluginInfoPrivate;
19 class PluginManagerPrivate;
20 }
21 
22 
23 namespace UnigineEditor
24 {
25 
27 struct UNIGINE_EDITOR_API PluginDependency
28 {
30  enum class Type
31  {
33  REQUIRED,
35  OPTION
36  };
37 
38  Type type = Type::REQUIRED;
40  Unigine::String name;
42  Unigine::String version;
43 };
44 
48 class UNIGINE_EDITOR_API PluginInfo
49 {
50 public:
52  enum class State
53  {
55  INVALID,
57  READ,
59  RESOLVED,
61  LOADED,
63  RUNNING,
65  STOPPED,
67  UNLOADED
68  };
69 
70  PluginInfo();
71  ~PluginInfo();
72 
74  const char *name() const;
76  const char *version() const;
78  const char *vendor() const;
80  const char *description() const;
82  const char *compatibleVersion() const;
84  Unigine::Vector<PluginDependency> dependencies() const;
85 
87  const char *absoluteFilePath() const;
88 
92  bool hasError() const;
94  const char *errorString() const;
95 
98  State state() const;
99 
103  bool isInstanceOf(const char *name, const char *version) const;
104 
106  Plugin *plugin() const;
107 
108 private:
109  ::UnigineEditor::PluginInfoPrivate *const d;
110 
111  friend class ::UnigineEditor::PluginManagerPrivate;
112 };
113 
114 } // namespace UnigineEditor
115 
116 Q_DECLARE_METATYPE(::UnigineEditor::PluginInfo *);
117 
118 namespace Unigine
119 {
120 
121 template<typename Type>
122 struct Hasher;
123 
124 template<>
125 struct Hasher<::UnigineEditor::PluginDependency>
126 {
127  using HashType = unsigned int;
128  UNIGINE_INLINE static HashType create(const ::UnigineEditor::PluginDependency &v)
129  {
130  return ::Unigine::Hasher<::Unigine::String>::create(v.name);
131  }
132 };
133 
134 } // namespace Unigine
Unigine::String version
Plugin version.
Definition: UniginePluginInfo.h:42
This class is used for plugin interface implementation when creating Editor plugins....
Definition: UniginePlugin.h:17
Unigine::String name
Plugin name.
Definition: UniginePluginInfo.h:40
Type
Plugin type. Defines whether the plugin is a required or an optional one.
Definition: UniginePluginInfo.h:30
Defines dependency on a plugin.
Definition: UniginePluginInfo.h:27
This class it is responsible for plugin loading/unloading and contains all necessary plugin metadata ...
Definition: UniginePluginInfo.h:48
State
Current plugin state.
Definition: UniginePluginInfo.h:52