NAWA 0.9
Web Application Framework for C++
Post.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2019-2022 Tobias Flaig.
3 *
4 * This file is part of nawa.
5 *
6 * nawa is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License,
8 * version 3, as published by the Free Software Foundation.
9 *
10 * nawa is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with nawa. If not, see <https://www.gnu.org/licenses/>.
17 */
18
24#ifndef NAWA_POST_H
25#define NAWA_POST_H
26
27#include <memory>
28#include <nawa/request/File.h>
30#include <optional>
31
32namespace nawa::request {
36 class Post : public GPC {
38
39 public:
41
42 explicit Post(RequestInitContainer const& requestInit);
43
48 explicit operator bool() const override;
49
55 [[nodiscard]] std::shared_ptr<std::string const> getRaw() const;
56
61 [[nodiscard]] std::string getContentType() const;
62
67 [[nodiscard]] bool hasFiles() const;
68
77 [[nodiscard]] std::optional<File> getFile(std::string const& key) const;
78
84 [[nodiscard]] std::vector<File> getFileVector(std::string const& key) const;
85
91 [[nodiscard]] size_t countFiles(std::string const& key) const;
92
97 [[nodiscard]] std::unordered_multimap<std::string, File> const& getFileMultimap() const;
98 };
99}// namespace nawa::request
100
101#endif//NAWA_POST_H
Container for (especially POST-submitted) files.
Accessor class for GET, POST, and COOKIE variables.
std::vector< File > getFileVector(std::string const &key) const
Definition: Post.cpp:69
Post(RequestInitContainer const &requestInit)
Definition: Post.cpp:42
std::unordered_multimap< std::string, File > const & getFileMultimap() const
Definition: Post.cpp:82
bool hasFiles() const
Definition: Post.cpp:58
std::shared_ptr< std::string const > getRaw() const
Definition: Post.cpp:50
std::optional< File > getFile(std::string const &key) const
Definition: Post.cpp:62
size_t countFiles(std::string const &key) const
Definition: Post.cpp:78
std::string getContentType() const
Definition: Post.cpp:54
#define NAWA_DEFAULT_DESTRUCTOR_OVERRIDE_DEF(Class)
Definition: macros.h:35
#define NAWA_PRIVATE_DATA()
Definition: macros.h:30