aboutsummaryrefslogtreecommitdiff
path: root/lib/pluginloader/pluginloader.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pluginloader/pluginloader.h')
-rw-r--r--lib/pluginloader/pluginloader.h49
1 files changed, 26 insertions, 23 deletions
diff --git a/lib/pluginloader/pluginloader.h b/lib/pluginloader/pluginloader.h
index b602f5b..703c285 100644
--- a/lib/pluginloader/pluginloader.h
+++ b/lib/pluginloader/pluginloader.h
@@ -1,7 +1,7 @@
/*
* This file is part of smolbote. It's copyrighted by the contributors recorded
* in the version control history of the file, available from its original
- * location: https://neueland.iserlohn-fortress.net/gitea/aqua/smolbote
+ * location: https://library.iserlohn-fortress.net/aqua/smolbote.git
*
* SPDX-License-Identifier: GPL-3.0
*/
@@ -10,38 +10,41 @@
class PluginLoader : public QPluginLoader
{
- Q_OBJECT
-
public:
-
- struct SignatureState {
- bool ignored; // always ignore signature
- bool checked; // check if available
- bool enforced; // always check
-
- SignatureState(bool ignore, bool check, bool enforce) {
- ignored = ignore;
- checked = check;
- enforced = enforce;
- }
+ enum signature_level {
+ SigIgnored = 1,
+ SigChecked = (1 << 1),
+ SigEnforced = (1 << 2),
};
+ typedef unsigned int signature_state_t;
+ static signature_state_t signature_state(bool ignore, bool check, bool enforce)
+ {
+ return (static_cast<unsigned int>(enforce) << 2) | (static_cast<unsigned int>(check) << 1) | static_cast<unsigned int>(ignore);
+ }
- PluginLoader(const QString &fileName, SignatureState state, QObject *parent = nullptr);
- ~PluginLoader() = default;
+ PluginLoader(const QString &fileName, const signature_state_t state, QObject *parent = nullptr)
+ : QPluginLoader(fileName, parent)
+ , m_state(state)
+ {
+ }
+ ~PluginLoader() override = default;
+
+ PluginLoader(const PluginLoader &) = delete;
+ PluginLoader &operator=(const PluginLoader &) = delete;
+ PluginLoader(PluginLoader &&) = delete;
+ PluginLoader &operator=(PluginLoader &&) = delete;
- QString errorString() const
+ [[nodiscard]] QString errorString() const
{
- if(!m_sigError.isEmpty())
+ if(!m_sigError.isEmpty()) {
return m_sigError;
- else
- return QPluginLoader::errorString();
+ }
+ return QPluginLoader::errorString();
}
bool verify(const char *hashName = "SHA256");
private:
- const SignatureState m_state;
-
+ const int m_state;
QString m_sigError;
};
-