summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarkus Mittendrein <git@maxmitti.tk>2015-10-15 15:48:45 +0200
committerMarkus Mittendrein <git@maxmitti.tk>2015-10-15 15:48:45 +0200
commit139de5aa8b0a278f23056d8bcd9ad0fffd34db68 (patch)
tree3147b03c13efc74d6c046e77f849d5274ca387a3 /src
parentea5b431b24d3b955ca7f97bb92bc24f98574f508 (diff)
downloadmanager-139de5aa8b0a278f23056d8bcd9ad0fffd34db68.tar.gz
manager-139de5aa8b0a278f23056d8bcd9ad0fffd34db68.zip
Add setValue() and value() to list-specialization of ConfigValue for
inline saving
Diffstat (limited to 'src')
-rw-r--r--src/CRSMStats.cpp7
-rw-r--r--src/CRSMStats.hpp15
-rw-r--r--src/ConfigBase.hpp23
3 files changed, 44 insertions, 1 deletions
diff --git a/src/CRSMStats.cpp b/src/CRSMStats.cpp
new file mode 100644
index 0000000..86c541c
--- /dev/null
+++ b/src/CRSMStats.cpp
@@ -0,0 +1,7 @@
+#include "CRSMStats.hpp"
+
+CRSMStats::CRSMStats()
+{
+
+}
+
diff --git a/src/CRSMStats.hpp b/src/CRSMStats.hpp
new file mode 100644
index 0000000..5eb7ed0
--- /dev/null
+++ b/src/CRSMStats.hpp
@@ -0,0 +1,15 @@
+#ifndef CRSMSTATS_HPP
+#define CRSMSTATS_HPP
+
+
+class CRSMStats : public ConfigBase
+{
+public:
+ CRSMStats();
+
+signals:
+
+public slots:
+};
+
+#endif // CRSMSTATS_HPP
diff --git a/src/ConfigBase.hpp b/src/ConfigBase.hpp
index 72625e5..ae3c3de 100644
--- a/src/ConfigBase.hpp
+++ b/src/ConfigBase.hpp
@@ -149,9 +149,10 @@ class ConfigValue<QList<Type>> : public ConfigValueList {
ListType& config;
const bool deduplicate;
+ const QChar splitChar;
public:
- ConfigValue(ListType& config, bool deduplicate = true) : config(config), deduplicate(deduplicate) {}
+ ConfigValue(ListType& config, bool deduplicate = true, const QChar splitChar = ';') : config(config), deduplicate(deduplicate), splitChar(splitChar) {}
virtual ListType& list() { return config; }
virtual ConfigValueType::Type type() { return ConfigValueType::Type::List; }
@@ -178,6 +179,26 @@ public:
return ret;
}
+
+ void setValue(const QString& value)
+ {
+ config.clear();
+ QStringList parts = Util::splitEscaped(value, splitChar);
+ foreach(const QString& part, parts)
+ {
+ config.append(ConfigValueBase::getValue<Type>(part));
+ }
+ }
+
+ QString value()
+ {
+ QStringList parts;
+ foreach(const Type& part, config)
+ {
+ parts.append(ConfigValueBase::getStringValue(part));
+ }
+ return Util::joinEscape(parts, splitChar);
+ }
};
template<typename KeyType, typename ValueType>