Audacity 3.2.0
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
audacity::network_manager::HeadersList Class Referencefinal

#include <HeadersList.h>

Collaboration diagram for audacity::network_manager::HeadersList:
[legend]

Public Types

using HeadersIterator = HeadersStorageType::iterator
 
using HeadersConstIterator = HeadersStorageType::const_iterator
 

Public Member Functions

void setHeader (const Header &header)
 
void setHeader (const std::string &headerName, std::string headerValue)
 
void addHeader (Header header)
 
void addHeader (std::string headerName, std::string headerValue)
 
bool hasHeader (const std::string &headerName) const noexcept
 
std::string getHeaderValue (const std::string &headerName) const
 
const HeadergetHeader (size_t idx) const noexcept
 
const HeadergetHeader (const std::string &name) const noexcept
 
size_t getHeadersCount () const noexcept
 
HeadersIterator begin () noexcept
 
HeadersIterator end () noexcept
 
HeadersConstIterator begin () const noexcept
 
HeadersConstIterator end () const noexcept
 

Private Types

using HeadersStorageType = std::vector< Header >
 

Private Member Functions

HeadergetHeader (size_t idx) noexcept
 
HeadergetHeader (const std::string &headerName) noexcept
 

Private Attributes

HeadersStorageType mHeaders
 

Detailed Description

Definition at line 64 of file HeadersList.h.

Member Typedef Documentation

◆ HeadersConstIterator

using audacity::network_manager::HeadersList::HeadersConstIterator = HeadersStorageType::const_iterator

Definition at line 69 of file HeadersList.h.

◆ HeadersIterator

using audacity::network_manager::HeadersList::HeadersIterator = HeadersStorageType::iterator

Definition at line 68 of file HeadersList.h.

◆ HeadersStorageType

Definition at line 66 of file HeadersList.h.

Member Function Documentation

◆ addHeader() [1/2]

void HeadersList::addHeader ( Header  header)

Definition at line 109 of file HeadersList.cpp.

110{
111 addHeader (std::move (header.Name), std::move (header.Value));
112}

References addHeader(), audacity::network_manager::Header::Name, and audacity::network_manager::Header::Value.

Referenced by addHeader().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addHeader() [2/2]

void HeadersList::addHeader ( std::string  headerName,
std::string  headerValue 
)

Definition at line 114 of file HeadersList.cpp.

115{
116 mHeaders.push_back ({ std::move (headerName), std::move (headerValue) });
117}

References mHeaders.

◆ begin() [1/2]

HeadersList::HeadersConstIterator HeadersList::begin ( ) const
noexcept

Definition at line 159 of file HeadersList.cpp.

160{
161 return mHeaders.begin ();
162}

References mHeaders.

◆ begin() [2/2]

HeadersList::HeadersIterator HeadersList::begin ( )
noexcept

Definition at line 149 of file HeadersList.cpp.

150{
151 return mHeaders.begin ();
152}

References mHeaders.

◆ end() [1/2]

HeadersList::HeadersConstIterator HeadersList::end ( ) const
noexcept

Definition at line 164 of file HeadersList.cpp.

165{
166 return mHeaders.end ();
167}

References mHeaders.

◆ end() [2/2]

HeadersList::HeadersIterator HeadersList::end ( )
noexcept

Definition at line 154 of file HeadersList.cpp.

155{
156 return mHeaders.end ();
157}

References mHeaders.

◆ getHeader() [1/4]

Header * HeadersList::getHeader ( const std::string &  headerName)
privatenoexcept

Definition at line 177 of file HeadersList.cpp.

178{
179 for (Header& header : mHeaders)
180 {
181 if (header.hasSameName (headerName))
182 return &header;
183 }
184
185 return nullptr;
186}
A string pair, representing HTTP header.

◆ getHeader() [2/4]

const Header * HeadersList::getHeader ( const std::string &  name) const
noexcept

Definition at line 139 of file HeadersList.cpp.

140{
141 return const_cast<HeadersList*>(this)->getHeader (name);
142}
wxString name
Definition: TagsEditor.cpp:166
A class, representing a list of HTTP headers.
const Header * getHeader(size_t idx) const noexcept

References name.

◆ getHeader() [3/4]

const Header * HeadersList::getHeader ( size_t  idx) const
noexcept

Definition at line 134 of file HeadersList.cpp.

135{
136 return const_cast<HeadersList*>(this)->getHeader (idx);
137}

Referenced by getHeaderValue(), and setHeader().

Here is the caller graph for this function:

◆ getHeader() [4/4]

Header * HeadersList::getHeader ( size_t  idx)
privatenoexcept

Definition at line 169 of file HeadersList.cpp.

170{
171 if (idx < mHeaders.size ())
172 return &mHeaders[idx];
173
174 return nullptr;
175}

◆ getHeadersCount()

size_t HeadersList::getHeadersCount ( ) const
noexcept

Definition at line 144 of file HeadersList.cpp.

145{
146 return mHeaders.size ();
147}

References mHeaders.

◆ getHeaderValue()

std::string HeadersList::getHeaderValue ( const std::string &  headerName) const

Definition at line 124 of file HeadersList.cpp.

125{
126 const Header* header = getHeader (headerName);
127
128 if (header != nullptr)
129 return header->Value;
130
131 return {};
132}

References getHeader(), and audacity::network_manager::Header::Value.

Referenced by audacity::network_manager::CurlResponse::getHeader(), and audacity::network_manager::Request::getHeader().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasHeader()

bool HeadersList::hasHeader ( const std::string &  headerName) const
noexcept

Definition at line 119 of file HeadersList.cpp.

120{
121 return getHeader (headerName) != nullptr;
122}

◆ setHeader() [1/2]

void HeadersList::setHeader ( const Header header)

Definition at line 94 of file HeadersList.cpp.

95{
96 setHeader (header.Name, header.Value);
97}
void setHeader(const Header &header)
Definition: HeadersList.cpp:94

References audacity::network_manager::Header::Name, setHeader(), and audacity::network_manager::Header::Value.

Referenced by setHeader(), audacity::network_manager::MultipartData::Part::SetHeader(), and audacity::network_manager::Request::setHeader().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setHeader() [2/2]

void HeadersList::setHeader ( const std::string &  headerName,
std::string  headerValue 
)

Definition at line 99 of file HeadersList.cpp.

100{
101 Header* item = getHeader (headerName);
102
103 if (item != nullptr)
104 item->Value = std::move (headerValue);
105 else
106 mHeaders.push_back ({ headerName, std::move (headerValue) });
107}

References getHeader(), mHeaders, and audacity::network_manager::Header::Value.

Here is the call graph for this function:

Member Data Documentation

◆ mHeaders

HeadersStorageType audacity::network_manager::HeadersList::mHeaders
private

Definition at line 95 of file HeadersList.h.

Referenced by addHeader(), begin(), end(), getHeadersCount(), and setHeader().


The documentation for this class was generated from the following files: