Sming Framework API
Sming - Open Source framework for high efficiency WiFi SoC ESP8266 native development with C++ language.
HttpParams.h
1 /****
2  * Sming Framework Project - Open Source framework for high efficiency native ESP8266 development.
3  * Created 2015 by Skurydin Alexey
4  * http://github.com/SmingHub/Sming
5  * All files of the Sming Core are provided under the LGPL v3 license.
6  *
7  * HttpParams.h
8  *
9  * @author: 2018 - Mikee47 <mike@sillyhouse.net>
10  *
11  * Class to manage HTTP URI query parameters
12  *
13  * The HttpParams class was an empty HashMap class living in 'Structures.h'.
14  * It has been expanded to incorporate escaping and unescaping.
15  * Custom URL parsing code has been replaced with the yuarel library https://github.com/jacketizer/libyuarel
16  *
17  ****/
18 
19 #ifndef _SMING_CORE_NETWORK_HTTP_HTTP_PARAMS_H_
20 #define _SMING_CORE_NETWORK_HTTP_HTTP_PARAMS_H_
21 
22 #include "WString.h"
23 #include "WHashMap.h"
24 #include "Printable.h"
25 
32 class HttpParams : public HashMap<String, String>, public Printable
33 {
34 public:
35  HttpParams() = default;
36 
37  HttpParams(const HttpParams& params)
38  {
39  *this = params;
40  }
41 
42  HttpParams(String query)
43  {
44  parseQuery(query.begin());
45  }
46 
52  void parseQuery(char* query);
53 
55  String toString() const;
56 
57  operator String() const
58  {
59  return toString();
60  }
61 
62  HttpParams& operator=(const HttpParams& params)
63  {
64  clear();
65  setMultiple(params);
66  return *this;
67  }
68 
69  // Printable
70  size_t printTo(Print& p) const override;
71 
76  void debugPrintTo(Print& p) const;
77 };
78 
79 #endif /* _SMING_CORE_NETWORK_HTTP_HTTP_PARAMS_H_ */
Definition: HttpParams.h:32
Definition: WHashMap.h:35
The string class.
Definition: WString.h:104
Provides formatted output to stream.
Definition: Print.h:31
void debugPrintTo(Print &p) const
Printable output for debugging.
String toString() const
Return full escaped content for incorporation into a URI.
void parseQuery(char *query)
Called from URL class to process query section of a URI.
Definition: Printable.h:41