From: Glyn M. <gly...@gm...> - 2008-10-07 11:24:17
|
Hi, 2008/10/7 Kim Gräsman <kim...@gm...> > Hi Glyn, > > On Tue, Oct 7, 2008 at 12:12, Glyn Matthews <gly...@gm...> > wrote: > > > > I don't know if its worth the hassle of having a distinct class for each > > scheme. I was thinking about building URIs using directives in a similar > > way to what we have with messages: > > > > boost::network::uri uri; > > uri << scheme("http") > > << authority("www.boost.org") > > << path("path") > > << query("x=5") > > << fragment("bananas") > > ; > > It looks nice in a way, but I'm not sure how often you start with > components and want to join them into a URI? I think the usual use > case is you have a URI string and want to modify parts of it. But this > API would allow that too, I suppose. Yeah, you could always accept a string in the constructor arguments: boost::network::uri uri("http//www.boost.org/path?x=5#bananas"); Or: boost::network::uri uri("http//www.boost.org/path"); uri << query("x=5") << query("y=6"); Or: boost::network::uri boost_org("http//www.boost.org/"); boost::network uri; uri << boost_org << path("path") << query_param("x", 5); I think the directives can be considered as helpers, not really as *the* way of building URIs. Building URIs from strings will be most common. G |