Audacity 3.2.0
CookiesList.h
Go to the documentation of this file.
1/*!********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 @file CookiesList.h
6 @brief Define HTTP cookies list class.
7
8 Dmitry Vedenko
9 **********************************************************************/
10
11#pragma once
12
13#include <string>
14#include <vector>
15#include <chrono>
16
17#include "NetworkManagerApi.h"
18
19namespace audacity
20{
21namespace network_manager
22{
23
24using ExpiresTime = std::chrono::system_clock::time_point;
25
27{
28 std::string Name;
29 std::string Value;
30
31 ExpiresTime Expires {};
32
33 static Cookie Parse (const std::string& cookieString);
34
35 bool isSession () const noexcept;
36 bool isExpired () const noexcept;
37
38 std::string toString(bool fullString) const;
39};
40
42{
43 using CookiesStorageType = std::vector<Cookie>;
44public:
45 using CookiesIterator = CookiesStorageType::iterator;
46 using CookiesConstIterator = CookiesStorageType::const_iterator;
47
48 void setCookie (const Cookie& cookie);
49 void setCookie (const std::string& cookieName, std::string cookieValue);
50
51 void addCookie (Cookie cookie);
52 void addCookie (std::string cookieName, std::string cookieValue);
53
54 bool hasCookie (const std::string& cookieName) const noexcept;
55
56 std::string getCookieValue (const std::string& cookieName) const;
57
58 const Cookie* getCookie (size_t idx) const noexcept;
59 const Cookie* getCookie (const std::string& name) const noexcept;
60
61 size_t getCookiesCount () const noexcept;
62
63 std::string getCookiesString () const;
64
65 CookiesIterator begin () noexcept;
66 CookiesIterator end () noexcept;
67
68 CookiesConstIterator begin () const noexcept;
69 CookiesConstIterator end () const noexcept;
70private:
71 Cookie* getCookie (size_t idx) noexcept;
72 Cookie* getCookie (const std::string& cookieName) noexcept;
73
75};
76
77}
78}
Declare macros for the Network Manager library DLL API.
#define NETWORK_MANAGER_API
wxString name
Definition: TagsEditor.cpp:166
CookiesStorageType::const_iterator CookiesConstIterator
Definition: CookiesList.h:46
CookiesStorageType::iterator CookiesIterator
Definition: CookiesList.h:45
std::vector< Cookie > CookiesStorageType
Definition: CookiesList.h:43
std::chrono::system_clock::time_point ExpiresTime
Definition: CookiesList.h:24
const char * end(const char *str) noexcept
Definition: StringUtils.h:106
const char * begin(const char *str) noexcept
Definition: StringUtils.h:101
STL namespace.