NAWA  0.8
Web Application Framework for C++
Post.h
Go to the documentation of this file.
1 
6 /*
7  * Copyright (C) 2019-2021 Tobias Flaig.
8  *
9  * This file is part of nawa.
10  *
11  * nawa is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License,
13  * version 3, as published by the Free Software Foundation.
14  *
15  * nawa is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with nawa. If not, see <https://www.gnu.org/licenses/>.
22  */
23 
24 #ifndef NAWA_POST_H
25 #define NAWA_POST_H
26 
27 #include <memory>
28 #include <nawa/request/File.h>
29 #include <nawa/request/GPC/GPC.h>
30 #include <optional>
31 
32 namespace 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::shared_ptr< std::string const > getRaw() const
Definition: Post.cpp:50
std::optional< File > getFile(std::string const &key) const
Definition: Post.cpp:62
std::string getContentType() const
Definition: Post.cpp:54
Post(RequestInitContainer const &requestInit)
Definition: Post.cpp:42
std::vector< File > getFileVector(std::string const &key) const
Definition: Post.cpp:69
std::unordered_multimap< std::string, File > const & getFileMultimap() const
Definition: Post.cpp:82
bool hasFiles() const
Definition: Post.cpp:58
size_t countFiles(std::string const &key) const
Definition: Post.cpp:78
#define NAWA_DEFAULT_DESTRUCTOR_OVERRIDE_DEF(Class)
Definition: macros.h:35
#define NAWA_PRIVATE_DATA()
Definition: macros.h:30