The class eases the building of a MIME section. More...
#include <ms_http_client_mime.hpp>
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. | |
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.
|
virtual |
Destructor. HTTP Communication to a Mascot Server.
Called automatically.
| void append | ( | const std::string & | name, |
| const std::string & | value | ||
| ) |
Adds a name-value pair element to the end of the MIME string.
| 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.
| 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.
| 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.
| 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). |
|
static |
Gets the MIME header string.
The header consists of a content type and a boundary.
For example, "Content-Type: multipart/mixed; boundary=----------MascotMimeContent"
| 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". |
| int getCount | ( | ) | const |
Returns the number of items.
| std::string getFilename | ( | int | oneBasedIndex | ) | const |
Returns the filename attribute of an item.
| oneBasedIndex | The index is 1..Count() inclusive (not zero based). |
| std::string getName | ( | int | oneBasedIndex | ) | const |
Returns the name of an item.
| oneBasedIndex | The index is 1..Count() inclusive (not zero based). |
| std::string getValue | ( | int | oneBasedIndex | ) | const |
Returns the value of an item.
| oneBasedIndex | The index is 1..Count() inclusive (not zero based). |
| bool hasFilename | ( | int | oneBasedIndex | ) | const |
Returns true if the item has a filename attribute.
| oneBasedIndex | The index is 1..Count() inclusive (not zero based). |
| void setValue | ( | int | oneBasedIndex, |
| const std::string & | value | ||
| ) |
Change the value of an element.
| 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.
| 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"). |