Editor API
UnigineEditor public API
PluginInfo.h
1 // Copyright (C), UNIGINE. All rights reserved.
2 #pragma once
3 
4 
5 #include <EditorGlobal.h>
6 
7 #include <QString>
8 #include <QVector>
9 #include <QHash>
10 #include <QPluginLoader>
11 
12 
14 // Forward decl.
16 namespace Editor
17 {
18 class Plugin;
19 class PluginManager;
20 class PluginInfoPrivate;
21 }
22 
23 
24 namespace Editor
25 {
26 
28 struct EDITOR_API PluginDependency
29 {
31  enum class Type
32  {
34  REQUIRED,
36  OPTION
37  };
38 
39  Type type = Type::REQUIRED;
41  QString name;
43  QString version;
44 };
45 
46 uint qHash(const PluginDependency &value);
47 
51 class EDITOR_API PluginInfo
52 {
53 public:
55  enum class State
56  {
58  INVALID,
60  READ,
62  RESOLVED,
64  LOADED,
66  RUNNING,
68  STOPPED,
70  UNLOADED
71  };
72 
73  PluginInfo();
74  ~PluginInfo();
75 
77  const QString &name() const;
79  const QString &version() const;
81  const QString &vendor() const;
83  const QString &description() const;
85  const QString &compatibleVersion() const;
87  const QVector<PluginDependency> dependencies() const;
88 
90  const QString &absoluteFilePath() const;
91 
95  bool hasError() const;
97  const QString &errorString() const;
98 
101  State state() const;
102 
106  bool isInstanceOf(const QString &name, const QString &version) const;
107 
109  Plugin *plugin() const;
110 
111 private:
112  PluginInfoPrivate *d;
113 
114  friend class PluginManagerPrivate;
115 };
116 
117 
118 } // namespace Editor
119 
120 Q_DECLARE_METATYPE(::Editor::PluginInfo *);
121 
State
Current plugin state.
Definition: PluginInfo.h:55
Definition: Actions.h:9
uint qHash(const PluginDependency &value)
This class it is responsible for plugin loading/unloading and contains all necessary plugin metadata ...
Definition: PluginInfo.h:51
Defines dependency on a plugin.
Definition: PluginInfo.h:28
QString version
Plugin version.
Definition: PluginInfo.h:43
This class is used for plugin interface implementation when creating Editor plugins....
Definition: Plugin.h:16
Type
Plugin type. Defines whether the plugin is a required or an optional one.
Definition: PluginInfo.h:31
QString name
Plugin name.
Definition: PluginInfo.h:41