1 //! \file CurlUrlCreator.h
3 #ifndef _CURLURLCREATOR_H
4 #define _CURLURLCREATOR_H
7 #include <unordered_map>
10 /*! Creates GET URLs with parameters.
11 * With the help of curl
16 //! Create a new instance, given a base URL
17 CurlUrlCreator(std::string baseUrl
);
19 //! delete copy constructor, because of CURL handle
20 CurlUrlCreator(const CurlUrlCreator
&) = delete;
22 //! delete copy assignment, because of CURL handle
23 CurlUrlCreator
& operator=(const CurlUrlCreator
&) = delete;
25 /*! Add GET parameters to URL.
26 * If parameter keys are specified multiple times, later occurrences
27 * overwrite earlier ones.
28 * \param param the parameter name
29 * \param value the parameter value - UNESCAPED!
30 * This will be done by curl. If you already escape
31 * it will be double-escaped.
32 * \return reference to self, so method chaining is possible.
34 CurlUrlCreator
& addParameter(std::string param
, std::string value
);
40 * \return Complete GET URL.
42 std::string
buildUrl() const;
48 std::unordered_map
<std::string
, std::string
> args
;
53 #endif /* _CURLURLCREATOR_H */