cutelyst 4.8.0
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
Cutelyst::Upload Class Referencefinal

Cutelyst Upload handles file upload requests. More...

#include <Cutelyst/Upload>

Inheritance diagram for Cutelyst::Upload:

Public Member Functions

 Upload (UploadPrivate *prv)
virtual ~Upload () override
QByteArray contentType () const
std::unique_ptr< QTemporaryFilecreateTemporaryFile (const QString &templateName={})
QString filename () const
Headers headers () const
QString name () const
qint64 pos () const override
bool save (const QString &filename)
bool seek (qint64 pos) override
qint64 size () const override
Public Member Functions inherited from QIODevice
 QIODevice (QObject *parent)
void aboutToClose ()
virtual bool atEnd () const const
virtual qint64 bytesAvailable () const const
virtual qint64 bytesToWrite () const const
void bytesWritten (qint64 bytes)
virtual bool canReadLine () const const
void channelBytesWritten (int channel, qint64 bytes)
void channelReadyRead (int channel)
virtual void close ()
void commitTransaction ()
int currentReadChannel () const const
int currentWriteChannel () const const
QString errorString () const const
bool getChar (char *c)
bool isOpen () const const
bool isReadable () const const
virtual bool isSequential () const const
bool isTextModeEnabled () const const
bool isTransactionStarted () const const
bool isWritable () const const
virtual bool open (QIODeviceBase::OpenMode mode)
QIODeviceBase::OpenMode openMode () const const
qint64 peek (char *data, qint64 maxSize)
QByteArray peek (qint64 maxSize)
bool putChar (char c)
qint64 read (char *data, qint64 maxSize)
QByteArray read (qint64 maxSize)
QByteArray readAll ()
int readChannelCount () const const
void readChannelFinished ()
qint64 readLine (char *data, qint64 maxSize)
QByteArray readLine (qint64 maxSize)
bool readLineInto (QByteArray *line, qint64 maxSize)
QByteArrayView readLineInto (QSpan< char > buffer)
QByteArrayView readLineInto (QSpan< std::byte > buffer)
QByteArrayView readLineInto (QSpan< uchar > buffer)
void readyRead ()
virtual bool reset ()
void rollbackTransaction ()
void setCurrentReadChannel (int channel)
void setCurrentWriteChannel (int channel)
void setTextModeEnabled (bool enabled)
qint64 skip (qint64 maxSize)
void startTransaction ()
void ungetChar (char c)
virtual bool waitForBytesWritten (int msecs)
virtual bool waitForReadyRead (int msecs)
qint64 write (const char *data)
qint64 write (const char *data, qint64 maxSize)
qint64 write (const QByteArray &data)
int writeChannelCount () const const
Public Member Functions inherited from QObject
 QObject (QObject *parent)
QBindable< QStringbindableObjectName ()
bool blockSignals (bool block)
const QObjectListchildren () const const
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
void deleteLater ()
void destroyed (QObject *obj)
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
bool disconnect (const QObject *receiver, const char *method) const const
void dumpObjectInfo () const const
void dumpObjectTree () const const
QList< QByteArraydynamicPropertyNames () const const
virtual bool event (QEvent *e)
virtual bool eventFilter (QObject *watched, QEvent *event)
findChild (QAnyStringView name, Qt::FindChildOptions options) const const
findChild (Qt::FindChildOptions options) const const
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
QList< T > findChildren (QAnyStringView name, Qt::FindChildOptions options) const const
QList< T > findChildren (Qt::FindChildOptions options) const const
bool inherits (const char *className) const const
void installEventFilter (QObject *filterObj)
bool isQmlExposed () const const
bool isQuickItemType () const const
bool isWidgetType () const const
bool isWindowType () const const
void killTimer (int id)
void killTimer (Qt::TimerId id)
virtual const QMetaObjectmetaObject () const const
bool moveToThread (QThread *targetThread)
QString objectName () const const
void objectNameChanged (const QString &objectName)
QObjectparent () const const
QVariant property (const char *name) const const
 Q_CLASSINFO (Name, Value)
 Q_EMIT Q_EMIT
 Q_ENUM (...)
 Q_ENUM_NS (...)
 Q_ENUMS (...)
 Q_FLAG (...)
 Q_FLAG_NS (...)
 Q_FLAGS (...)
 Q_GADGET Q_GADGET
 Q_GADGET_EXPORT (EXPORT_MACRO)
 Q_INTERFACES (...)
 Q_INVOKABLE Q_INVOKABLE
 Q_MOC_INCLUDE Q_MOC_INCLUDE
 Q_NAMESPACE Q_NAMESPACE
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 Q_OBJECT Q_OBJECT
 Q_PROPERTY (...)
 Q_REVISION Q_REVISION
 Q_SET_OBJECT_NAME (Object)
 Q_SIGNAL Q_SIGNAL
 Q_SIGNALS Q_SIGNALS
 Q_SLOT Q_SLOT
 Q_SLOTS Q_SLOTS
qobject_cast (const QObject *object)
qobject_cast (QObject *object)
 QT_NO_CONTEXTLESS_CONNECT QT_NO_CONTEXTLESS_CONNECT
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
void removeEventFilter (QObject *obj)
void setObjectName (const QString &name)
void setObjectName (QAnyStringView name)
void setParent (QObject *parent)
bool setProperty (const char *name, const QVariant &value)
bool setProperty (const char *name, QVariant &&value)
bool signalsBlocked () const const
int startTimer (int interval, Qt::TimerType timerType)
int startTimer (std::chrono::nanoseconds interval, Qt::TimerType timerType)
QThreadthread () const const

