Split VWeb into smaller headers
We have no make install support... so we don't need to have everything as a single-header and lib file.
This commit is contained in:
parent
4367534a33
commit
5bb68a7d02
1 changed files with 902 additions and 685 deletions
35
Includes/Cookie.h
Normal file
35
Includes/Cookie.h
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace VWeb {
|
||||
enum class CookieSameSite { Invalid = 0, Strict, Lax, None };
|
||||
struct Cookie {
|
||||
std::string Name{};
|
||||
std::string Value{};
|
||||
std::string Expires{};
|
||||
int MaxAge{};
|
||||
std::string Domain{};
|
||||
std::string Path{"/"};
|
||||
bool Secure{};
|
||||
bool HttpOnly{};
|
||||
CookieSameSite SameSite{CookieSameSite::Strict};
|
||||
bool IsOld = false;
|
||||
};
|
||||
struct Cookies {
|
||||
public:
|
||||
void Remove(const std::string &name);
|
||||
bool Has(const std::string &name) const;
|
||||
Cookie &Get(const std::string &name) { return Data[name]; };
|
||||
std::string TransformToHeader();
|
||||
void CreateCookieFromString(const std::string &data);
|
||||
void CreateOld(const std::string &name, const std::string &value);
|
||||
|
||||
std::unordered_map<std::string, Cookie> Data;
|
||||
Cookie &operator[](const std::string &name) { return Data[name]; }
|
||||
|
||||
protected:
|
||||
static void CookieToString(std::stringstream &stream, Cookie &cookie);
|
||||
};
|
||||
} // namespace VWeb
|
||||
Loading…
Reference in a new issue