2021-08-04 20:32:51 +02:00
|
|
|
#ifndef HTTP_SESSION_H
|
|
|
|
#define HTTP_SESSION_H
|
|
|
|
|
2022-01-09 14:32:09 +01:00
|
|
|
#include <map>
|
2021-11-01 19:11:27 +01:00
|
|
|
|
2021-08-22 22:03:10 +02:00
|
|
|
#include "core/reference.h"
|
2021-08-04 20:32:51 +02:00
|
|
|
|
2022-01-09 14:32:09 +01:00
|
|
|
#include "core/string.h"
|
|
|
|
#include "core/variant.h"
|
|
|
|
#include "core/threading/mutex.h"
|
|
|
|
|
|
|
|
|
|
|
|
class HTTPSession : public Reference {
|
|
|
|
RCPP_OBJECT(HTTPSession, Reference);
|
2022-01-08 10:04:12 +01:00
|
|
|
|
2021-08-04 20:32:51 +02:00
|
|
|
public:
|
2022-01-09 14:32:09 +01:00
|
|
|
void add(const String &key, const Variant &value);
|
|
|
|
void remove(const String &key);
|
|
|
|
bool has(const String &key);
|
2021-08-04 20:32:51 +02:00
|
|
|
|
2022-01-09 14:32:09 +01:00
|
|
|
Variant get(const String &key);
|
2022-01-09 14:51:04 +01:00
|
|
|
const Variant &get_const(const String &key);
|
2022-01-09 14:32:09 +01:00
|
|
|
Object *get_object(const String &key);
|
2021-11-01 19:11:27 +01:00
|
|
|
Ref<Reference> get_reference(const String &key);
|
|
|
|
int get_int(const String &key);
|
2021-08-04 20:32:51 +02:00
|
|
|
|
2021-11-01 19:11:27 +01:00
|
|
|
String session_id;
|
2021-08-22 23:53:26 +02:00
|
|
|
int id;
|
2021-08-04 20:32:51 +02:00
|
|
|
|
|
|
|
void clear();
|
|
|
|
void reset();
|
|
|
|
|
2022-01-09 14:32:09 +01:00
|
|
|
std::map<String, Variant> *get_data();
|
2021-08-22 23:53:26 +02:00
|
|
|
|
2021-08-04 20:32:51 +02:00
|
|
|
HTTPSession();
|
|
|
|
~HTTPSession();
|
|
|
|
|
|
|
|
protected:
|
2022-01-09 14:32:09 +01:00
|
|
|
Mutex _mutex;
|
2021-08-04 20:32:51 +02:00
|
|
|
|
2022-01-09 14:32:09 +01:00
|
|
|
std::map<String, Variant> _data;
|
2021-08-04 20:32:51 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|