#include "variables.h" #include "xmlObjectLoader.h" #include "xmlStorage.h" #include "appEngine.h" /// Variable implementation to access session contents class VariableSession : public VariableImplDyn { public: VariableSession(const xmlpp::Element * e) : VariableImplDyn(e), name(e->get_attribute_value("name")) { } const VariableType & value() const { try { cache = ApplicationEngine::getCurrent()->session()->GetValue(name); } catch (Session::VariableNotFound) { if (!defaultValue) { throw; } cache = (*defaultValue)(); } return cache; } private: const Glib::ustring name; }; DECLARE_COMPONENT_LOADER("session", VariableSession, VariableLoader);