cutelyst  3.9.1
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
upload.h
1 /*
2  * SPDX-FileCopyrightText: (C) 2014-2022 Daniel Nicoletti <dantti12@gmail.com>
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 #ifndef UPLOAD_H
6 #define UPLOAD_H
7 
8 #include <Cutelyst/cutelyst_global.h>
9 #include <Cutelyst/headers.h>
10 
11 #include <QtCore/qiodevice.h>
12 
13 class QTemporaryFile;
14 
15 namespace Cutelyst {
16 
17 class UploadPrivate;
18 
22 class CUTELYST_LIBRARY Upload final : public QIODevice
23 {
24  Q_OBJECT
25  Q_DECLARE_PRIVATE(Upload)
26 public:
30  Upload(UploadPrivate *prv);
31  virtual ~Upload() override;
32 
36  QString name() const;
37 
41  QString filename() const;
42 
46  QString contentType() const;
47 
51  Headers headers() const;
52 
56  bool save(const QString &filename);
57 
63  QTemporaryFile *createTemporaryFile(const QString &templateName = QString());
64 
68  virtual qint64 pos() const override;
69 
73  virtual qint64 size() const override;
74 
78  virtual bool seek(qint64 pos) override;
79 
80 protected:
84  virtual qint64 readData(char *data, qint64 maxlen) override;
85 
89  virtual qint64 readLineData(char *data, qint64 maxlen) override;
90 
94  virtual qint64 writeData(const char *data, qint64 maxSize) override;
95 
96  UploadPrivate *d_ptr;
97 };
98 
100 
101 } // namespace Cutelyst
102 
103 #endif // UPLOAD_H
Cutelyst Upload handles file upload request
Definition: upload.h:22
The Cutelyst namespace holds all public Cutelyst API.
Definition: Mainpage.dox:7