diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-12-31 09:36:23 -0500 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-12-31 09:36:23 -0500 |
| commit | 76adbe9f9582934ef865337c1ffc58e9106112b6 (patch) | |
| tree | 543a048d5e5d12a337d6ad7135658e70ab251ed0 /sigscript | |
| parent | 541ed4742c6368cc36c35ca74dba09b9d108283b (diff) | |
Added values() method to Config
Diffstat (limited to 'sigscript')
| -rw-r--r-- | sigscript/Config.cpp | 13 | ||||
| -rw-r--r-- | sigscript/Config.h | 2 |
2 files changed, 15 insertions, 0 deletions
diff --git a/sigscript/Config.cpp b/sigscript/Config.cpp index 70644be5..9113badf 100644 --- a/sigscript/Config.cpp +++ b/sigscript/Config.cpp @@ -103,6 +103,19 @@ bool Sigscript::Config::hasValue(const QString& name, const bool recursive) cons return false; } +QStringList Sigscript::Config::values(const bool recursive) const +{ + QStringList values = m_values.keys(); + if (recursive && m_parent) + values += m_parent->values(true); + foreach (QString value, values) + { + if (m_values.contains(value) && (m_values[value].second & (Deleted | Hidden))) + values.removeAll(value); + } + return values.toSet().toList(); +} + void Sigscript::Config::clean() { QWriteLocker locker(&m_lock); diff --git a/sigscript/Config.h b/sigscript/Config.h index 33fb4011..bbe65cca 100644 --- a/sigscript/Config.h +++ b/sigscript/Config.h @@ -61,6 +61,8 @@ class SIGSCRIPT_EXPORT Config : public QObject template<typename T> T valueOfType(const QString& name, const bool recursive = true) const; Q_SCRIPTABLE bool hasValue(const QString& name, const bool recursive = true) const; template<typename T> bool hasValueOfType(const QString& name, const bool recursive = true) const; + + Q_SCRIPTABLE QStringList values(const bool recursive = false) const; signals: void valueAdded(const QString& name, const QVariant& value); void valueChanged(const QString& name, const QVariant& oldValue, const QVariant& newValue); |
