summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/CRSMConfig.hpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/CRSMConfig.hpp b/src/CRSMConfig.hpp
index 5c9adb9..7cdd501 100644
--- a/src/CRSMConfig.hpp
+++ b/src/CRSMConfig.hpp
@@ -56,6 +56,7 @@ using Boolean = bool;
#define ConfigValue(Value) {#Value, mkConfigValue(Value)}
+#define ConfigValueEx(Value, ...) {#Value, mkConfigValue(Value, __VA_ARGS__)}
template<>
class CRSMConfigValue<String> : public CRSMConfigValueBase {
@@ -158,9 +159,10 @@ class CRSMConfigValue<QList<Type>> : public CRSMConfigValueList {
using ListType = QList<Type>;
ListType& config;
+ const bool deduplicate;
public:
- CRSMConfigValue(ListType& config) : config(config) {}
+ CRSMConfigValue(ListType& config, bool deduplicate = true) : config(config), deduplicate(deduplicate) {}
virtual ListType& list() { return config; }
virtual CRSMConfigValueType::Type type() { return CRSMConfigValueType::Type::List; }
@@ -168,7 +170,7 @@ public:
virtual void append(const QString &entry)
{
Type val = CRSMConfigValueBase::getValue<Type>(entry);
- if(!config.contains(val))
+ if(!deduplicate || !config.contains(val))
{
config.append(val);
}
@@ -231,10 +233,10 @@ public:
CRSMConfigValue(Type& config) : CRSMConfigValue<UndType>::CRSMConfigValue((UndType&)config) {}
};
-template<typename Type>
-CRSMConfigValue<Type>* mkConfigValue(Type& Value)
+template<typename Type, typename... Types>
+CRSMConfigValue<Type>* mkConfigValue(Type& Value, Types... values)
{
- return new CRSMConfigValue<Type>(Value);
+ return new CRSMConfigValue<Type>(Value, values...);
}
template<typename Type>