The class eases the building of a MIME section.
More...
#include <ms_http_client_mime.hpp>
List of all members.
Public Member Functions |
virtual | ~ms_http_client_mime () |
| Destructor. HTTP Communication to a Mascot Server.
|
void | append (const std::string &name, const std::string &value) |
| Adds a name-value pair element to the end of the MIME string.
|
void | appendFile (const std::string &name, const std::string &filename, const std::string &contentType, const std::string &prefixData="") |
| Adds a name-value pair element with a filename attribute to the end of the MIME string.
|
void | erase (int oneBasedIndex) |
| Remove an element.
|
std::string | format (const std::string &boundary, matrix_science::ms_http_client_mime::Continuation continuation) const |
| Gets the complete MIME string.
|
int | getCount () const |
| Returns the number of items.
|
std::string | getFilename (int oneBasedIndex) const |
| Returns the filename attribute of an item.
|
std::string | getName (int oneBasedIndex) const |
| Returns the name of an item.
|
std::string | getValue (int oneBasedIndex) const |
| Returns the value of an item.
|
bool | hasFilename (int oneBasedIndex) const |
| Returns true if the item has a filename attribute.
|
void | setValue (int oneBasedIndex, const std::string &value) |
| Change the value of an element.
|
void | setValueWithFilename (int oneBasedIndex, const std::string &value, const std::string &filename, const std::string &contentType) |
| Change the value of an element and set a filename attribute on it.
|
Static Public Member Functions |
static std::string | formatHeader (const std::string &boundary, ContentType contentType) |
| Gets the MIME header string.
|
Detailed Description
The class eases the building of a MIME section.
Each element can be added individually as a name-value pair. The MIME content text can then be retrieved.
The text can have a MIME terminator added, as required.
The boundary string can be changed if desired.
Constructor & Destructor Documentation
Member Function Documentation
void append |
( |
const std::string & |
name, |
|
|
const std::string & |
value |
|
) |
| |
Adds a name-value pair element to the end of the MIME string.
- Parameters:
-
name | The name of the item. |
value | The value of the item. |
void appendFile |
( |
const std::string & |
name, |
|
|
const std::string & |
filename, |
|
|
const std::string & |
contentType, |
|
|
const std::string & |
prefixData = "" |
|
) |
| |
Adds a name-value pair element with a filename attribute to the end of the MIME string.
- Parameters:
-
name | The name of the item. |
filename | The filename specified for the item. |
contentType | The MIME type string for the type of content (e.g. "text/xml"). |
prefixData | The filename specified for the item. Data added to the start of the file. Optional. |
void erase |
( |
int |
oneBasedIndex ) |
|
Remove an element.
- Parameters:
-
oneBasedIndex | The index is 1..Count() inclusive (not zero based). |
std::string format |
( |
const std::string & |
boundary, |
|
|
matrix_science::ms_http_client_mime::Continuation |
continuation |
|
) |
| const |
Gets the complete MIME string.
- Parameters:
-
boundary | The string to be used as a separator between MIME sections. |
continuation | Indicates whether the MIME content will be continued after this section, or whether the MIME terminates here (and should have a terminator boundary appended). |
- Returns:
- The formatted MIME text.
std::string formatHeader |
( |
const std::string & |
boundary, |
|
|
ContentType |
contentType |
|
) |
| [static] |
Gets the MIME header string.
The header consists of a content type and a boundary.
For example, "Content-Type: multipart/mixed; boundary=----------MascotMimeContent"
- Parameters:
-
boundary | The string to be used as a separator between MIME sections. |
contentType | The type of content in the MIME; typically "multipart/form-data" or "multipart/mixed". |
- Returns:
- formatted header
Returns the number of items.
- Returns:
- The number of items present.
std::string getFilename |
( |
int |
oneBasedIndex ) |
const |
Returns the filename attribute of an item.
- Parameters:
-
oneBasedIndex | The index is 1..Count() inclusive (not zero based). |
- Returns:
- file name from index
std::string getName |
( |
int |
oneBasedIndex ) |
const |
Returns the name of an item.
- Parameters:
-
oneBasedIndex | The index is 1..Count() inclusive (not zero based). |
- Returns:
- name from index
std::string getValue |
( |
int |
oneBasedIndex ) |
const |
Returns the value of an item.
- Parameters:
-
oneBasedIndex | The index is 1..Count() inclusive (not zero based). |
- Returns:
- value from index
bool hasFilename |
( |
int |
oneBasedIndex ) |
const |
Returns true if the item has a filename attribute.
- Parameters:
-
oneBasedIndex | The index is 1..Count() inclusive (not zero based). |
- Returns:
- file name from index
void setValue |
( |
int |
oneBasedIndex, |
|
|
const std::string & |
value |
|
) |
| |
Change the value of an element.
- Parameters:
-
oneBasedIndex | The index is 1..Count() inclusive (not zero based). |
value | The new value for the element. |
Any filename attribute wil be removed.
void setValueWithFilename |
( |
int |
oneBasedIndex, |
|
|
const std::string & |
value, |
|
|
const std::string & |
filename, |
|
|
const std::string & |
contentType |
|
) |
| |
Change the value of an element and set a filename attribute on it.
- Parameters:
-
oneBasedIndex | The index is 1..Count() inclusive (not zero based). |
value | The value of the element. |
filename | The name to be given to the MIME file. |
contentType | The MIME type string for the type of content (e.g. "text/xml"). |
The documentation for this class was generated from the following files: