TreeFrogFramework  1.18
Public Member Functions | Static Public Attributes | Protected Member Functions | Friends | List of all members
TMultipartFormData Class Reference

#include <tmultipartformdata.h>

Public Member Functions

 TMultipartFormData (const QByteArray &boundary=QByteArray())
 
 TMultipartFormData (const QByteArray &formData, const QByteArray &boundary)
 
 TMultipartFormData (const QString &bodyFilePath, const QByteArray &boundary)
 
 ~TMultipartFormData ()
 
bool isEmpty () const
 
bool hasFormItem (const QString &name) const
 
QString formItemValue (const QString &name) const
 
QStringList allFormItemValues (const QString &name) const
 
QVariantList formItemVariantList (const QString &key) const
 
QVariantMap formItems (const QString &key) const
 
QVariantMap formItems () const
 
QString contentType (const QByteArray &dataName) const
 
QString originalFileName (const QByteArray &dataName) const
 
qint64 size (const QByteArray &dataName) const
 
bool renameUploadedFile (const QByteArray &dataName, const QString &newName, bool overwrite=false, QFile::Permissions permissions=DefaultPermissions)
 
void clear ()
 
bool hasEntity (const QByteArray &dataName) const
 
TMimeEntity entity (const QByteArray &dataName) const
 
QList< TMimeEntityentityList (const QByteArray &dataName) const
 

Static Public Attributes

static const QFile::Permissions DefaultPermissions = QFile::ReadOwner | QFile::WriteOwner | QFile::ReadGroup | QFile::ReadOther
 

Protected Member Functions

void parse (QIODevice *dev)
 

Friends

class THttpRequest
 

Detailed Description

The TMultipartFormData represents a media-type multipart/form-data.

Constructor & Destructor Documentation

TMultipartFormData::TMultipartFormData ( const QByteArray &  boundary = QByteArray())

Constructs a empty multipart/form-data object with the boundary boundary.

TMultipartFormData::TMultipartFormData ( const QByteArray &  formData,
const QByteArray &  boundary 
)

Constructs a multipart/form-data object by parsing formData with the boundary boundary.

TMultipartFormData::TMultipartFormData ( const QString &  bodyFilePath,
const QByteArray &  boundary 
)

Constructs a multipart/form-data object by parsing the content of the file with the given bodyFilePath.

TMultipartFormData::~TMultipartFormData ( )
inline

Member Function Documentation

QStringList TMultipartFormData::allFormItemValues ( const QString &  name) const

Returns a list of form string values whose name is equal to name from the multipart/form-data.

void TMultipartFormData::clear ( )

Clears this data.

QString TMultipartFormData::contentType ( const QByteArray &  dataName) const

Returns the value of the header field content-type in the MIME entity associated with the name dataName.

TMimeEntity TMultipartFormData::entity ( const QByteArray &  dataName) const

Returns the MIME entity object associated with the name dataName.

QList< TMimeEntity > TMultipartFormData::entityList ( const QByteArray &  dataName) const

Returns a list of the MIME entity objects associated with the name dataName.

QVariantMap TMultipartFormData::formItems ( const QString &  key) const

Returns the map of variant value whose key is equal to key from the multipart/form-data.

QVariantMap TMultipartFormData::formItems ( ) const

Returns a QVariantMap object with the form items of this multipart/form-data.

QString TMultipartFormData::formItemValue ( const QString &  name) const

Returns the first form string value whose name is equal to name from the multipart/form-data.

QVariantList TMultipartFormData::formItemVariantList ( const QString &  key) const
bool TMultipartFormData::hasEntity ( const QByteArray &  dataName) const

Returns true if the MIME entity object associated with the name dataName exists; otherwise false.

bool TMultipartFormData::hasFormItem ( const QString &  name) const

Returns true if there is a string pair whose name is equal to name from the multipart/form-data; otherwise returns false.

bool TMultipartFormData::isEmpty ( ) const

Returns true if the multipart/form-data object has no data; otherwise returns false.

QString TMultipartFormData::originalFileName ( const QByteArray &  dataName) const

Returns the original name of the file contained in the MIME entity associated with the name dataName.

void TMultipartFormData::parse ( QIODevice *  dev)
protected

Reads from the I/O device dev and parses it.

bool TMultipartFormData::renameUploadedFile ( const QByteArray &  dataName,
const QString &  newName,
bool  overwrite = false,
QFile::Permissions  permissions = DefaultPermissions 
)

Renames the file contained in the MIME entity associated with the name dataName.

Warning
Note that this method must not be called more than once.
See also
TMimeEntity::renameUploadedFile()
qint64 TMultipartFormData::size ( const QByteArray &  dataName) const

Returns the size of the file contained in the MIME entity associated with the name dataName.

Warning
Note that this method must be called before renameUploadedFile() method calls.

Friends And Related Function Documentation

friend class THttpRequest
friend

Member Data Documentation

const QFile::Permissions TMultipartFormData::DefaultPermissions = QFile::ReadOwner | QFile::WriteOwner | QFile::ReadGroup | QFile::ReadOther
static

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