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

Commitc20d1d3

Browse files
committed
First (and limited) draft of URI builder syntax.
1 parent11a11ab commitc20d1d3

File tree

15 files changed

+289
-152
lines changed

15 files changed

+289
-152
lines changed

‎boost/network/uri/builder.hpp‎

Lines changed: 0 additions & 141 deletions
This file was deleted.

‎boost/network/uri/detail/parse_uri.hpp‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,10 @@ struct uri_grammar : qi::grammar<Iterator, detail::uri_parts<String>()> {
115115
;
116116

117117
ipv6address %= qi::raw[
118-
//qi::lit("1080:0:0:0:8:800:200C:417A")
119118
qi::repeat(6)[h16 >>':'] >> ls32
120119
|"::" >>qi::repeat(5)[h16 >>':'] >> ls32
121120
| qi::raw[ h16] >>"::" >>qi::repeat(4)[h16 >>':'] >> ls32
122-
|qi::raw[+(*(h16 >>':')) >> h16] >>"::" >>qi::repeat(3)[h16 >>':'] >> ls32
121+
|qi::raw[ +(*(h16 >>':')) >> h16] >>"::" >>qi::repeat(3)[h16 >>':'] >> ls32
123122
| qi::raw[qi::repeat(2)[*(h16 >>':')] >> h16] >>"::" >>qi::repeat(2)[h16 >>':'] >> ls32
124123
| qi::raw[qi::repeat(3)[*(h16 >>':')] >> h16] >>"::" >> h16 >>':' >> ls32
125124
| qi::raw[qi::repeat(4)[*(h16 >>':')] >> h16] >>"::" >> ls32

‎boost/network/uri/directives.hpp‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#ifndef __BOOST_NETWORK_URI_DIRECTIVES_INC__
2+
#define__BOOST_NETWORK_URI_DIRECTIVES_INC__
3+
4+
5+
#include<boost/network/uri/uri.hpp>
6+
#include<boost/network/uri/directives/scheme.hpp>
7+
#include<boost/network/uri/directives/user_info.hpp>
8+
#include<boost/network/uri/directives/host.hpp>
9+
#include<boost/network/uri/directives/port.hpp>
10+
#include<boost/network/uri/directives/authority.hpp>
11+
#include<boost/network/uri/directives/path.hpp>
12+
#include<boost/network/uri/directives/query.hpp>
13+
#include<boost/network/uri/directives/fragment.hpp>
14+
#include<boost/network/support/is_pod.hpp>
15+
#include<boost/utility/enable_if.hpp>
16+
#include<boost/mpl/if.hpp>
17+
#include<boost/mpl/or.hpp>
18+
19+
20+
namespaceboost {
21+
namespacenetwork {
22+
namespaceuri {
23+
template<
24+
classTag
25+
,classDirective
26+
>
27+
inline
28+
basic_uri<Tag> &operator << (basic_uri<Tag> &uri,const Directive &directive) {
29+
directive(uri);
30+
return uri;
31+
}
32+
}// namespace uri
33+
}// namespace network
34+
}// namespace boost
35+
36+
37+
#endif// __BOOST_NETWORK_URI_DIRECTIVES_INC__
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#ifndef __BOOST_NETWORK_URI_DIRECTIVES_AUTHORITY_INC__
2+
#define__BOOST_NETWORK_URI_DIRECTIVES_AUTHORITY_INC__
3+
4+
5+
namespaceboost {
6+
namespacenetwork {
7+
namespaceuri {
8+
9+
}// namespace uri
10+
}// namespace network
11+
}// namespace boost
12+
13+
14+
#endif// __BOOST_NETWORK_URI_DIRECTIVES_AUTHORITY_INC__
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#ifndef __BOOST_NETWORK_URI_DIRECTIVES_FRAGMENT_INC__
2+
#define__BOOST_NETWORK_URI_DIRECTIVES_FRAGMENT_INC__
3+
4+
5+
namespaceboost {
6+
namespacenetwork {
7+
namespaceuri {
8+
9+
}// namespace uri
10+
}// namespace network
11+
}// namespace boost
12+
13+
14+
#endif// __BOOST_NETWORK_URI_DIRECTIVES_FRAGMENT_INC__
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#ifndef __BOOST_NETWORK_URI_DIRECTIVES_HOST_INC__
2+
#define__BOOST_NETWORK_URI_DIRECTIVES_HOST_INC__
3+
4+
5+
namespaceboost {
6+
namespacenetwork {
7+
namespaceuri {
8+
template<
9+
classValueType
10+
>
11+
structhost_directive {
12+
13+
explicithost_directive(const ValueType &value)
14+
: value(value)
15+
{}
16+
17+
template<
18+
classTag
19+
,template<class>classUri
20+
>
21+
typename enable_if<is_pod<Tag>,void>::type
22+
operator () (Uri<Tag> &uri)const {
23+
uri.append(value);
24+
}
25+
26+
template<
27+
classTag
28+
,template<class>classUri
29+
>
30+
typename enable_if<mpl::not_<is_pod<Tag> >,void>::type
31+
operator () (Uri<Tag> &uri)const {
32+
uri.append(value);
33+
}
34+
35+
const ValueType &value;
36+
37+
};
38+
39+
template<
40+
classT
41+
>
42+
inline
43+
host_directive<T>host(const T &value) {
44+
return host_directive<T>(value);
45+
}
46+
}// namespace uri
47+
}// namespace network
48+
}// namespace boost
49+
50+
51+
#endif// __BOOST_NETWORK_URI_DIRECTIVES_HOST_INC__
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#ifndef __BOOST_NETWORK_URI_DIRECTIVES_PATH_INC__
2+
#define__BOOST_NETWORK_URI_DIRECTIVES_PATH_INC__
3+
4+
5+
namespaceboost {
6+
namespacenetwork {
7+
namespaceuri {
8+
template<
9+
classValueType
10+
>
11+
structpath_directive {
12+
13+
explicitpath_directive(const ValueType &value)
14+
: value(value)
15+
{}
16+
17+
template<
18+
classTag
19+
,template<class>classUri
20+
>
21+
typename enable_if<is_pod<Tag>,void>::type
22+
operator () (Uri<Tag> &uri)const {
23+
uri.append(value);
24+
}
25+
26+
template<
27+
classTag
28+
,template<class>classUri
29+
>
30+
typename enable_if<mpl::not_<is_pod<Tag> >,void>::type
31+
operator () (Uri<Tag> &uri)const {
32+
uri.append(value);
33+
}
34+
35+
const ValueType &value;
36+
37+
};
38+
39+
template<
40+
classT
41+
>
42+
inline
43+
path_directive<T>path(const T &value) {
44+
return path_directive<T>(value);
45+
}
46+
}// namespace uri
47+
}// namespace network
48+
}// namespace boost
49+
50+
51+
#endif// __BOOST_NETWORK_URI_DIRECTIVES_PATH_INC__
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#ifndef __BOOST_NETWORK_URI_DIRECTIVES_PORT_INC__
2+
#define__BOOST_NETWORK_URI_DIRECTIVES_PORT_INC__
3+
4+
5+
namespaceboost {
6+
namespacenetwork {
7+
namespaceuri {
8+
9+
}// namespace uri
10+
}// namespace network
11+
}// namespace boost
12+
13+
14+
#endif// __BOOST_NETWORK_URI_DIRECTIVES_PORT_INC__
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#ifndef __BOOST_NETWORK_URI_DIRECTIVES_QUERY_INC__
2+
#define__BOOST_NETWORK_URI_DIRECTIVES_QUERY_INC__
3+
4+
5+
namespaceboost {
6+
namespacenetwork {
7+
namespaceuri {
8+
9+
}// namespace uri
10+
}// namespace network
11+
}// namespace boost
12+
13+
14+
#endif// __BOOST_NETWORK_URI_DIRECTIVES_QUERY_INC__

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp