7 #include <QDirIterator>
9 #include <QJsonValueRef>
11 #include <QPluginLoader>
12 #include <QStringBuilder>
49 if (!metadata[
"MetaData"].isObject()) {
return false; }
52 if (!data.
contains(
"identifier") || !data[
"identifier"].isString()) {
return false; }
57 if (metadata[
"IID"].toString() == iid) {
return true; }
74 bool IPluginManager::tryLoad(
const QString &path)
88 m_paths.
insert(identifier, path);
94 if (!configId.
isEmpty()) { m_configs.
insert(identifier, configId); }
100 QObject *IPluginManager::getPluginByIdImpl(
const QString &identifier)
102 if (m_instances.
contains(identifier)) {
return m_instances.
value(identifier); }
112 QObject *instance = loader.instance();
115 m_instances.
insert(identifier, instance);
116 m_instanceIds.
insert(instance, identifier);
QString pluginIdentifier(const QJsonObject &metadata) const
Gets the plugin identifier from the metadata.
QString getPluginConfigId(const QString &identifier)
If the plugin specifies its config plugin, its identifier can be obtained using this method....
QString getIdByPlugin(const QObject *instance) const
Gets plugin identifier by its instance.
virtual bool isValid(const QJsonObject &metadata) const
Defines whether the given plugin is valid or not, based on its metadata. The default implementation c...
virtual void collectPlugins()
Looks for all available plugins.
virtual swift::misc::CSequence< QString > acceptedIids() const =0
Returns the list of valid IIDs for the implementation.
virtual const QString & pluginDirectory() const
Where to look for plugins, absolute path. Default implementation returns plugins in the application d...
Class for emitting a log message.
Derived & warning(const char16_t(&format)[N])
Set the severity to warning, providing a format string.
Derived & error(const char16_t(&format)[N])
Set the severity to error, providing a format string.
Derived & debug()
Set the severity to debug.
void push_back(const T &value)
Appends an element at the end of the sequence.
static const QString & pluginsDirectory()
Plugins directory.
Backend services of the swift project, like dealing with the network or the simulators.
Free functions in swift::misc.
bool exists() const const
QString path() const const
bool hasNext() const const
bool contains(QLatin1StringView key) const const
QJsonValue value(QLatin1StringView key) const const
QJsonObject toObject() const const
QString toString() const const
bool isLibrary(const QString &fileName)
bool contains(const Key &key) const const
QMap< Key, T >::iterator insert(QMap< Key, T >::const_iterator pos, const Key &key, const T &value)
T value(const Key &key, const T &defaultValue) const const
bool isEmpty() const const