summaryrefslogtreecommitdiffstats
path: root/ConfigBase.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'ConfigBase.hpp')
-rw-r--r--ConfigBase.hpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/ConfigBase.hpp b/ConfigBase.hpp
index ade454a..a31e66b 100644
--- a/ConfigBase.hpp
+++ b/ConfigBase.hpp
@@ -51,6 +51,7 @@ public:
using String = QString;
using Integer = int;
+using Float = double;
using Port = ushort;
using Boolean = bool;
#define List(Type) QList<Type>
@@ -104,6 +105,22 @@ public:
};
template<>
+class ConfigValue<Float> : public ConfigValueBase {
+ Float& config;
+public:
+ ConfigValue(Float& config) : config(config) { }
+
+ virtual void setValue(const QString& value)
+ {
+ bool ok = true;
+ Float temp = value.toDouble(&ok);
+ if(!ok) throw ConfigException("\"" + value.toStdString() + "\" could not be parsed as a Float");
+ config = temp;
+ }
+ virtual QString value() { return QString::number(config, 'g', 10); }
+};
+
+template<>
class ConfigValue<Boolean> : public ConfigValueBase {
Boolean& config;