NAWA  0.8
Web Application Framework for C++
Request.cpp
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 #include <nawa/request/Request.h>
26 
27 using namespace nawa;
28 using namespace std;
29 
30 struct 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 
44 Request::Request(RequestInitContainer const& initContainer) {
45  data = make_unique<Data>(initContainer);
46 }
47 
48 request::Env const& nawa::Request::env() const noexcept {
49  return data->env;
50 }
51 
52 request::GPC const& nawa::Request::get() const noexcept {
53  return data->get;
54 }
55 
56 request::Post const& nawa::Request::post() const noexcept {
57  return data->post;
58 }
59 
60 request::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