SDRAngel
4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
|
#include <httpsession.h>
Classes | |
struct | HttpSessionData |
Public Member Functions | |
HttpSession (bool canStore=false) | |
HttpSession (const HttpSession &other) | |
HttpSession & | operator= (const HttpSession &other) |
virtual | ~HttpSession () |
QByteArray | getId () const |
bool | isNull () const |
void | set (const QByteArray &key, const QVariant &value) |
void | remove (const QByteArray &key) |
QVariant | get (const QByteArray &key) const |
bool | contains (const QByteArray &key) const |
QMap< QByteArray, QVariant > | getAll () const |
qint64 | getLastAccess () const |
void | setLastAccess () |
Private Attributes | |
HttpSessionData * | dataPtr |
This class stores data for a single HTTP session. A session can store any number of key/value pairs. This class uses implicit sharing for read and write access. This class is thread safe.
Definition at line 25 of file httpsession.h.
HttpSession::HttpSession | ( | bool | canStore = false | ) |
Constructor.
canStore | The session can store data, if this parameter is true. Otherwise all calls to set() and remove() do not have any effect. |
Definition at line 12 of file httpsession.cpp.
References dataPtr, qtwebapp::HttpSession::HttpSessionData::id, qtwebapp::HttpSession::HttpSessionData::lastAccess, and qtwebapp::HttpSession::HttpSessionData::refCount.
HttpSession::HttpSession | ( | const HttpSession & | other | ) |
Copy constructor. Creates another HttpSession object that shares the data of the other object.
Definition at line 30 of file httpsession.cpp.
References dataPtr, qtwebapp::HttpSession::HttpSessionData::id, qtwebapp::HttpSession::HttpSessionData::lock, and qtwebapp::HttpSession::HttpSessionData::refCount.
|
virtual |
Destructor. Detaches from the shared data.
Definition at line 78 of file httpsession.cpp.
References dataPtr, qtwebapp::HttpSession::HttpSessionData::id, qtwebapp::HttpSession::HttpSessionData::lock, and qtwebapp::HttpSession::HttpSessionData::refCount.
bool HttpSession::contains | ( | const QByteArray & | key | ) | const |
Check if a key exists. This method is thread safe.
Definition at line 145 of file httpsession.cpp.
References dataPtr, qtwebapp::HttpSession::HttpSessionData::lock, and qtwebapp::HttpSession::HttpSessionData::values.
QVariant HttpSession::get | ( | const QByteArray & | key | ) | const |
Get a value. This method is thread safe.
Definition at line 133 of file httpsession.cpp.
References dataPtr, qtwebapp::HttpSession::HttpSessionData::lock, and qtwebapp::HttpSession::HttpSessionData::values.
QMap< QByteArray, QVariant > HttpSession::getAll | ( | ) | const |
Get a copy of all data stored in this session. Changes to the session do not affect the copy and vice versa. This method is thread safe.
Definition at line 157 of file httpsession.cpp.
References dataPtr, qtwebapp::HttpSession::HttpSessionData::lock, and qtwebapp::HttpSession::HttpSessionData::values.
QByteArray HttpSession::getId | ( | ) | const |
Get the unique ID of this session. This method is thread safe.
Definition at line 97 of file httpsession.cpp.
References dataPtr, and qtwebapp::HttpSession::HttpSessionData::id.
Referenced by qtwebapp::HttpSessionStore::getSession(), qtwebapp::HttpSessionStore::removeSession(), and qtwebapp::HttpSessionStore::sessionTimerEvent().
qint64 HttpSession::getLastAccess | ( | ) | const |
Get the timestamp of last access. That is the time when the last HttpSessionStore::getSession() has been called. This method is thread safe.
Definition at line 169 of file httpsession.cpp.
References dataPtr, qtwebapp::HttpSession::HttpSessionData::lastAccess, and qtwebapp::HttpSession::HttpSessionData::lock.
Referenced by qtwebapp::HttpSessionStore::sessionTimerEvent().
bool HttpSession::isNull | ( | ) | const |
Null sessions cannot store data. All calls to set() and remove() do not have any effect.This method is thread safe.
Definition at line 109 of file httpsession.cpp.
References dataPtr.
Referenced by qtwebapp::HttpSessionStore::getSession().
HttpSession & HttpSession::operator= | ( | const HttpSession & | other | ) |
Copy operator. Detaches from the current shared data and attaches to the data of the other object.
Definition at line 44 of file httpsession.cpp.
References dataPtr, qtwebapp::HttpSession::HttpSessionData::id, qtwebapp::HttpSession::HttpSessionData::lastAccess, qtwebapp::HttpSession::HttpSessionData::lock, and qtwebapp::HttpSession::HttpSessionData::refCount.
void HttpSession::remove | ( | const QByteArray & | key | ) |
Remove a value. This method is thread safe.
Definition at line 123 of file httpsession.cpp.
References dataPtr, qtwebapp::HttpSession::HttpSessionData::lock, and qtwebapp::HttpSession::HttpSessionData::values.
void HttpSession::set | ( | const QByteArray & | key, |
const QVariant & | value | ||
) |
Set a value. This method is thread safe.
Definition at line 113 of file httpsession.cpp.
References dataPtr, qtwebapp::HttpSession::HttpSessionData::lock, and qtwebapp::HttpSession::HttpSessionData::values.
void HttpSession::setLastAccess | ( | ) |
Set the timestamp of last access, to renew the timeout period. Called by HttpSessionStore::getSession(). This method is thread safe.
Definition at line 182 of file httpsession.cpp.
References dataPtr, qtwebapp::HttpSession::HttpSessionData::lastAccess, and qtwebapp::HttpSession::HttpSessionData::lock.
Referenced by qtwebapp::HttpSessionStore::getSession().
|
private |
Pointer to the shared data.
Definition at line 118 of file httpsession.h.
Referenced by contains(), get(), getAll(), getId(), getLastAccess(), HttpSession(), isNull(), operator=(), remove(), set(), setLastAccess(), and ~HttpSession().