Decentralised Art Server
High-performance C++ backend that exposes HTML interface and a secure REST API for managing Performative Transactions entities
 
Loading...
Searching...
No Matches
route_key.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4#include <string>
5#include <variant>
6
7#include <absl/container/flat_hash_map.h>
8
9#include "http.hpp"
10#include "route_arg.hpp"
11
12namespace dcn
13{
19 class RouteKey
20 {
21 public:
23
24 bool operator==(const RouteKey& other) const;
25
31 http::Method getMethod() const;
32
38 const http::URL & getPath() const;
39
45 const std::vector<std::variant<std::string, RouteArgDef>> & getPathInfoDef() const;
46
47 const absl::flat_hash_map<std::string, std::variant<std::string, RouteArgDef>> & getQueryDef() const;
48
49 private:
50 http::Method _method;
51 http::URL _url;
52
53 std::vector<std::variant<std::string, RouteArgDef>> _path_info_segments;
54 absl::flat_hash_map<std::string, std::variant<std::string, RouteArgDef>> _query_segments;
55 };
56
65 template <typename H>
66 inline H AbslHashValue(H h, const RouteKey& route_key) {
67 return H::combine(std::move(h), route_key.getMethod(), route_key.getPath());
68 }
69
70}
A class representing a route key, which is a combination of a HTTP method and a URL.
Definition route_key.hpp:20
http::Method getMethod() const
Get the HTTP method of the route key.
Definition route_key.cpp:67
const absl::flat_hash_map< std::string, std::variant< std::string, RouteArgDef > > & getQueryDef() const
Definition route_key.cpp:77
bool operator==(const RouteKey &other) const
Definition route_key.cpp:62
const http::URL & getPath() const
Get the URL of the route key.
Definition route_key.cpp:82
const std::vector< std::variant< std::string, RouteArgDef > > & getPathInfoDef() const
Get the path info segments of the route key.
Definition route_key.cpp:72
Definition url.hpp:13
Method
Enum to represent the request method.
Definition http_method.hpp:31
Definition decentralised_art.hpp:30
H AbslHashValue(H h, const evmc::address &addr)
Definition evm_storage.hpp:137