Stores a form data entry sent or received during an HTTP request. More...
Public Member Functions | |
BHttpFormData (const BString &name, const BPath &file) | |
Construct a BHttpFormData object which value is a file contents. | |
BHttpFormData (const BString &name, const BString &value) | |
Construct a BHttpFormData object with a string value. | |
BHttpFormData (const BString &name, const void *buffer, ssize_t size) | |
Construct a BHttpFormData object which value is a binary buffer. | |
const void * | Buffer () const |
Get a pointer to the data of a form field. More... | |
ssize_t | BufferSize () const |
Get the buffer size. More... | |
status_t | CopyBuffer () |
Make a copy of the internal buffer. More... | |
const BPath & | File () const |
Get the file path of a form field. More... | |
const BString & | Filename () const |
bool | InitCheck () const |
Checks the initialization of the object. More... | |
bool | IsFile () const |
status_t | MarkAsFile (const BString &filename, const BString &mimeType="") |
Mark a field as a file. | |
const BString & | MimeType () const |
const BString & | Name () const |
Get the form field name. | |
BHttpFormData & | operator= (const BHttpFormData &other) |
Assignment operator. | |
const BString & | String () const |
Get the string value of a form field. More... | |
form_content_type | Type () const |
void | UnmarkAsFile () |
Unmark a field as a file. | |
Stores a form data entry sent or received during an HTTP request.
Each element in a form is stored in an instance of this class. The values can be either strings, arbitrary binary buffers, or a pointer to a file.
The latter allows reading data from the file as it is being sent through the network, removing hte need to buffer the whole file contents in memory.
const void * BHttpFormData::Buffer | ( | ) | const |
Get a pointer to the data of a form field.
ssize_t BHttpFormData::BufferSize | ( | ) | const |
Get the buffer size.
status_t BHttpFormData::CopyBuffer | ( | ) |
Make a copy of the internal buffer.
The constructor for buffer-based fields does not copy the data given to it, it just keeps a pointer. If you want to retain ownership of the data, call this method so the buffer copies and releases it.
const BPath & BHttpFormData::File | ( | ) | const |
Get the file path of a form field.
const BString & BHttpFormData::Filename | ( | ) | const |
bool BHttpFormData::InitCheck | ( | void | ) | const |
Checks the initialization of the object.
false
if attempting to construct a BHttpFormData with a NULL
buffer. bool BHttpFormData::IsFile | ( | ) | const |
true
if the field data is a file. const BString & BHttpFormData::MimeType | ( | ) | const |
const BString & BHttpFormData::String | ( | ) | const |
Get the string value of a form field.
form_content_type BHttpFormData::Type | ( | ) | const |