@@ -25,6 +25,10 @@ template <
25
25
struct key_value_sequence
26
26
: spirit::qi::grammar<uri::const_iterator, Map()>
27
27
{
28
+ typedef typename Map::key_type key_type;
29
+ typedef typename Map::mapped_type mapped_type;
30
+ typedef std::pair<key_type, mapped_type> pair_type;
31
+
28
32
key_value_sequence ()
29
33
: key_value_sequence::base_type(query)
30
34
{
@@ -35,8 +39,9 @@ struct key_value_sequence
35
39
}
36
40
37
41
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;
42
+ spirit::qi::rule<uri::const_iterator, pair_type()> pair;
43
+ spirit::qi::rule<uri::const_iterator, key_type()> key;
44
+ spirit::qi::rule<uri::const_iterator, mapped_type()> value;
40
45
};
41
46
} // namespace details
42
47
@@ -45,57 +50,57 @@ template <
45
50
>
46
51
inline
47
52
Map &query_map (const uri &uri_, Map &map) {
48
- const std::string range = uri_.query ();
53
+ const uri::string_type range = uri_.query ();
49
54
details::key_value_sequence<Map> parser;
50
55
spirit::qi::parse (boost::begin (range), boost::end (range), parser, map);
51
56
return map;
52
57
}
53
58
54
59
inline
55
- std::string username (const uri &uri_) {
56
- const std::string user_info = uri_.user_info ();
60
+ uri::string_type username (const uri &uri_) {
61
+ const uri::string_type user_info = uri_.user_info ();
57
62
uri::const_iterator it (boost::begin (user_info)), end (boost::end (user_info));
58
63
for (; it != end; ++it) {
59
64
if (*it == ' :' ) {
60
65
break ;
61
66
}
62
67
}
63
- return std::string (boost::begin (user_info), it);
68
+ return uri::string_type (boost::begin (user_info), it);
64
69
}
65
70
66
71
inline
67
- std::string password (const uri &uri_) {
68
- const std::string user_info = uri_.user_info ();
72
+ uri::string_type password (const uri &uri_) {
73
+ const uri::string_type user_info = uri_.user_info ();
69
74
uri::const_iterator it (boost::begin (user_info)), end (boost::end (user_info));
70
75
for (; it != end; ++it) {
71
76
if (*it == ' :' ) {
72
77
++it;
73
78
break ;
74
79
}
75
80
}
76
- return std::string (it, boost::end (user_info));
81
+ return uri::string_type (it, boost::end (user_info));
77
82
}
78
83
79
84
inline
80
- std::string decoded_path (const uri &uri_) {
81
- const std::string path = uri_.path ();
82
- std::string decoded_path;
85
+ uri::string_type decoded_path (const uri &uri_) {
86
+ const uri::string_type path = uri_.path ();
87
+ uri::string_type decoded_path;
83
88
decode (path, std::back_inserter (decoded_path));
84
89
return decoded_path;
85
90
}
86
91
87
92
inline
88
- std::string decoded_query (const uri &uri_) {
89
- const std::string query = uri_.query ();
90
- std::string decoded_query;
93
+ uri::string_type decoded_query (const uri &uri_) {
94
+ const uri::string_type query = uri_.query ();
95
+ uri::string_type decoded_query;
91
96
decode (query, std::back_inserter (decoded_query));
92
97
return decoded_query;
93
98
}
94
99
95
100
inline
96
- std::string decoded_fragment (const uri &uri_) {
97
- const std::string fragment = uri_.fragment ();
98
- std::string decoded_fragment;
101
+ uri::string_type decoded_fragment (const uri &uri_) {
102
+ const uri::string_type fragment = uri_.fragment ();
103
+ uri::string_type decoded_fragment;
99
104
decode (fragment, std::back_inserter (decoded_fragment));
100
105
return decoded_fragment;
101
106
}
0 commit comments