cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curlpp mailing list Archives

Re: [cURLpp] Easy::setOpt improvement

From: Piotr Dobrogost <curlpp_at_2008.autoera.pl>
Date: Sun, 16 Nov 2008 12:45:58 +0100

Jean

Jean-Philippe Barette-LaPierre wrote:
>
>
> On Fri, Nov 14, 2008 at 4:12 PM, Piotr Dobrogost <curlpp_at_2008.autoera.pl
> <mailto:curlpp_at_2008.autoera.pl>> wrote:
>
> Jean
>
> Using Easy::setOpt is not as convenient as it should be.
>
> Now we have
>
> std::string address = "http://example.com"
> // Setting the URL to retrive.
> request.setOpt(new cURLpp::Options::Url(address));
>
> Could we do better?
>
> std::string url = "http://example.com"
> // Setting the URL to retrive.
> request.set<url>(address);
>
>
> Well... No... The thing is setOpt wouldn't be able to distinguish
> between different "string" options (Url, Proxy, Interface, etc). However:

I know you use this scheme to be able to make this distinction. The point is that passing an option type as template's argument to set<typename T> gives the same information like passing an option type as a type of the argument of function.
The question is what does wrapping arguments of setOpt in the Options::X type give us? Later on it's convenient to have all options' types be derived from one base class (OptionBase) to treat them polymorphically in containers and alghorithms . But in the moment of setting an option using setOpt we don't really need this and we shouldn't force users to wrap all these values only to give them to setOpt method.
What do you think?

Regards
Piotr Dobrogost
_______________________________________________
cURLpp mailing list
cURLpp_at_rrette.com
http://www.rrette.com/mailman/listinfo/curlpp
Received on 2008-11-16

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET