summaryrefslogtreecommitdiff
path: root/project2/variables-modconfig.cpp
blob: 935e2d65750e74e6b0966140aaebcf9fa67c017b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "variables.h"
#include "xmlObjectLoader.h"
#include "xmlStorage.h"
#include "appEngine.h"

/// Variable implementation to access platform configuration values
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;
};
DECLARE_COMPONENT_LOADER("config", VariableConfig, VariableLoader);