Protected Member Functions

qint64 readData (char *data, qint64 maxlen) override
qint64 readLineData (char *data, qint64 maxlen) override
qint64 writeData (const char *data, qint64 maxSize) override
Protected Member Functions inherited from QIODevice
void setErrorString (const QString &str)
void setOpenMode (QIODeviceBase::OpenMode openMode)
virtual qint64 skipData (qint64 maxSize)
Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
virtual void connectNotify (const QMetaMethod &signal)
virtual void customEvent (QEvent *event)
virtual void disconnectNotify (const QMetaMethod &signal)
bool isSignalConnected (const QMetaMethod &signal) const const
int receivers (const char *signal) const const
QObjectsender () const const
int senderSignalIndex () const const
virtual void timerEvent (QTimerEvent *event)

(Note that these are not member symbols.)

typedef QVector< Upload * > Uploads

Additional Inherited Members

Public Types inherited from QObject
enum  TimerId
Public Types inherited from QIODeviceBase
enum  OpenModeFlag
Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
bool disconnect (const QMetaObject::Connection &connection)
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
QString tr (const char *sourceText, const char *disambiguation, int n)
Public Attributes inherited from QObject
 Invalid
typedef QObjectList
Public Attributes inherited from QIODeviceBase
 Append
 ExistingOnly
 NewOnly
 NotOpen
typedef OpenMode
 ReadOnly
 ReadWrite
 Text
 Truncate
 Unbuffered
 WriteOnly
Properties inherited from QObject
 objectName

Detailed Description

Cutelyst Upload handles file upload requests.

Definition at line 25 of file upload.h.

Constructor & Destructor Documentation

◆ Upload()

Upload::Upload ( UploadPrivate * prv)

This class provides access to client upload requests

Definition at line 155 of file upload.cpp.

References Upload(), QString::fromLatin1(), QByteArray::indexOf(), QIODevice::open(), and QByteArray::sliced().

Referenced by Upload(), contentType(), createTemporaryFile(), filename(), headers(), name(), pos(), readData(), readLineData(), save(), seek(), and size().

◆ ~Upload()

Upload::~Upload ( )
overridevirtual

Destroys the Upload object.

Definition at line 181 of file upload.cpp.

Member Function Documentation

◆ contentType()

QByteArray Upload::contentType ( ) const
nodiscard

Returns the content type provided by the user agent.

Definition at line 21 of file upload.cpp.

References Upload().

◆ createTemporaryFile()

std::unique_ptr< QTemporaryFile > Upload::createTemporaryFile ( const QString & templateName = {})
nodiscard

This function creates a temporary file and fill it with the content of this upload. Returns zero if an error occours.

Definition at line 83 of file upload.cpp.

References Upload(), QIODevice::atEnd(), QIODevice::errorString(), QString::isEmpty(), QIODevice::read(), seek(), and QIODevice::setErrorString().

◆ filename()

QString Upload::filename ( ) const
nodiscard

Returns the file name provided by the user agent.

Definition at line 15 of file upload.cpp.

References Upload().

◆ headers()

Headers Upload::headers ( ) const
nodiscard

Returns the headers provided by the user agent.

Definition at line 27 of file upload.cpp.

References Upload().

◆ name()

QString Upload::name ( ) const
nodiscard

Returns the name of the form field.

Definition at line 186 of file upload.cpp.

References Upload().

◆ pos()

qint64 Upload::pos ( ) const
overridevirtual

Reimplemented from QIODevice::pos().

Reimplemented from QIODevice.

Definition at line 132 of file upload.cpp.

References Upload().

Referenced by seek().

◆ readData()

qint64 Upload::readData ( char * data,
qint64 maxlen )
overrideprotectedvirtual

Reimplemented from QIODevice::readData().

Implements QIODevice.

Definition at line 192 of file upload.cpp.

References Upload(), and size().

◆ readLineData()

qint64 Upload::readLineData ( char * data,
qint64 maxlen )
overrideprotectedvirtual

Reimplemented from QIODevice::readLineData().

Reimplemented from QIODevice.

Definition at line 204 of file upload.cpp.

References Upload(), and size().

◆ save()

bool Upload::save ( const QString & filename)

◆ seek()

bool Upload::seek ( qint64 pos)
overridevirtual

Reimplemented from QIODevice::seek().

Reimplemented from QIODevice.

Definition at line 144 of file upload.cpp.

References Upload(), pos(), QIODevice::seek(), and size().

Referenced by createTemporaryFile(), and save().

◆ size()

qint64 Upload::size ( ) const
overridevirtual

Reimplemented from QIODevice::size().

Reimplemented from QIODevice.

Definition at line 138 of file upload.cpp.

References Upload().

Referenced by readData(), readLineData(), and seek().

◆ writeData()

qint64 Upload::writeData ( const char * data,
qint64 maxSize )
overrideprotectedvirtual

Reimplemented from QIODevice::writeData().

Implements QIODevice.

Definition at line 216 of file upload.cpp.

◆ Uploads

typedef QVector<Upload *> Uploads
related

A vector of Upload pointers.

Definition at line 29 of file request.h.