curl-library
Re: Using curl_easy_setopt in generic way
Date: Fri, 20 Sep 2013 23:21:13 +0200 (CEST)
On Thu, 19 Sep 2013, sachin dravid wrote:
> Use case
> =========
> I am working on a library, where I am getting map of (string) vs (void
> *). Here string is name of CURL option and value comes as (void *).
>
> Issue
> =========
> curl_easy_setopt takes CURLoption parameter which is actually an enum and
> respectively value should be passed with proper type. How can I use
> curl_easy_setopt function generically with string and void*?
Perhaps something like this:
1. convert the string to the correct CURLOPT_*
2. pass in the void * if the CURLOPT_ wants a pointer that you know how to
create, or convert it to a long and pass that in if it wants a long.
3. then handle the few special cases separately
Not all options make sense to handle like this though, like for example the
FUNCTIONPOINT ones.
-- / daniel.haxx.se ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2013-09-20