TreeFrogFramework  2.8
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, TActionContext *context)
 
 TMultipartFormData (const QString &bodyFilePath, const QByteArray &boundary, TActionContext *context)
 
 ~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
 
int64_t size (const QByteArray &dataName) const
 
bool renameUploadedFile (const QByteArray &dataName, const QString &newName, bool overwrite=false, QFile::Permissions permissions=DefaultPermissions)
 
QString uploadedFilePath (const QByteArray &dataName) const
 
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, TActionContext *context)
 

Friends

class THttpRequest
 

Detailed Description

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

Constructor & Destructor Documentation

◆ TMultipartFormData() [1/3]

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

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

◆ TMultipartFormData() [2/3]

TMultipartFormData::TMultipartFormData ( const QByteArray &  formData,
const QByteArray &  boundary,
TActionContext *  context 
)

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

◆ TMultipartFormData() [3/3]

TMultipartFormData::TMultipartFormData ( const QString &  bodyFilePath,
const QByteArray &  boundary,
TActionContext *  context 
)

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

◆ ~TMultipartFormData()

TMultipartFormData::~TMultipartFormData ( )
inline

Member Function Documentation

◆ allFormItemValues()

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.

◆ clear()

void TMultipartFormData::clear ( )

Clears this data.

◆ contentType()

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.

◆ entity()

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

Returns the MIME entity object associated with the name dataName.

◆ entityList()

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

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

◆ formItems() [1/2]

QVariantMap TMultipartFormData::formItems ( ) const

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

◆ formItems() [2/2]

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

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

◆ formItemValue()

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

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

◆ formItemVariantList()

QVariantList TMultipartFormData::formItemVariantList ( const QString &  key) const

◆ hasEntity()

bool TMultipartFormData::hasEntity ( const QByteArray &  dataName) const

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

◆ hasFormItem()

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.

◆ isEmpty()

bool TMultipartFormData::isEmpty ( ) const

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

◆ originalFileName()

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

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

◆ parse()

void TMultipartFormData::parse ( QIODevice *  dev,
TActionContext *  context 
)
protected

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

◆ renameUploadedFile()

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()

◆ size()

int64_t 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.

◆ uploadedFilePath()

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

Returns the path of the temporary file contained in the MIME entity associated with the name dataName, including the absolute path.

Friends And Related Function Documentation

◆ THttpRequest

friend class THttpRequest
friend

Member Data Documentation

◆ DefaultPermissions

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: