Add implementation to cache reader
[dueringa_WikiWalker.git] / src / CurlUrlCreator.h
blobe1f156684ada684c725ceafa557fba503650d5f4
1 //! \file CurlUrlCreator.h
3 #ifndef _CURLURLCREATOR_H
4 #define _CURLURLCREATOR_H
6 #include <string>
7 #include <unordered_map>
8 #include <curl/curl.h>
10 /*! Creates GET URLs with parameters.
11 * With the help of curl
13 class CurlUrlCreator
15 public:
16 //! Create a new instance, given a base URL
17 CurlUrlCreator(std::string baseUrl);
19 /*! Add GET parameters to URL.
20 * If parameter keys are specified multiple times, later occurrences
21 * overwrite earlier ones.
22 * \param param the parameter name
23 * \param value the parameter value - UNESCAPED!
24 * This will be done by curl. If you already escape
25 * it will be double-escaped.
26 * \return reference to self, so method chaining is possible.
28 CurlUrlCreator& addParameter(std::string param, std::string value);
30 //! Reset parameters
31 void reset();
33 /*! Creates the URL
34 * \return Complete GET URL.
36 std::string buildUrl();
38 ~CurlUrlCreator();
40 private:
41 std::string _baseUrl;
42 std::unordered_map<std::string, std::string> args;
43 CURL* handle;
47 #endif /* _CURLURLCREATOR_H */