Line data Source code
1 : #ifndef THINGER_HTTP_ROUTE_BUILDER_HPP
2 : #define THINGER_HTTP_ROUTE_BUILDER_HPP
3 :
4 : #include <vector>
5 : #include <string>
6 : #include "route.hpp"
7 : #include "../../common/http_request.hpp"
8 :
9 : namespace thinger::http {
10 :
11 : class route_builder {
12 : public:
13 5728 : route_builder(method http_method, std::vector<route>& routes)
14 5728 : : method_(http_method), routes_(routes) {}
15 :
16 : // Create a new route with the given pattern
17 5728 : route& operator[](const std::string& pattern) {
18 5728 : routes_.emplace_back(pattern);
19 5728 : return routes_.back();
20 : }
21 :
22 : private:
23 : method method_;
24 : std::vector<route>& routes_;
25 : };
26 :
27 : } // namespace thinger::http
28 :
29 : #endif // THINGER_HTTP_ROUTE_BUILDER_HPP
|