ESP32 HTTPS Server

ResourceParameters.hpp
1 #ifndef SRC_RESOURCEPARAMETERS_HPP_
2 #define SRC_RESOURCEPARAMETERS_HPP_
3
4 #include <Arduino.h>
5
6 #include <string>
7 // Arduino declares it's own min max, incompatible with the stl...
8 #undef min
9 #undef max
10 #include <vector>
11 #include <utility>
12
13 #include "util.hpp"
14
15 namespace httpsserver {
16
17 struct requestparam_t {std::string name; std::string value;};
18
22 class ResourceParameters {
23 public:
24 ResourceParameters();
25 virtual ~ResourceParameters();
26
27 bool isRequestParameterSet(std::string const &name);
28 std::string getRequestParameter(std::string const &name);
29 uint16_t getRequestParameterInt(std::string const &name);
30 void setRequestParameter(std::string const &name, std::string const &value);
31
32 std::string getUrlParameter(uint8_t idx);
33 uint16_t getUrlParameterInt(uint8_t idx);
34 void resetUrlParameters();
35 void setUrlParameterCount(uint8_t idx);
36 void setUrlParameter(uint8_t idx, std::string const &val);
37
38 private:
39 std::vector<std::string> _urlParams;
40 std::vector<std::pair<std::string, std::string>> _reqParams;
41 };
42
43 } /* namespace httpsserver */
44
45 #endif /* SRC_RESOURCEPARAMETERS_HPP_ */
httpsserver::requestparam_t
Definition: ResourceParameters.hpp:17
httpsserver::ResourceParameters
Class used to handle access to the URL parameters.
Definition: ResourceParameters.hpp:22
httpsserver
Definition: ConnectionContext.cpp:3