cutelyst 4.3.0
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-2023 Daniel Nicoletti <dantti12@gmail.com>
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5#pragma once
6
7#include <Cutelyst/cutelyst_global.h>
8#include <Cutelyst/headers.h>
9
10#include <QtCore/qiodevice.h>
11
12class QTemporaryFile;
13
14namespace Cutelyst {
15
16class UploadPrivate;
17
25class CUTELYST_LIBRARY Upload final : public QIODevice
26{
27 Q_OBJECT
28 Q_DECLARE_PRIVATE(Upload)
29public:
33 Upload(UploadPrivate *prv);
37 virtual ~Upload() override;
38
42 [[nodiscard]] QString name() const;
43
47 [[nodiscard]] QString filename() const;
48
52 [[nodiscard]] QByteArray contentType() const;
53
57 [[nodiscard]] Headers headers() const;
58
62 bool save(const QString &filename);
63
69 [[nodiscard]] std::unique_ptr<QTemporaryFile>
70 createTemporaryFile(const QString &templateName = {});
71
75 qint64 pos() const override;
76
80 qint64 size() const override;
81
85 bool seek(qint64 pos) override;
86
87protected:
91 qint64 readData(char *data, qint64 maxlen) override;
92
96 qint64 readLineData(char *data, qint64 maxlen) override;
97
101 qint64 writeData(const char *data, qint64 maxSize) override;
102
103 UploadPrivate *d_ptr;
104};
105
107
108} // namespace Cutelyst
Container for HTTP headers.
Definition headers.h:24
Cutelyst Upload handles file upload requests.
Definition upload.h:26
The Cutelyst namespace holds all public Cutelyst API.