NAWA 0.9
Web Application Framework for C++
Request.cpp
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
26
27using namespace nawa;
28using namespace std;
29
30struct Request::Data {
31 request::Env const env;
32 request::GPC const get;
33 request::Post const post;
34 request::GPC const cookie;
35
36 explicit Data(RequestInitContainer const& initContainer) : env(initContainer),
37 get(initContainer, request::GPC::Source::GET),
38 post(initContainer),
39 cookie(initContainer, request::GPC::Source::COOKIE) {}
40};
41
43
44Request::Request(RequestInitContainer const& initContainer) {
45 data = make_unique<Data>(initContainer);
46}
47
48request::Env const& nawa::Request::env() const noexcept {
49 return data->env;
50}
51
52request::GPC const& nawa::Request::get() const noexcept {
53 return data->get;
54}
55
56request::Post const& nawa::Request::post() const noexcept {
57 return data->post;
58}
59
60request::GPC const& nawa::Request::cookie() const noexcept {
61 return data->cookie;
62}
Container used by request handlers to initiate the nawa::Request object.
Class which represents request objects.
request::GPC const & cookie() const noexcept
Definition: Request.cpp:60
request::Post const & post() const noexcept
Definition: Request.cpp:56
request::GPC const & get() const noexcept
Definition: Request.cpp:52
request::Env const & env() const noexcept
Definition: Request.cpp:48
#define NAWA_DEFAULT_DESTRUCTOR_IMPL(Class)
Definition: macros.h:36
Definition: AppInit.h:31