CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
Loading...
Searching...
No Matches
cmlabs::HTTPPostEntry Class Reference

One named entry of an HTTP POST body (form field or uploaded file part). More...

#include <NetworkProtocols.h>

Collaboration diagram for cmlabs::HTTPPostEntry:
[legend]

Public Member Functions

 HTTPPostEntry ()
virtual ~HTTPPostEntry ()
bool isValid ()
bool setContent (const char *content, uint32 size)
 Copy content bytes into this entry (NUL-terminated internally).

Public Attributes

std::string name
 Form field name (Content-Disposition name attribute).
std::string filename
 Original filename for file uploads (empty for plain fields).
std::string type
 MIME Content-Type of this part.
uint32 contentSize
 Size of ::content in bytes.
char * content
 Owned content bytes (NUL-terminated for convenience).

Detailed Description

One named entry of an HTTP POST body (form field or uploaded file part).

Used both when parsing multipart/form-data requests (each part becomes an entry in HTTPRequest::postEntries) and when building multipart requests (HTTPRequest::createMultipartRequest()). Owns its content buffer.

Definition at line 134 of file NetworkProtocols.h.

Constructor & Destructor Documentation

◆ HTTPPostEntry()

cmlabs::HTTPPostEntry::HTTPPostEntry ( )
inline

Definition at line 136 of file NetworkProtocols.h.

References content, and contentSize.

◆ ~HTTPPostEntry()

virtual cmlabs::HTTPPostEntry::~HTTPPostEntry ( )
inlinevirtual

Definition at line 137 of file NetworkProtocols.h.

References content.

Member Function Documentation

◆ isValid()

bool cmlabs::HTTPPostEntry::isValid ( )
inline
Returns
true when the entry has a name and non-empty content.

Definition at line 140 of file NetworkProtocols.h.

References content, contentSize, and name.

Referenced by cmlabs::HTTPRequest::parseContentChunk().

◆ setContent()

bool cmlabs::HTTPPostEntry::setContent ( const char * content,
uint32 size )
inline

Copy content bytes into this entry (NUL-terminated internally).

Parameters
contentSource bytes (copied; caller retains ownership).
sizeByte count.
Returns
true on success, false if content is NULL.

Definition at line 146 of file NetworkProtocols.h.

References content, and contentSize.

Referenced by cmlabs::HTTPRequest::parseContentChunk(), and cmlabs::HTTPRequest::parseContentParameters().

Member Data Documentation

◆ content

char* cmlabs::HTTPPostEntry::content

Owned content bytes (NUL-terminated for convenience).

Definition at line 159 of file NetworkProtocols.h.

Referenced by cmlabs::HTTPRequest::createRequest(), cmlabs::RESTHTTPCall::generateHTTPRequest(), HTTPPostEntry(), isValid(), setContent(), and ~HTTPPostEntry().

◆ contentSize

uint32 cmlabs::HTTPPostEntry::contentSize

◆ filename

std::string cmlabs::HTTPPostEntry::filename

Original filename for file uploads (empty for plain fields).

Definition at line 156 of file NetworkProtocols.h.

Referenced by cmlabs::HTTPRequest::parseContentChunk().

◆ name

std::string cmlabs::HTTPPostEntry::name

Form field name (Content-Disposition name attribute).

Definition at line 155 of file NetworkProtocols.h.

Referenced by cmlabs::RESTHTTPCall::generateHTTPRequest(), isValid(), cmlabs::HTTPRequest::parseContentChunk(), and cmlabs::HTTPRequest::parseContentParameters().

◆ type

std::string cmlabs::HTTPPostEntry::type

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