Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
59 lines (48 loc) · 1.87 KB

File metadata and controls

59 lines (48 loc) · 1.87 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef SRC_RESOURCEPARAMETERS_HPP_
#define SRC_RESOURCEPARAMETERS_HPP_
#include <Arduino.h>
#include <string>
// Arduino declares it's own min max, incompatible with the stl...
#undef min
#undef max
#include <vector>
#include <utility>
#include "util.hpp"
namespace httpsserver {
class ResourceResolver;
/**
* @brief The ResourceParameters provide access to the parameters passed in the URI.
*
* There are two types of parameters: Path parameters and query parameters.
*
* Path parameters are the values that fill the asterisk placeholders in the route
* definition of a ResourceNode.
*
* Query parameters are the key-value pairs after a question mark which can be added
* to each request, either by specifying them manually or as result of submitting an
* HTML form with a GET as method property.
*/
class ResourceParameters {
public:
ResourceParameters();
virtual ~ResourceParameters();
bool isQueryParameterSet(std::string const &name);
bool getQueryParameter(std::string const &name, std::string &value);
std::vector<std::pair<std::string,std::string>>::iterator beginQueryParameters();
std::vector<std::pair<std::string,std::string>>::iterator endQueryParameters();
size_t getQueryParameterCount(bool unique=false);
bool getPathParameter(size_t const idx, std::string &value);
std::string getPathParameter(size_t const idx);
protected:
friend class ResourceResolver;
void setQueryParameter(std::string const &name, std::string const &value);
void resetPathParameters();
void setPathParameter(size_t idx, std::string const &val);
private:
/** Parameters in the path of the URL, the actual values for asterisk placeholders */
std::vector<std::string> _pathParams;
/** HTTP Query parameters, as key-value pairs */
std::vector<std::pair<std::string, std::string>> _queryParams;
};
} /* namespace httpsserver */
#endif /* SRC_RESOURCEPARAMETERS_HPP_ */
Morty Proxy This is a proxified and sanitized view of the page, visit original site.