diff options
Diffstat (limited to 'project2/common/session.cpp')
-rw-r--r-- | project2/common/session.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/project2/common/session.cpp b/project2/common/session.cpp index d796f83..fcfd3ca 100644 --- a/project2/common/session.cpp +++ b/project2/common/session.cpp @@ -1,5 +1,6 @@ #include <pch.hpp> #include "session.h" +#include "safeMapFind.h" Session::Session(const UUID & sid) : ID(sid) @@ -10,3 +11,41 @@ Session::~Session() { } +void +Session::ExpiryTime(time_t t) +{ + expires = t; +} + +time_t +Session::ExpiryTime() const +{ + return expires; +} + +VariableType +Session::GetValue(const Glib::ustring & name) const +{ + return safeMapFind<VariableNotFound>(vars, name)->second; +} + +void +Session::SetValue(const Glib::ustring & name, const VariableType & value) +{ + vars[name] = value; +} + +void +Session::ClearValue(const Glib::ustring & name) +{ + vars.erase(name); +} + +void +Session::ForeachValue(const Session::SVH & svh) const +{ + BOOST_FOREACH(const Values::value_type & v, vars) { + svh(v.first, v.second); + } +} + |