Skip to content

Commit bd77b44

Browse files
committed
template is now a class . No support for std::wstring.
1 parent 77e6e53 commit bd77b44

18 files changed

+380
-1001
lines changed

boost/network/uri.hpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,7 @@
66
// (See accompanying file LICENSE_1_0.txt or copy at
77
// http://www.boost.org/LICENSE_1_0.txt)
88

9-
#include <boost/network/traits/string.hpp>
109
#include <boost/network/uri/uri.hpp>
11-
//#include <boost/network/protocol/http/tags.hpp>
12-
//#include <boost/network/uri/http/uri.hpp>
13-
14-
15-
namespace boost { namespace network { namespace uri {
16-
17-
typedef basic_uri<std::string> uri;
18-
typedef basic_uri<std::wstring> wuri;
19-
20-
//namespace http {
21-
//typedef basic_uri<boost::network::http::tags::http_default_8bit_udp_resolve> uri;
22-
//}
23-
} // namespace uri
24-
} // namespace network
25-
} // namespace boost
2610

2711
#endif
2812

boost/network/uri/accessors.hpp

Lines changed: 24 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,11 @@ namespace network {
2020
namespace uri {
2121
namespace details {
2222
template <
23-
typename Uri,
2423
typename Map
2524
>
2625
struct key_value_sequence
27-
: spirit::qi::grammar<typename Uri::const_iterator, Map()>
26+
: spirit::qi::grammar<uri::const_iterator, Map()>
2827
{
29-
typedef typename Uri::const_iterator const_iterator;
30-
3128
key_value_sequence()
3229
: key_value_sequence::base_type(query)
3330
{
@@ -37,79 +34,63 @@ struct key_value_sequence
3734
value = +spirit::qi::char_("a-zA-Z_0-9/%");
3835
}
3936

40-
spirit::qi::rule<const_iterator, Map()> query;
41-
spirit::qi::rule<const_iterator, std::pair<typename Uri::string_type, typename Uri::string_type>()> pair;
42-
spirit::qi::rule<const_iterator, typename Uri::string_type()> key, value;
37+
spirit::qi::rule<uri::const_iterator, Map()> query;
38+
spirit::qi::rule<uri::const_iterator, std::pair<std::string, std::string>()> pair;
39+
spirit::qi::rule<uri::const_iterator, typename std::string()> key, value;
4340
};
4441
} // namespace details
4542

4643
template <
47-
class String,
4844
class Map
4945
>
5046
inline
51-
Map &query_map(const basic_uri<String> &uri, Map &map) {
52-
typename basic_uri<String>::const_range_type range = uri.query_range();
53-
details::key_value_sequence<basic_uri<String>, Map> parser;
47+
Map &query_map(const uri &uri_, Map &map) {
48+
uri::const_range_type range = uri_.query_range();
49+
details::key_value_sequence<Map> parser;
5450
spirit::qi::parse(boost::begin(range), boost::end(range), parser, map);
5551
return map;
5652
}
5753

58-
template <
59-
class String
60-
>
61-
String username(const basic_uri<String> &uri) {
62-
typename basic_uri<String>::const_range_type user_info_range = uri.user_info_range();
63-
typename basic_uri<String>::const_iterator it(boost::begin(user_info_range)), end(boost::end(user_info_range));
54+
std::string username(const uri &uri_) {
55+
uri::const_range_type user_info_range = uri_.user_info_range();
56+
uri::const_iterator it(boost::begin(user_info_range)), end(boost::end(user_info_range));
6457
for (; it != end; ++it) {
6558
if (*it == ':') {
6659
break;
6760
}
6861
}
69-
return String(boost::begin(user_info_range), it);
62+
return std::string(boost::begin(user_info_range), it);
7063
}
7164

72-
template <
73-
class String
74-
>
75-
String password(const basic_uri<String> &uri) {
76-
typename basic_uri<String>::const_range_type user_info_range = uri.user_info_range();
77-
typename basic_uri<String>::const_iterator it(boost::begin(user_info_range)), end(boost::end(user_info_range));
65+
std::string password(const uri &uri_) {
66+
uri::const_range_type user_info_range = uri_.user_info_range();
67+
uri::const_iterator it(boost::begin(user_info_range)), end(boost::end(user_info_range));
7868
for (; it != end; ++it) {
7969
if (*it == ':') {
8070
++it;
8171
break;
8272
}
8373
}
84-
return String(it, boost::end(user_info_range));
74+
return std::string(it, boost::end(user_info_range));
8575
}
8676

87-
template <
88-
class String
89-
>
90-
String decoded_path(const basic_uri<String> &uri) {
91-
typename basic_uri<String>::const_range_type path_range = uri.path_range();
92-
String decoded_path;
77+
std::string decoded_path(const uri &uri_) {
78+
uri::const_range_type path_range = uri_.path_range();
79+
std::string decoded_path;
9380
decode(path_range, std::back_inserter(decoded_path));
9481
return decoded_path;
9582
}
9683

97-
template <
98-
class String
99-
>
100-
String decoded_query(const basic_uri<String> &uri) {
101-
typename basic_uri<String>::const_range_type query_range = uri.query_range();
102-
String decoded_query;
84+
std::string decoded_query(const uri &uri_) {
85+
uri::const_range_type query_range = uri_.query_range();
86+
std::string decoded_query;
10387
decode(query_range, std::back_inserter(decoded_query));
10488
return decoded_query;
10589
}
10690

107-
template <
108-
class String
109-
>
110-
String decoded_fragment(const basic_uri<String> &uri) {
111-
typename basic_uri<String>::const_range_type fragment_range = uri.fragment_range();
112-
String decoded_fragment;
91+
std::string decoded_fragment(const uri &uri_) {
92+
uri::const_range_type fragment_range = uri_.fragment_range();
93+
std::string decoded_fragment;
11394
decode(fragment_range, std::back_inserter(decoded_fragment));
11495
return decoded_fragment;
11596
}

boost/network/uri/directives.hpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,21 @@
1616
namespace boost {
1717
namespace network {
1818
namespace uri {
19-
template <
20-
class String
21-
>
2219
inline
23-
basic_uri<String> &operator << (basic_uri<String> &uri, const basic_uri<String> &root_uri) {
24-
if (empty(uri) && valid(root_uri)) {
25-
uri.append(boost::begin(root_uri), boost::end(root_uri));
20+
uri &operator << (uri &uri_, const uri &root_uri) {
21+
if (empty(uri_) && valid(root_uri)) {
22+
uri_.append(boost::begin(root_uri), boost::end(root_uri));
2623
}
27-
return uri;
24+
return uri_;
2825
}
2926

3027
template <
31-
class String
32-
, class Directive
28+
class Directive
3329
>
3430
inline
35-
basic_uri<String> &operator << (basic_uri<String> &uri, const Directive &directive) {
36-
directive(uri);
37-
return uri;
31+
uri &operator << (uri &uri_, const Directive &directive) {
32+
directive(uri_);
33+
return uri_;
3834
}
3935
} // namespace uri
4036
} // namespace network

boost/network/uri/directives/authority.hpp

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,26 @@
22
# define __BOOST_NETWORK_URI_DIRECTIVES_AUTHORITY_INC__
33

44

5-
# include <boost/range/as_literal.hpp>
6-
7-
8-
95
namespace boost {
106
namespace network {
117
namespace uri {
12-
template <
13-
class ValueType
14-
>
158
struct authority_directive {
169

17-
explicit authority_directive(const ValueType &value)
18-
: value(value)
10+
explicit authority_directive(const std::string &authority)
11+
: authority(authority)
1912
{}
2013

21-
template <
22-
class Tag
23-
, template <class> class Uri
24-
>
25-
void operator () (Uri<Tag> &uri) const {
26-
uri.append(value);
14+
void operator () (uri &uri_) const {
15+
uri_.append(authority);
2716
}
2817

29-
const ValueType &value;
18+
std::string authority;
3019

3120
};
3221

33-
template <
34-
class T
35-
>
3622
inline
37-
authority_directive<T> authority(const T &value) {
38-
return authority_directive<T>(value);
23+
authority_directive authority(const std::string &authority) {
24+
return authority_directive(authority);
3925
}
4026
} // namespace uri
4127
} // namespace network

boost/network/uri/directives/fragment.hpp

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,37 +10,27 @@
1010
namespace boost {
1111
namespace network {
1212
namespace uri {
13-
template <
14-
class ValueType
15-
>
1613
struct fragment_directive {
1714

18-
explicit fragment_directive(const ValueType &value)
19-
: value(value)
15+
explicit fragment_directive(const std::string &fragment)
16+
: fragment(fragment)
2017
{}
2118

22-
template <
23-
class String
24-
, template <class> class Uri
25-
>
26-
void operator () (Uri<String> &uri) const {
27-
String encoded_value;
19+
void operator () (uri &uri_) const {
20+
std::string encoded_fragment;
2821
static const char separator[] = {'#'};
29-
uri.append(boost::begin(separator), boost::end(separator));
30-
encode(boost::as_literal(value), std::back_inserter(encoded_value));
31-
uri.append(encoded_value);
22+
uri_.append(boost::begin(separator), boost::end(separator));
23+
encode(fragment, std::back_inserter(encoded_fragment));
24+
uri_.append(encoded_fragment);
3225
}
3326

34-
const ValueType &value;
27+
std::string fragment;
3528

3629
};
3730

38-
template <
39-
class T
40-
>
4131
inline
42-
fragment_directive<T> fragment(const T &value) {
43-
return fragment_directive<T>(value);
32+
fragment_directive fragment(const std::string &fragment) {
33+
return fragment_directive(fragment);
4434
}
4535
} // namespace uri
4636
} // namespace network

boost/network/uri/directives/host.hpp

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,23 @@
99
namespace boost {
1010
namespace network {
1111
namespace uri {
12-
template <
13-
class ValueType
14-
>
1512
struct host_directive {
1613

17-
explicit host_directive(const ValueType &value)
18-
: value(value)
14+
explicit host_directive(const std::string &host)
15+
: host(host)
1916
{}
2017

21-
template <
22-
class Tag
23-
, template <class> class Uri
24-
>
25-
void operator () (Uri<Tag> &uri) const {
26-
uri.append(value);
18+
void operator () (uri &uri_) const {
19+
uri_.append(host);
2720
}
2821

29-
const ValueType &value;
22+
std::string host;
3023

3124
};
3225

33-
template <
34-
class T
35-
>
3626
inline
37-
host_directive<T> host(const T &value) {
38-
return host_directive<T>(value);
27+
host_directive host(const std::string &host) {
28+
return host_directive(host);
3929
}
4030
} // namespace uri
4131
} // namespace network

0 commit comments

Comments
 (0)