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");
134 #ifndef LIBCURL_AVAILABLE
151 template<
class T>
void add(CURLoption opt,
const T & val) { element_list[opt] = std::make_unique<mycurl_param_element<T> >(val); reset_read(); }
152 void clear(CURLoption opt);
153 void clear() { element_list.clear(); reset_read(); };
154 U_I size()
const {
return element_list.size(); };
155 void reset_read()
const { cursor = element_list.begin(); };
156 bool read_next(CURLoption & opt);
158 template<
class T>
void read_opt(
const T* & val)
const
160 if(cursor == element_list.end())
161 throw Erange(
"mycurl_param_list::read_opt",
"Cannot read option when no more option is available");
168 val = ptr->get_value_address();
178 template<
class T>
bool get_val(CURLoption opt,
const T* & val)
const
180 std::map<CURLoption, std::unique_ptr<mycurl_param_element_generic> >::const_iterator it = element_list.find(opt);
182 if(it == element_list.end())
190 val = ptr->get_value_address();
217 std::map<CURLoption, std::unique_ptr<mycurl_param_element_generic> > element_list;
218 mutable std::map<CURLoption, std::unique_ptr<mycurl_param_element_generic> >::const_iterator cursor;
are defined here basic integer types that tend to be portable
exception used when memory has been exhausted
contains all the excetion class thrown by libdar
exception used to signal range error
the implemented inherited classes of the abstracted class for etherogeneous list/map ...
libdar namespace encapsulate all libdar symbols
the ancestor class of etherogeneous list/map