Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7b88a41

Browse files
committed
Reintroduce missing code for parsing query maps
1 parent5f6e9ee commit7b88a41

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

‎boost/network/uri/accessors.hpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@ struct key_value_sequence : spirit::qi::grammar<uri::const_iterator, Map()> {
2222
typedeftypename Map::mapped_type mapped_type;
2323
typedef std::pair<key_type, mapped_type> pair_type;
2424

25-
key_value_sequence() : key_value_sequence::base_type(query) {};
25+
key_value_sequence() : key_value_sequence::base_type(query) {
26+
query = pair >> *((spirit::qi::lit(';') |'&') >> pair);
27+
pair = key >> -('=' >> value);
28+
key =
29+
spirit::qi::char_("a-zA-Z_") >> *spirit::qi::char_("-+.~a-zA-Z_0-9/%");
30+
value = *spirit::qi::char_("-+.~a-zA-Z_0-9/%");
31+
};
2632

2733
spirit::qi::rule<uri::const_iterator, Map()> query;
2834
spirit::qi::rule<uri::const_iterator, pair_type()> pair;

‎boost/network/uri/uri.hpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class BOOST_URI_DECL uri {
4646
// parse();
4747
//}
4848

49-
uri(const string_type &uri) : uri_(uri), is_valid_(false) {parse(); }
49+
uri(const string_type &str) : uri_(str), is_valid_(false) {parse(); }
5050

5151
template<classFwdIter>
5252
uri(const FwdIter &first,const FwdIter &last)
@@ -109,8 +109,9 @@ class BOOST_URI_DECL uri {
109109
}
110110

111111
// hackfix by Simon Haegler, Esri R&D Zurich
112-
// this workaround is needed to avoid running into the "incompatible string iterator" assertion
113-
// triggered by the default-constructed string iterators employed by cpp-netlib (see uri.ipp qi::rule declarations)
112+
// this workaround is needed to avoid running into the "incompatible string
113+
// iterator" assertion triggered by the default-constructed string iterators
114+
// employed by cpp-netlib (see uri.ipp qi::rule declarations)
114115
#if defined(_MSC_VER) && defined(_DEBUG)
115116
#defineCATCH_EMPTY_ITERATOR_RANGEif (range.begin()._Getcont() ==0 || range.end()._Getcont() ==0) {returnstring_type(); }
116117
#else
@@ -120,7 +121,7 @@ class BOOST_URI_DECL uri {
120121
string_typescheme()const {
121122
const_range_type range =scheme_range();
122123
CATCH_EMPTY_ITERATOR_RANGE
123-
return range ?string_type(boost::begin(range),boost::end(range))
124+
return range ?string_type(boost::begin(range),boost::end(range))
124125
:string_type();
125126
}
126127

@@ -166,6 +167,10 @@ class BOOST_URI_DECL uri {
166167
:string_type();
167168
}
168169

170+
#ifdef CATCH_EMPTY_ITERATOR_RANGE
171+
#undef CATCH_EMPTY_ITERATOR_RANGE
172+
#endif
173+
169174
string_typestring()const {return uri_; }
170175

171176
boolis_valid()const {return is_valid_; }

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp