NuriaProject Framework
0.1
The NuriaProject Framework
|
A data storage managed by an AbstractSessionManager. More...
#include <session.hpp>
Public Member Functions | |
Session () | |
Session (const Session &other) | |
~Session () | |
bool | contains (const QString &key) const |
QByteArray | id () const |
bool | isDirty () const |
bool | isValid () const |
AbstractSessionManager * | manager () const |
void | markClean () |
void | markDirty () |
Session & | operator= (const Session &other) |
QVariant & | operator[] (const QString &key) |
QVariant | operator[] (const QString &key) const |
int | refCount () const |
void | remove () |
QVariant | value (const QString &key) const |
Friends | |
class | AbstractSessionManager |
bool | operator!= (const Session &a, const Session &b) |
bool | operator== (const Session &a, const Session &b) |
A data storage managed by an AbstractSessionManager.
A Session is a key-value-store for persistent storage of session data. Sessions are managed by an AbstractSessionManager and are object to its storage policy.
Nuria::Session::Session | ( | ) |
Creates an invalid session.
Nuria::Session::Session | ( | const Session & | other | ) |
Copy constructor.
Nuria::Session::~Session | ( | ) |
Destructor.
bool Nuria::Session::contains | ( | const QString & | key | ) | const |
Returns true
if there's a value for key.
QByteArray Nuria::Session::id | ( | ) | const |
Returns the id used to identify the session in the manager.
bool Nuria::Session::isDirty | ( | ) | const |
Returns true
if the stored data has changed.
bool Nuria::Session::isValid | ( | ) | const |
Returns true
if a session is valid.
AbstractSessionManager* Nuria::Session::manager | ( | ) | const |
Returns the manager which handles this session.
nullptr
may be returned. void Nuria::Session::markClean | ( | ) |
Marks the session as clean, used to indicate that changed data has been saved.
void Nuria::Session::markDirty | ( | ) |
Marks the session as dirty, which indicates to the associated session manager that this instance should be written back to the manager implementation specific back-end, such as a database.
QVariant& Nuria::Session::operator[] | ( | const QString & | key | ) |
QVariant Nuria::Session::operator[] | ( | const QString & | key | ) | const |
Same as value().
int Nuria::Session::refCount | ( | ) | const |
Returns the reference count of this session instance. The reference count indicates how many other session instances are in the application pointing to the same data, including this instance itself. If this method returns 1
, then this is the only instance left.
void Nuria::Session::remove | ( | ) |
Removes the session from the manager.
QVariant Nuria::Session::value | ( | const QString & | key | ) | const |
Returns the value known as key. If there's no value for key, then a invalid QVariant is returned which is not inserted into the internal storage. The dirty flag is not changed by this method.