OSSIA
Open Scenario System for Interactive Application
Loading...
Searching...
No Matches
query_parser.hpp
1#pragma once
4
5namespace ossia
6{
7namespace net
8{
9struct parameter_data;
10}
11namespace oscquery
12{
21{
22public:
23 template <typename Mapper>
24 static auto parse_http_request(const std::string& request, Mapper&& mapper)
25 {
26 // Split on "?"
27 std::string_view path;
28 std::string_view queries;
29
30 auto idx = request.find_first_of('?');
31 if(idx != std::string::npos)
32 {
33 path = std::string_view(request.data(), idx);
34 queries = std::string_view(request.data() + idx + 1, request.size() - idx);
35 }
36 else
37 {
38 path = request;
39 }
40
41 std::string clean_path;
42 ossia::net::url_decode(path, clean_path);
43 return mapper(clean_path, parse_http_methods(queries));
44 }
45
46 static string_map<std::string> parse_http_methods(std::string_view str);
47
48 static bool parse_bool(const std::string& data);
49
50 static void
51 parse(net::access_mode_attribute, const std::string& data, net::parameter_data& res);
52 static void
53 parse(net::bounding_mode_attribute, const std::string& data, net::parameter_data& res);
54 static void parse(
55 net::repetition_filter_attribute, const std::string& data,
57 static void parse(
58 net::refresh_rate_attribute attr, const std::string& data,
60 static void
61 parse(net::priority_attribute attr, const std::string& data, net::parameter_data& res);
62 static void parse(
63 net::value_step_size_attribute attr, const std::string& data,
65 static void
66 parse(net::critical_attribute attr, const std::string& data, net::parameter_data& res);
67 static void
68 parse(net::hidden_attribute attr, const std::string& data, net::parameter_data& res);
69 static void
70 parse(net::disabled_attribute attr, const std::string& data, net::parameter_data& res);
71 static void parse(
72 net::description_attribute attr, const std::string& data,
74 static void
75 parse(net::app_name_attribute attr, const std::string& data, net::parameter_data& res);
76 static void parse(
77 net::app_version_attribute attr, const std::string& data,
79 static void parse(
80 net::app_creator_attribute attr, const std::string& data,
82 static void
83 parse(net::value_attribute attr, const std::string& data, net::parameter_data& res);
84 static void
85 parse(net::domain_attribute attr, const std::string& data, net::parameter_data& res);
86 static void
87 parse(net::tags_attribute, const std::string& data, net::parameter_data& res);
88 static void parse(
89 net::instance_bounds_attribute attr, const std::string& data,
91 static void
92 parse(net::unit_attribute attr, const std::string& data, net::parameter_data& res);
93 static void parse(
94 net::extended_type_attribute attr, const std::string& data,
96 static void parse(
97 net::default_value_attribute attr, const std::string& data,
99 static void parse(
100 oscquery::detail::typetag_attribute attr, const std::string& data,
102};
103}
104}
The query_parser class.
Definition query_parser.hpp:21
Definition git_info.h:7
The data that can be found inside a parameter.
Definition parameter_data.hpp:21