1 #ifndef SETTINGSBASE_HPP
2 #define SETTINGSBASE_HPP
20 inline QString
value(
const QString &key,
const QString &defaultValue = QString())
const
27 QStringList values =
mSettings.values(key);
28 if (!values.contains(value))
34 QStringList values =
mSettings.values(key);
35 if (!values.contains(value))
44 inline void remove(
const QString &key)
55 QString sectionPrefix;
57 QRegExp sectionRe(
"^\\[([^]]+)\\]");
58 QRegExp keyRe(
"^([^=]+)\\s*=\\s*(.+)$");
60 while (!stream.atEnd()) {
61 QString line = stream.readLine();
63 if (line.isEmpty() || line.startsWith(
"#"))
66 if (sectionRe.exactMatch(line)) {
67 sectionPrefix = sectionRe.cap(1);
68 sectionPrefix.append(
"/");
72 if (keyRe.indexIn(line) != -1) {
74 QString key = keyRe.cap(1).trimmed();
75 QString
value = keyRe.cap(2).trimmed();
77 if (!sectionPrefix.isEmpty())
78 key.prepend(sectionPrefix);
82 QStringList values = cache.values(key);
84 if (!values.contains(value)) {
86 cache.insertMulti(key, value);
88 cache.insert(key, value);
115 #endif // SETTINGSBASE_HPP
void clear()
Definition: settingsbase.hpp:104
void setMultiValueEnabled(bool enable)
Definition: settingsbase.hpp:39
void setMultiValue(const QString &key, const QString &value)
Definition: settingsbase.hpp:32
Map getSettings() const
Definition: settingsbase.hpp:49
SettingsBase()
Definition: settingsbase.hpp:17
Definition: settingsbase.hpp:13
void setValue(const QString &key, const QString &value)
Definition: settingsbase.hpp:25
bool mMultiValue
Definition: settingsbase.hpp:112
bool readFile(QTextStream &stream)
Definition: settingsbase.hpp:51
~SettingsBase()
Definition: settingsbase.hpp:18
void enable(CodeContainer &code, Literals &literals, const std::string &id)
Definition: generator.cpp:870
Map mSettings
Definition: settingsbase.hpp:110
QString value(const QString &key, const QString &defaultValue=QString()) const
Definition: settingsbase.hpp:20