ZenLib
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
ZenLib
Format
Http
Http_Cookies.h
Go to the documentation of this file.
1
// ZenLib::Format::Http::Cookies - Cookies handling
2
// Copyright (C) 2008-2011 MediaArea.net SARL, Info@MediaArea.net
3
//
4
// This software is provided 'as-is', without any express or implied
5
// warranty. In no event will the authors be held liable for any damages
6
// arising from the use of this software.
7
//
8
// Permission is granted to anyone to use this software for any purpose,
9
// including commercial applications, and to alter it and redistribute it
10
// freely, subject to the following restrictions:
11
//
12
// 1. The origin of this software must not be misrepresented; you must not
13
// claim that you wrote the original software. If you use this software
14
// in a product, an acknowledgment in the product documentation would be
15
// appreciated but is not required.
16
// 2. Altered source versions must be plainly marked as such, and must not be
17
// misrepresented as being the original software.
18
// 3. This notice may not be removed or altered from any source distribution.
19
//
20
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
21
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
22
//
23
// Cookies handling
24
//
25
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
26
27
//---------------------------------------------------------------------------
28
#ifndef ZenLib_Format_Http_CookiesH
29
#define ZenLib_Format_Http_CookiesH
30
//---------------------------------------------------------------------------
31
32
//---------------------------------------------------------------------------
33
#include <string>
34
#include <ctime>
35
#include <map>
36
#include <sstream>
37
//---------------------------------------------------------------------------
38
39
namespace
ZenLib
40
{
41
42
namespace
Format
43
{
44
45
namespace
Http
46
{
47
48
//***************************************************************************
49
/// @brief
50
//***************************************************************************
51
52
struct
Cookie
53
{
54
std::string
Value
;
55
std::time_t
Expires
;
56
std::string
Path
;
57
std::string
Domain
;
58
bool
Secure
;
59
60
Cookie
()
61
{
62
Expires
=0;
63
Secure
=
false
;
64
}
65
};
66
67
extern
std::string
EmptyString
;
//Must not change
68
69
class
Cookies
:
public
std::map<std::string, Cookie>
70
{
71
public
:
72
//Constructor/Destructor
73
Cookies
();
74
75
//Helpers
76
size_t
Set
(
const
std::string &Name,
const
std::string &Value=
EmptyString
, std::time_t Expires=(std::time_t)-1,
const
std::string &Path=
EmptyString
,
const
std::string &Domain=
EmptyString
,
bool
Secure=
false
);
77
Cookie
&
Get
(
const
std::string &Name);
78
void
Create_Lines
(std::ostream& Out);
79
};
80
81
}
//Namespace
82
83
}
//Namespace
84
85
}
//Namespace
86
87
#endif
88
89
90
91
Generated by
1.8.1