Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pistache
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
pistache
Commits
80eac335
Unverified
Commit
80eac335
authored
Oct 10, 2018
by
hasankandemir1993
Committed by
GitHub
Oct 10, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update cookie.h
parent
ce27e753
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
27 deletions
+27
-27
include/pistache/cookie.h
include/pistache/cookie.h
+27
-27
No files found.
include/pistache/cookie.h
View file @
80eac335
...
...
@@ -43,67 +43,67 @@ struct Cookie {
class
CookieJar
{
public:
typedef
std
::
unordered_map
<
std
::
string
,
Cookie
>
HashMapCookies
;
// "value" -> Cookie
typedef
std
::
unordered_map
<
std
::
string
,
HashMapCookies
>
Storage
;
// "name" -> Hashmap("value" -> Cookie)
using
HashMapCookies
=
std
::
unordered_map
<
std
::
string
,
Cookie
>
;
// "value" -> Cookie
using
Storage
=
std
::
unordered_map
<
std
::
string
,
HashMapCookies
>
;
// "name" -> Hashmap("value" -> Cookie)
struct
iterator
:
std
::
iterator
<
std
::
bidirectional_iterator_tag
,
Cookie
>
{
iterator
(
const
Storage
::
const_iterator
&
_iterator
)
:
it
_
(
_iterator
)
{
:
it
er_storage
(
_iterator
)
{
}
iterator
(
const
Storage
::
const_iterator
&
_iterator
,
const
Storage
::
const_iterator
&
end
)
:
it
_
(
_iterator
),
end_
(
end
)
:
it
er_storage
(
_iterator
),
iter_storage_end
(
end
)
{
if
(
it
_
!=
end_
)
{
it
_2
=
it_
->
second
.
begin
();
if
(
it
er_storage
!=
iter_storage_end
)
{
it
er_cookie_values
=
iter_storage
->
second
.
begin
();
}
}
Cookie
operator
*
()
const
{
return
it
_2
->
second
;
// return it_
->second;
return
it
er_cookie_values
->
second
;
// return iter_storage
->second;
}
iterator
operator
++
()
{
++
it
_2
;
if
(
it
_2
==
it_
->
second
.
end
())
{
++
it
_
;
if
(
it
_
!=
end_
)
it
_2
=
it_
->
second
.
begin
();
++
it
er_cookie_values
;
if
(
it
er_cookie_values
==
iter_storage
->
second
.
end
())
{
++
it
er_storage
;
if
(
it
er_storage
!=
iter_storage_end
)
it
er_cookie_values
=
iter_storage
->
second
.
begin
();
}
return
iterator
(
it
_
,
end_
);
return
iterator
(
it
er_storage
,
iter_storage_end
);
}
iterator
operator
++
(
int
)
{
iterator
ret
(
it
_
,
end_
);
++
it
_2
;
if
(
it
_2
==
it_
->
second
.
end
())
{
++
it
_
;
if
(
it
_
!=
end_
)
// this check is important
it
_2
=
it_
->
second
.
begin
();
iterator
ret
(
it
er_storage
,
iter_storage_end
);
++
it
er_cookie_values
;
if
(
it
er_cookie_values
==
iter_storage
->
second
.
end
())
{
++
it
er_storage
;
if
(
it
er_storage
!=
iter_storage_end
)
// this check is important
it
er_cookie_values
=
iter_storage
->
second
.
begin
();
}
return
ret
;
}
bool
operator
!=
(
iterator
other
)
const
{
return
it
_
!=
other
.
it_
;
return
it
er_storage
!=
other
.
iter_storage
;
}
bool
operator
==
(
iterator
other
)
const
{
return
it
_
==
other
.
it_
;
return
it
er_storage
==
other
.
iter_storage
;
}
private:
Storage
::
const_iterator
it
_
;
HashMapCookies
::
const_iterator
it
_2
;
Storage
::
const_iterator
end_
;
// we need to know where main hashmap ends.
Storage
::
const_iterator
it
er_storage
;
HashMapCookies
::
const_iterator
it
er_cookie_values
;
Storage
::
const_iterator
iter_storage_end
;
// we need to know where main hashmap ends.
};
CookieJar
();
void
add
(
const
Cookie
&
cookie
);
void
removeCookie
(
const
std
::
string
&
name
);
//
ADDED LATER
void
removeCookie
(
const
std
::
string
&
name
);
//
Unimplemented
void
addFromRaw
(
const
char
*
str
,
size_t
len
);
Cookie
get
(
const
std
::
string
&
name
)
const
;
...
...
@@ -111,7 +111,7 @@ public:
bool
has
(
const
std
::
string
&
name
)
const
;
iterator
begin
()
const
{
return
iterator
(
cookies
.
begin
(),
cookies
.
end
());
return
iterator
(
cookies
.
begin
(),
cookies
.
end
());
}
iterator
end
()
const
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment