Skip to content

Commit cd5b003

Browse files
committed
Merge pull request #7 from glynos/0.9-devel
0.9 devel
2 parents e1785e0 + bb9521f commit cd5b003

31 files changed

+697
-1326
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: 25 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,19 @@
1212
# include <boost/network/uri/encode.hpp>
1313
# include <boost/network/uri/decode.hpp>
1414
# include <boost/spirit/include/qi.hpp>
15+
# include <boost/fusion/include/std_pair.hpp>
1516

1617

1718
namespace boost {
1819
namespace network {
1920
namespace uri {
2021
namespace details {
2122
template <
22-
typename Uri,
2323
typename Map
2424
>
2525
struct key_value_sequence
26-
: spirit::qi::grammar<typename Uri::const_iterator, Map()>
26+
: spirit::qi::grammar<uri::const_iterator, Map()>
2727
{
28-
typedef typename Uri::const_iterator const_iterator;
29-
3028
key_value_sequence()
3129
: key_value_sequence::base_type(query)
3230
{
@@ -36,79 +34,63 @@ struct key_value_sequence
3634
value = +spirit::qi::char_("a-zA-Z_0-9/%");
3735
}
3836

39-
spirit::qi::rule<const_iterator, Map()> query;
40-
spirit::qi::rule<const_iterator, std::pair<typename Uri::string_type, typename Uri::string_type>()> pair;
41-
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;
4240
};
4341
} // namespace details
4442

4543
template <
46-
class String,
4744
class Map
4845
>
4946
inline
50-
Map &query_map(const basic_uri<String> &uri, Map &map) {
51-
typename basic_uri<String>::const_range_type range = uri.query_range();
52-
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;
5350
spirit::qi::parse(boost::begin(range), boost::end(range), parser, map);
5451
return map;
5552
}
5653

57-
template <
58-
class String
59-
>
60-
String username(const basic_uri<String> &uri) {
61-
typename basic_uri<String>::const_range_type user_info_range = uri.user_info_range();
62-
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));
6357
for (; it != end; ++it) {
6458
if (*it == ':') {
6559
break;
6660
}
6761
}
68-
return String(boost::begin(user_info_range), it);
62+
return std::string(boost::begin(user_info_range), it);
6963
}
7064

71-
template <
72-
class String
73-
>
74-
String password(const basic_uri<String> &uri) {
75-
typename basic_uri<String>::const_range_type user_info_range = uri.user_info_range();
76-
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));
7768
for (; it != end; ++it) {
7869
if (*it == ':') {
7970
++it;
8071
break;
8172
}
8273
}
83-
return String(it, boost::end(user_info_range));
74+
return std::string(it, boost::end(user_info_range));
8475
}
8576

86-
template <
87-
class String
88-
>
89-
String decoded_path(const basic_uri<String> &uri) {
90-
typename basic_uri<String>::const_range_type path_range = uri.path_range();
91-
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;
9280
decode(path_range, std::back_inserter(decoded_path));
9381
return decoded_path;
9482
}
9583

96-
template <
97-
class String
98-
>
99-
String decoded_query(const basic_uri<String> &uri) {
100-
typename basic_uri<String>::const_range_type query_range = uri.query_range();
101-
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;
10287
decode(query_range, std::back_inserter(decoded_query));
10388
return decoded_query;
10489
}
10590

106-
template <
107-
class String
108-
>
109-
String decoded_fragment(const basic_uri<String> &uri) {
110-
typename basic_uri<String>::const_range_type fragment_range = uri.fragment_range();
111-
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;
11294
decode(fragment_range, std::back_inserter(decoded_fragment));
11395
return decoded_fragment;
11496
}

0 commit comments

Comments
 (0)