26 #ifndef MYCURL_PARAM_LIST_HPP
27 #define MYCURL_PARAM_LIST_HPP
29 #include "../my_config.h"
35 #include <curl/curl.h>
75 virtual std::unique_ptr<mycurl_param_element_generic> clone()
const = 0;
96 if(arg_ptr ==
nullptr)
98 return arg_ptr->val == val;
101 T get_value()
const {
return val; };
102 const T* get_value_address()
const {
return &val; };
103 void set_value(
const T & arg) { val = arg; };
105 virtual std::unique_ptr<mycurl_param_element_generic> clone()
const override
107 std::unique_ptr<mycurl_param_element_generic> ret;
111 ret = std::make_unique<mycurl_param_element<T> >(val);
113 throw Ememory(
"mycurl_param_list::clone");
117 throw Ememory(
"mycurl_param_list::clone");
136 #if LIBCURL_AVAILABLE
146 template<
class T>
void add(CURLoption opt,
const T & val) { element_list[opt] = std::make_unique<mycurl_param_element<T> >(val); reset_read(); }
147 void clear(CURLoption opt);
148 void clear() { element_list.clear(); reset_read(); };
149 U_I size()
const {
return element_list.size(); };
150 void reset_read()
const { cursor = element_list.begin(); };
151 bool read_next(CURLoption & opt);
153 template<
class T>
void read_opt(
const T* & val)
const
155 if(cursor == element_list.end())
156 throw Erange(
"mycurl_param_list::read_opt",
"Cannot read option when no more option is available");
163 val = ptr->get_value_address();
173 template<
class T>
bool get_val(CURLoption opt,
const T* & val)
const
175 std::map<CURLoption, std::unique_ptr<mycurl_param_element_generic> >::const_iterator it = element_list.find(opt);
177 if(it == element_list.end())
185 val = ptr->get_value_address();
212 std::map<CURLoption, std::unique_ptr<mycurl_param_element_generic> > element_list;
213 mutable std::map<CURLoption, std::unique_ptr<mycurl_param_element_generic> >::const_iterator cursor;
exception used when memory has been exhausted
exception used to signal range error
the ancestor class of etherogeneous list/map
the implemented inherited classes of the abstracted class for etherogeneous list/map
contains all the excetion class thrown by libdar
are defined here basic integer types that tend to be portable
libdar namespace encapsulate all libdar symbols