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

#include <MultipartData.h>

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

Classes

class  Part
 

Public Member Functions

 MultipartData ()=default
 
 MultipartData (const MultipartData &)=delete
 
MultipartDataoperator= (const MultipartData &)=delete
 
void Add (std::string_view name, std::string_view value)
 
void Add (std::string_view name, std::string_view contentType, const void *value, size_t size)
 
void AddFile (std::string_view name, std::string_view contentType, const wxFileName &fileName)
 
size_t GetPartsCount () const
 
PartGetPart (size_t idx)
 
const PartGetPart (size_t idx) const
 
bool IsEmpty () const
 

Private Attributes

std::vector< std::unique_ptr< Part > > mParts
 

Detailed Description

Definition at line 26 of file MultipartData.h.

Constructor & Destructor Documentation

◆ MultipartData() [1/2]

audacity::network_manager::MultipartData::MultipartData ( )
default

◆ MultipartData() [2/2]

audacity::network_manager::MultipartData::MultipartData ( const MultipartData )
delete

Member Function Documentation

◆ Add() [1/2]

void audacity::network_manager::MultipartData::Add ( std::string_view  name,
std::string_view  contentType,
const void *  value,
size_t  size 
)

Definition at line 186 of file MultipartData.cpp.

189{
190 mParts.emplace_back(std::make_unique<ByteBufferPart>(value, size));
191
192 mParts.back()->SetContentDisposition("form-data; name=\"" + std::string(name) + "\"");
193
194 if (!contentType.empty())
195 mParts.back()->SetContentType(std::string(contentType));
196}
wxString name
Definition: TagsEditor.cpp:166
std::vector< std::unique_ptr< Part > > mParts
Definition: MultipartData.h:68

References mParts, name, and size.

◆ Add() [2/2]

void audacity::network_manager::MultipartData::Add ( std::string_view  name,
std::string_view  value 
)

Definition at line 181 of file MultipartData.cpp.

182{
183 Add(name, {}, value.data(), value.length());
184}
void Add(std::string_view name, std::string_view value)

References Add(), and name.

Referenced by Add().

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

◆ AddFile()

void audacity::network_manager::MultipartData::AddFile ( std::string_view  name,
std::string_view  contentType,
const wxFileName &  fileName 
)

Definition at line 198 of file MultipartData.cpp.

201{
202 mParts.emplace_back(std::make_unique<FilePart>(fileName));
203
204 mParts.back()->SetContentDisposition(
205 "form-data; name=\"" + std::string(name) + "\"; filename=\"" +
206 fileName.GetFullName().ToUTF8().data() + "\"");
207
208 if (!contentType.empty())
209 mParts.back()->SetContentType(std::string(contentType));
210}

References mParts, and name.

◆ GetPart() [1/2]

MultipartData::Part * audacity::network_manager::MultipartData::GetPart ( size_t  idx)

Definition at line 217 of file MultipartData.cpp.

218{
219 if (idx < mParts.size())
220 return mParts[idx].get();
221
222 return nullptr;
223}

References mParts.

◆ GetPart() [2/2]

const MultipartData::Part * audacity::network_manager::MultipartData::GetPart ( size_t  idx) const

Definition at line 225 of file MultipartData.cpp.

226{
227 if (idx < mParts.size())
228 return mParts[idx].get();
229
230 return nullptr;
231}

References mParts.

◆ GetPartsCount()

size_t audacity::network_manager::MultipartData::GetPartsCount ( ) const

Definition at line 212 of file MultipartData.cpp.

213{
214 return mParts.size();
215}

References mParts.

◆ IsEmpty()

bool audacity::network_manager::MultipartData::IsEmpty ( ) const

Definition at line 233 of file MultipartData.cpp.

234{
235 return mParts.empty();
236}

References mParts.

◆ operator=()

MultipartData & audacity::network_manager::MultipartData::operator= ( const MultipartData )
delete

Member Data Documentation

◆ mParts

std::vector<std::unique_ptr<Part> > audacity::network_manager::MultipartData::mParts
private

Definition at line 68 of file MultipartData.h.

Referenced by Add(), AddFile(), GetPart(), GetPartsCount(), and IsEmpty().


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