1.00.9
C++ Simulated Airline Inventory Management System Library
Loading...
Searching...
No Matches
RequestParser.hpp
Go to the documentation of this file.
1
#ifndef __AIRINV_SVR_REQUESTPARSER_HPP
2
#define __AIRINV_SVR_REQUESTPARSER_HPP
3
4
// //////////////////////////////////////////////////////////////////////
5
// Import section
6
// //////////////////////////////////////////////////////////////////////
7
// STL
8
// Boost
9
#include <boost/logic/tribool.hpp>
10
#include <boost/tuple/tuple.hpp>
11
12
namespace
AIRINV
{
13
14
struct
Request;
15
17
class
RequestParser
{
18
public
:
20
RequestParser
();
21
23
void
reset
();
24
29
template
<
typename
InputIterator>
30
boost::tuple<boost::tribool, InputIterator>
parse
(
Request
& req,
31
InputIterator begin,
32
InputIterator end) {
33
34
while
(begin != end) {
35
boost::tribool result = consume(req, *begin++);
36
if
(result || !result)
37
return
boost::make_tuple(result, begin);
38
}
39
40
boost::tribool result = boost::indeterminate;
41
return
boost::make_tuple(result, begin);
42
}
43
44
private
:
46
boost::tribool consume (
Request
& req,
char
input);
47
49
static
bool
is_char(
int
c);
50
52
static
bool
is_ctl(
int
c);
53
55
static
bool
is_tspecial(
int
c);
56
58
static
bool
is_digit(
int
c);
59
61
enum
state {
62
method_start,
63
method,
64
uri_start,
65
uri,
66
http_version_h,
67
http_version_t_1,
68
http_version_t_2,
69
http_version_p,
70
http_version_slash,
71
http_version_major_start,
72
http_version_major,
73
http_version_minor_start,
74
http_version_minor,
75
expecting_newline_1,
76
header_line_start,
77
header_lws,
78
header_name,
79
space_before_header_value,
80
header_value,
81
expecting_newline_2,
82
expecting_newline_3
83
} state_;
84
};
85
86
}
87
#endif
// __AIRINV_SVR_REQUESTPARSER_HPP
AIRINV::RequestParser
Parser for incoming requests.
Definition
RequestParser.hpp:17
AIRINV::RequestParser::parse
boost::tuple< boost::tribool, InputIterator > parse(Request &req, InputIterator begin, InputIterator end)
Definition
RequestParser.hpp:30
AIRINV::RequestParser::RequestParser
RequestParser()
Construct ready to parse the request method.
Definition
RequestParser.cpp:13
AIRINV::RequestParser::reset
void reset()
Reset to initial parser state.
Definition
RequestParser.cpp:18
AIRINV
Definition
AIRINV_Master_Service.hpp:38
AIRINV::Request
Definition
Request.hpp:18
Generated on Sat Mar 23 2024 00:00:00 for AirInv by
1.10.0