summaryrefslogtreecommitdiffstats
path: root/src/ConfigBase.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ConfigBase.hpp')
-rw-r--r--src/ConfigBase.hpp18
1 files changed, 3 insertions, 15 deletions
diff --git a/src/ConfigBase.hpp b/src/ConfigBase.hpp
index d25861c..72625e5 100644
--- a/src/ConfigBase.hpp
+++ b/src/ConfigBase.hpp
@@ -10,6 +10,8 @@
#include <type_traits>
#include <limits>
+#include "Util.hpp"
+
using ConfigException = std::logic_error;
namespace ConfigValueType {
@@ -67,7 +69,7 @@ class ConfigValue<String> : public ConfigValueBase {
public:
ConfigValue(String& config) : config(config) { }
- virtual void setValue(const QString& value) { config = trimQuotes(QString(value), trimmedQuotes); }
+ virtual void setValue(const QString& value) { config = Util::trimQuotes(value, trimmedQuotes); }
virtual QString value()
{
if(trimmedQuotes)
@@ -80,20 +82,6 @@ public:
}
}
virtual ConfigValueType::Type type() { return ConfigValueType::Type::String; }
-
-private:
- QString& trimQuotes(QString&& string, bool& trimmed)
- {
- trimmed = false;
- if(string.length() >= 2 && string.at(0) == '"' && string.at(string.length() - 1) == '"')
- {
- string.remove(0, 1);
- string.remove(string.length() - 1, 1);
- trimmed = true;
- }
- return string;
- }
-
};
template<typename Type>