summaryrefslogtreecommitdiff
path: root/project2/variables.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'project2/variables.cpp')
-rw-r--r--project2/variables.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/project2/variables.cpp b/project2/variables.cpp
index 130d210..20b4fa2 100644
--- a/project2/variables.cpp
+++ b/project2/variables.cpp
@@ -252,6 +252,25 @@ class VariableFixed : public VariableImpl {
VariableType var;
};
+class VariableConfig : public VariableImplDyn {
+ public:
+ VariableConfig(const xmlpp::Element * e) :
+ VariableImplDyn(e),
+ name(e->get_attribute_value("name"))
+ {
+ }
+ const VariableType & value() const
+ {
+ if (!cacheValid) {
+ cache = ApplicationEngine::getCurrent()->getCurrentConfig()->getValue(name);
+ cacheValid = true;
+ }
+ return cache;
+ }
+ private:
+ const Glib::ustring name;
+};
+
Variable::Variable(const xmlpp::Element * e, const Glib::ustring & n, bool required, VariableType def)
{
xmlpp::Attribute * a = e->get_attribute(n);
@@ -272,6 +291,8 @@ Variable::Variable(const xmlpp::Element * e, const Glib::ustring & n, bool requi
var = new VariableUri(c);
else if (source == "param")
var = new VariableParam(c);
+ else if (source == "config")
+ var = new VariableConfig(c);
else if (source == "literal" || source.empty())
var = new VariableLiteral(c->get_attribute_value("value"), c->get_attribute_value("type"));
else