diff options
Diffstat (limited to 'libsowatch/configkey.h')
-rw-r--r-- | libsowatch/configkey.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/libsowatch/configkey.h b/libsowatch/configkey.h new file mode 100644 index 0000000..ef7665e --- /dev/null +++ b/libsowatch/configkey.h @@ -0,0 +1,52 @@ +#ifndef SOWATCH_CONFIGKEY_H +#define SOWATCH_CONFIGKEY_H + +#include <QtCore/QObject> +#include <QtCore/QVariant> +#include <QtCore/QStringList> +#include "sowatch_global.h" + +namespace sowatch +{ + +class SOWATCH_EXPORT ConfigKey : public QObject +{ + Q_OBJECT + Q_PROPERTY(QString key READ key CONSTANT) + Q_PROPERTY(QVariant value READ value WRITE set RESET unset NOTIFY changed USER true) + Q_PROPERTY(QStringList dirs READ dirs) + Q_PROPERTY(QStringList keys READ keys) + +public: + ConfigKey(QObject *parent = 0); + + virtual QString key() const = 0; + + virtual QVariant value() const = 0; + virtual void set(const QVariant& value) = 0; + virtual void unset() = 0; + virtual bool isSet() const = 0; + virtual bool isDir() const = 0; + + virtual QVariant value(const QString& subkey) const = 0; + virtual QVariant value(const QString& subkey, const QVariant& def) const = 0; + virtual void set(const QString& subkey, const QVariant& value) = 0; + virtual void unset(const QString& subkey) = 0; + virtual bool isSet(const QString& subkey) const = 0; + virtual bool isDir(const QString& subkey) const = 0; + + virtual QStringList dirs() const = 0; + virtual QStringList keys() const = 0; + + virtual void recursiveUnset() = 0; + + virtual ConfigKey* getSubkey(const QString& subkey, QObject *parent = 0) const = 0; + +signals: + void changed(); + void subkeyChanged(const QString& subkey); +}; + +} + +#endif // SOWATCH_CONFIGKEY_H |