forked from fhessel/esp32_https_server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResourceParameters.hpp
More file actions
49 lines (37 loc) · 1.12 KB
/
ResourceParameters.hpp
File metadata and controls
49 lines (37 loc) · 1.12 KB
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
/*
* ResourceParameters.hpp
*
* Created on: Dec 18, 2017
* Author: frank
*/
#ifndef HTTPS_RESOURCEPARAMETERS_HPP_
#define HTTPS_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 {
struct requestparam_t {std::string name; std::string value;};
class ResourceParameters {
public:
ResourceParameters();
virtual ~ResourceParameters();
bool isRequestParameterSet(std::string &name);
std::string getRequestParameter(std::string &name);
uint16_t getRequestParameterInt(std::string &name);
void setRequestParameter(std::string name, std::string value);
std::string getUrlParameter(uint8_t idx);
uint16_t getUrlParameterInt(uint8_t idx);
void resetUrlParameters();
void setUrlParameterCount(uint8_t idx);
void setUrlParameter(uint8_t idx, std::string val);
private:
std::vector<std::string> _urlParams;
std::vector<std::pair<std::string, std::string>> _reqParams;
};
} /* namespace httpsserver */
#endif /* HTTPS_RESOURCEPARAMETERS_HPP_ */