summaryrefslogtreecommitdiffstats
path: root/pokescripting/Config.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pokescripting/Config.cpp')
-rw-r--r--pokescripting/Config.cpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/pokescripting/Config.cpp b/pokescripting/Config.cpp
index 8e429fb8..3e2e3adc 100644
--- a/pokescripting/Config.cpp
+++ b/pokescripting/Config.cpp
@@ -34,9 +34,37 @@ void Pokescripting::Config::setValue(const QString& name, const QVariant& value)
m_values[name] = value;
}
-QVariant Pokescripting::Config::value(const QString& name)
+void Pokescripting::Config::removeValue(const QString& name)
+{
+ m_values.remove(name);
+}
+
+QVariant Pokescripting::Config::value(const QString& name, const bool recursive) const
{
if (m_values.contains(name))
return m_values[name];
+ if (recursive)
+ {
+ QObject* par = parent();
+ while (par)
+ {
+ if (qobject_cast<Config*>(par) && qobject_cast<Config*>(par)->hasValue(name))
+ return qobject_cast<Config*>(par)->value(name);
+ par = par->parent();
+ }
+ }
return QVariant();
}
+
+bool Pokescripting::Config::hasValue(const QString& name, const bool recursive) const
+{
+ if (m_values.contains(name))
+ return true;
+ if (recursive && qobject_cast<Config*>(parent()))
+ return qobject_cast<Config*>(parent())->hasValue(name, true);
+ return false;
+}
+
+void Pokescripting::Config::writeBack()
+{
+}