Audacity 3.2.0
HeadersList.h
Go to the documentation of this file.
1/*!********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 @file HeadersList.h
6 @brief Declare HTTP headers list class.
7
8 Dmitry Vedenko
9 **********************************************************************/
10
11#pragma once
12
13#include <string>
14#include <vector>
15
16#include "NetworkManagerApi.h"
17
18namespace audacity
19{
20namespace network_manager
21{
22
23namespace common_headers
24{
25extern NETWORK_MANAGER_API const std::string Accept;
26extern NETWORK_MANAGER_API const std::string AcceptEncoding;
27extern NETWORK_MANAGER_API const std::string AcceptLanguage;
28extern NETWORK_MANAGER_API const std::string Authorization;
29extern NETWORK_MANAGER_API const std::string CacheControl;
30extern NETWORK_MANAGER_API const std::string Connection;
31extern NETWORK_MANAGER_API const std::string ContentEncoding;
32extern NETWORK_MANAGER_API const std::string ContentLength;
33extern NETWORK_MANAGER_API const std::string ContentType;
34extern NETWORK_MANAGER_API const std::string ContentDisposition;
35extern NETWORK_MANAGER_API const std::string Cookie;
36extern NETWORK_MANAGER_API const std::string Host;
37extern NETWORK_MANAGER_API const std::string Origin;
38extern NETWORK_MANAGER_API const std::string Referer;
39extern NETWORK_MANAGER_API const std::string UserAgent;
40extern NETWORK_MANAGER_API const std::string IfNoneMatch;
41extern NETWORK_MANAGER_API const std::string IfModifiedSince;
42} // namespace common_headers
43
44namespace common_content_types
45{
46extern NETWORK_MANAGER_API const std::string ApplicationJson;
47extern NETWORK_MANAGER_API const std::string ApplicationXml;
49extern NETWORK_MANAGER_API const std::string ApplicationXOctetStream;
50extern NETWORK_MANAGER_API const std::string ApplicationXGzip;
51extern NETWORK_MANAGER_API const std::string MultipartFormData;
52} // namespace common_content_types
54{
55 std::string Name;
56 std::string Value;
57
58 bool hasSameName (const Header& header) const;
59 bool hasSameName (const std::string& name) const;
60
61 static Header Parse (const std::string& header);
62};
63
65{
66 using HeadersStorageType = std::vector<Header>;
67public:
68 using HeadersIterator = HeadersStorageType::iterator;
69 using HeadersConstIterator = HeadersStorageType::const_iterator;
70
71 void setHeader (const Header& header);
72 void setHeader (const std::string& headerName, std::string headerValue);
73
74 void addHeader (Header header);
75 void addHeader (std::string headerName, std::string headerValue);
76
77 bool hasHeader (const std::string& headerName) const noexcept;
78
79 std::string getHeaderValue (const std::string& headerName) const;
80
81 const Header* getHeader (size_t idx) const noexcept;
82 const Header* getHeader (const std::string& name) const noexcept;
83
84 size_t getHeadersCount () const noexcept;
85
86 HeadersIterator begin () noexcept;
87 HeadersIterator end () noexcept;
88
89 HeadersConstIterator begin () const noexcept;
90 HeadersConstIterator end () const noexcept;
91private:
92 Header* getHeader (size_t idx) noexcept;
93 Header* getHeader (const std::string& headerName) noexcept;
94
96};
97
98}
99}
Declare macros for the Network Manager library DLL API.
#define NETWORK_MANAGER_API
wxString name
Definition: TagsEditor.cpp:166
std::vector< Header > HeadersStorageType
Definition: HeadersList.h:66
HeadersStorageType::iterator HeadersIterator
Definition: HeadersList.h:68
HeadersStorageType::const_iterator HeadersConstIterator
Definition: HeadersList.h:69
const char * end(const char *str) noexcept
Definition: StringUtils.h:106
const char * begin(const char *str) noexcept
Definition: StringUtils.h:101
STL namespace.