AnCH Framework 0.1
Another C++ Hack Framework
Loading...
Searching...
No Matches
endpoint.hpp
1/*
2 ANCH Framework: ANother C++ Hack is a C++ framework based on C++11 standard
3 Copyright (C) 2020 Vincent Lachenal
4
5 This file is part of ANCH Framework.
6
7 ANCH Framework is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 ANCH Framework is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with ANCH Framework. If not, see <http://www.gnu.org/licenses/>.
19*/
20#pragma once
21
22#include <string>
23#include <regex>
24
25#include "rest/constants.hpp"
26#include "rest/request.hpp"
27
28
29namespace anch::rest {
30
40 class EndPoint {
41 public:
43 std::string verb;
44
46 std::string pathPattern;
47
49 std::string contentType;
50
52 std::string accept;
53
54 private:
55 // Attributes +
57 static std::regex PATH_PATTERN; // \todo replace with common constants
58
60 std::regex _pathRegex;
61
63 bool _built;
64 // Attributes -
65
66 public:
67 // Constructors +
72
78 EndPoint(const EndPoint& other);
79
86 // Constructors -
87
88 public:
89 // Destructor +
93 virtual ~EndPoint();
94 // Destructor -
95
96 public:
97 // Methods +
105 bool match(const anch::rest::Request& request) const;
106
111 void build();
112 // Methods -
113
114 // Accessors +
120 const std::string& getPathPattern() const;
121
127 void setPathPattern(const std::string& pathPattern);
128
134 const std::regex& getPathRegex() const;
135 // Accessors -
136 };
137
138} // anch::rest
139
140#include "rest/impl/endpoint.hpp"
EndPoint(EndPoint &&other)
std::string pathPattern
Definition endpoint.hpp:46
const std::regex & getPathRegex() const
std::string verb
Definition endpoint.hpp:43
std::string accept
Definition endpoint.hpp:52
EndPoint(const EndPoint &other)
std::string contentType
Definition endpoint.hpp:49
void setPathPattern(const std::string &pathPattern)
const std::string & getPathPattern() const
bool match(const anch::rest::Request &request) const
HTTP request.
Definition request.hpp:43