17 #include <QStringList> 18 #include <QMutexLocker> 19 #include "qmapthreadsafety.h" 20 #include "cppwebframework_global.h" 30 class CPPWEBFRAMEWORKSHARED_EXPORT
Session 35 QAtomicInteger<qint64> sessionTimeOut;
36 QAtomicInteger<qint64> creationTime;
37 QAtomicInteger<qint64> lastAccessedTime;
38 QAtomicInteger<qint64> sessionExpirationTime;
39 QAtomicInteger<qint64> timeOut;
40 QAtomicInteger<qint8> autoClearAttributes = 0;
41 QAtomicInteger<qint8> expired = 0;
48 explicit Session(
const QString &
id, qint64 sessionTimeOut);
56 QObject *
getAttribute(
const QString &name)
const noexcept {
return attributes.value(name,
nullptr); }
60 QStringList getAttributeNames();
68 QString getId()
const;
90 inline void addAttribute(
const QString &name, QObject *value) noexcept { attributes.
insert(name, value); }
111 void setSessionTimeOut(qint64 value);
void addAttribute(const QString &name, QObject *value) noexcept
This method add an attribute to the session.
Definition: session.h:90
qint64 getLastAccessedTime() const noexcept
Returns the time of the last session access.
Definition: session.h:72
bool getAutoClearAttributes() const noexcept
getAutoClearAttributes
Definition: session.h:94
int remove(const Key &key)
This method removes a specific element given a specific key.
Definition: qmapthreadsafety.h:231
QObject * getAttribute(const QString &name) const noexcept
Returns a session attribute given a name.
Definition: session.h:56
iterator insert(const Key &key, const T &value)
This method inserts a new key and value in the map.
Definition: qmapthreadsafety.h:166
The Request class holds all information about a http request.
Definition: request.h:27
void setAutoClearAttributes(bool value) noexcept
setAutoClearAttributes
Definition: session.h:98
The HttpReadRequest class is created automatically by the CppWebServer and inserted in a QThreadPoo...
Definition: httpreadrequest.h:36
The QMapThreadSafety class is a thread safe QMap.
Definition: qmapthreadsafety.h:23
int removeAttribute(const QString &name) noexcept
Removes all the items that have the key key from the map. Returns the number of items removed which i...
Definition: session.h:86
void invalidate() noexcept
Make a invalid session.
Definition: session.h:80
The Session class holds information about a client session.
Definition: session.h:30
All classes of C++ Web Framework are contained within the namespace CWF.
Definition: configuration.h:24
qint64 getCreationTime() const noexcept
getCreationTime
Definition: session.h:64
qint64 getSessionTimeOut() const noexcept
Returns the session timeout.
Definition: session.h:106