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

#include <CookiesList.h>

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

Public Types

using CookiesIterator = CookiesStorageType::iterator
 
using CookiesConstIterator = CookiesStorageType::const_iterator
 

Public Member Functions

void setCookie (const Cookie &cookie)
 
void setCookie (const std::string &cookieName, std::string cookieValue)
 
void addCookie (Cookie cookie)
 
void addCookie (std::string cookieName, std::string cookieValue)
 
bool hasCookie (const std::string &cookieName) const noexcept
 
std::string getCookieValue (const std::string &cookieName) const
 
const CookiegetCookie (size_t idx) const noexcept
 
const CookiegetCookie (const std::string &name) const noexcept
 
size_t getCookiesCount () const noexcept
 
std::string getCookiesString () const
 
CookiesIterator begin () noexcept
 
CookiesIterator end () noexcept
 
CookiesConstIterator begin () const noexcept
 
CookiesConstIterator end () const noexcept
 

Private Types

using CookiesStorageType = std::vector< Cookie >
 

Private Member Functions

CookiegetCookie (size_t idx) noexcept
 
CookiegetCookie (const std::string &cookieName) noexcept
 

Private Attributes

CookiesStorageType mCookies
 

Detailed Description

Definition at line 41 of file CookiesList.h.

Member Typedef Documentation

◆ CookiesConstIterator

using audacity::network_manager::CookiesList::CookiesConstIterator = CookiesStorageType::const_iterator

Definition at line 46 of file CookiesList.h.

◆ CookiesIterator

using audacity::network_manager::CookiesList::CookiesIterator = CookiesStorageType::iterator

Definition at line 45 of file CookiesList.h.

◆ CookiesStorageType

Definition at line 43 of file CookiesList.h.

Member Function Documentation

◆ addCookie() [1/2]

void CookiesList::addCookie ( Cookie  cookie)

Definition at line 120 of file CookiesList.cpp.

121{
122 addCookie (std::move (cookie.Name), std::move (cookie.Value));
123}

References addCookie(), audacity::network_manager::Cookie::Name, and audacity::network_manager::Cookie::Value.

Referenced by addCookie().

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

◆ addCookie() [2/2]

void CookiesList::addCookie ( std::string  cookieName,
std::string  cookieValue 
)

Definition at line 125 of file CookiesList.cpp.

126{
127 mCookies.push_back ({ std::move (cookieName), std::move (cookieValue) });
128}

References mCookies.

◆ begin() [1/2]

CookiesList::CookiesConstIterator CookiesList::begin ( ) const
noexcept

Definition at line 185 of file CookiesList.cpp.

186{
187 return mCookies.begin ();
188}

References mCookies.

◆ begin() [2/2]

CookiesList::CookiesIterator CookiesList::begin ( )
noexcept

Definition at line 175 of file CookiesList.cpp.

176{
177 return mCookies.begin ();
178}

References mCookies.

◆ end() [1/2]

CookiesList::CookiesConstIterator CookiesList::end ( ) const
noexcept

Definition at line 190 of file CookiesList.cpp.

191{
192 return mCookies.end ();
193}

References mCookies.

◆ end() [2/2]

CookiesList::CookiesIterator CookiesList::end ( )
noexcept

Definition at line 180 of file CookiesList.cpp.

181{
182 return mCookies.end ();
183}

References mCookies.

◆ getCookie() [1/4]

Cookie * CookiesList::getCookie ( const std::string &  cookieName)
privatenoexcept

Definition at line 203 of file CookiesList.cpp.

204{
205 for (Cookie& cookie : mCookies)
206 {
207 if (cookie.Name == cookieName)
208 return &cookie;
209 }
210
211 return nullptr;
212}

◆ getCookie() [2/4]

const Cookie * CookiesList::getCookie ( const std::string &  name) const
noexcept

Definition at line 150 of file CookiesList.cpp.

151{
152 return const_cast<CookiesList*>(this)->getCookie (name);
153}
wxString name
Definition: TagsEditor.cpp:166
A class, representing a list of HTTP cookies.
const Cookie * getCookie(size_t idx) const noexcept

References name.

◆ getCookie() [3/4]

const Cookie * CookiesList::getCookie ( size_t  idx) const
noexcept

Definition at line 145 of file CookiesList.cpp.

146{
147 return const_cast<CookiesList*>(this)->getCookie(idx);
148}

Referenced by getCookieValue(), and setCookie().

Here is the caller graph for this function:

◆ getCookie() [4/4]

Cookie * CookiesList::getCookie ( size_t  idx)
privatenoexcept

Definition at line 195 of file CookiesList.cpp.

196{
197 if (idx < mCookies.size ())
198 return &mCookies[idx];
199
200 return nullptr;
201}

◆ getCookiesCount()

size_t CookiesList::getCookiesCount ( ) const
noexcept

Definition at line 155 of file CookiesList.cpp.

156{
157 return mCookies.size ();
158}

References mCookies.

◆ getCookiesString()

std::string CookiesList::getCookiesString ( ) const

Definition at line 160 of file CookiesList.cpp.

161{
162 std::string result;
163
164 for (const Cookie& cookie : mCookies)
165 {
166 if (!result.empty ())
167 result.push_back (';');
168
169 result += cookie.Name + "=" + cookie.Value;
170 }
171
172 return result;
173}

References mCookies.

◆ getCookieValue()

std::string CookiesList::getCookieValue ( const std::string &  cookieName) const

Definition at line 135 of file CookiesList.cpp.

136{
137 const Cookie* item = getCookie (cookieName);
138
139 if (item != nullptr)
140 return item->Value;
141
142 return {};
143}

References getCookie(), and audacity::network_manager::Cookie::Value.

Referenced by audacity::network_manager::Request::getCookie().

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

◆ hasCookie()

bool CookiesList::hasCookie ( const std::string &  cookieName) const
noexcept

Definition at line 130 of file CookiesList.cpp.

131{
132 return getCookie (cookieName) != nullptr;
133}

◆ setCookie() [1/2]

void CookiesList::setCookie ( const Cookie cookie)

Definition at line 105 of file CookiesList.cpp.

106{
107 setCookie (cookie.Name, cookie.Value);
108}
void setCookie(const Cookie &cookie)

References audacity::network_manager::Cookie::Name, setCookie(), and audacity::network_manager::Cookie::Value.

Referenced by audacity::network_manager::Request::appendCookies(), setCookie(), and audacity::network_manager::Request::setCookie().

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

◆ setCookie() [2/2]

void CookiesList::setCookie ( const std::string &  cookieName,
std::string  cookieValue 
)

Definition at line 110 of file CookiesList.cpp.

111{
112 Cookie* item = getCookie (cookieName);
113
114 if (item != nullptr)
115 item->Value = std::move (cookieValue);
116 else
117 mCookies.push_back ({ cookieName, std::move (cookieValue) });
118}

References getCookie(), mCookies, and audacity::network_manager::Cookie::Value.

Here is the call graph for this function:

Member Data Documentation

◆ mCookies

CookiesStorageType audacity::network_manager::CookiesList::mCookies
private

Definition at line 74 of file CookiesList.h.

Referenced by addCookie(), begin(), end(), getCookiesCount(), getCookiesString(), and setCookie().


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