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

Commit3d25ece

Browse files
committed
Refactored URI tests. Big changes ahead.
1 parentf347a5f commit3d25ece

File tree

14 files changed

+781
-605
lines changed

14 files changed

+781
-605
lines changed

‎boost/network/uri/basic_uri.hpp‎

Lines changed: 181 additions & 168 deletions
Original file line numberDiff line numberDiff line change
@@ -2,186 +2,199 @@
22
#defineBOOST_NETWORK_URL_BASIC_URL_
33

44
// Copyright 2009 Dean Michael Berris, Jeroen Habraken.
5+
// Copyright 2010 Glyn Matthews.
56
// Distributed under the Boost Software License, Version 1.0.
67
// (See accompanying file LICENSE_1_0.txt or copy at
78
// http://www.boost.org/LICENSE_1_0.txt)
89

9-
#include<boost/range.hpp>
1010

11-
#include<boost/network/tags.hpp>
1211
#include<boost/network/uri/basic_uri_fwd.hpp>
1312
#include<boost/network/uri/detail/parse_uri.hpp>
14-
#include<boost/network/uri/uri_concept.hpp>
1513

16-
namespaceboost {namespacenetwork {namespaceuri {
1714

18-
template<classTag>
19-
structuri_base {
20-
typedeftypename string<Tag>::type string_type;
21-
22-
uri_base(string_typeconst & uri = string_type())
23-
:
24-
raw_(uri),
25-
parts_(),
26-
valid_(parse_uri(raw_, parts_))
27-
{ }
28-
29-
uri_base(const uri_base & other)
30-
:
31-
raw_(other.raw_),
32-
parts_(other.parts_),
33-
valid_(other.valid_)
34-
{ }
35-
36-
uri_base &operator=(uri_base other) {
37-
other.swap(*this);
38-
return *this;
39-
}
40-
41-
uri_base &operator=(string_typeconst & uri) {
42-
return *this =uri_base(uri);
43-
}
44-
45-
voidswap(uri_base & other) {
46-
using std::swap;
47-
48-
swap(other.raw_, raw_);
49-
swap(other.parts_, parts_);
50-
swap(other.valid_, valid_);
51-
}
52-
53-
string_typescheme()const {
54-
return parts_.scheme;
55-
}
56-
57-
string_typeuser_info()const {
58-
return parts_.user_info ? *parts_.user_info :string_type();
59-
}
60-
61-
string_typehost()const {
62-
return parts_.host ? *parts_.host :string_type();
63-
}
64-
65-
uint16_tport()const {
66-
return parts_.port ? *parts_.port :0;
67-
}
68-
69-
string_typepath()const {
70-
return parts_.path;
71-
}
72-
73-
string_typequery()const {
74-
return parts_.query ? *parts_.query :string_type();
75-
}
76-
77-
string_typefragment()const {
78-
return parts_.fragment ? *parts_.fragment :string_type();
79-
}
80-
81-
string_typeraw()const {
82-
return raw_;
83-
}
84-
85-
boolvalid()const {
86-
return valid_;
87-
}
88-
89-
booloperator==(uri_baseconst & other)const {
90-
return (raw_ == other.raw_) && (parts_ == other.parts_) && (valid_ == other.valid_);
91-
}
92-
93-
booloperator!=(uri_baseconst & other)const {
94-
return !(*this == other);
95-
}
96-
97-
protected:
98-
99-
string_type raw_;
100-
detail::uri_parts<Tag> parts_;
101-
bool valid_;
102-
};
103-
104-
template<classTag>
105-
structbasic_uri : uri_base<Tag> {
106-
using uri_base<Tag>::operator=;
107-
usingtypename uri_base<Tag>::string_type;
108-
using uri_base<Tag>::operator==;
109-
using uri_base<Tag>::operator!=;
110-
basic_uri() : uri_base<Tag>() {}
111-
basic_uri(typename uri_base<Tag>::string_typeconst & uri) : uri_base<Tag>(uri) {}
112-
};
113-
114-
template<classTag>
115-
inline
116-
void
117-
swap(basic_uri<Tag> & left, basic_uri<Tag> & right) {
118-
right.swap(left);
119-
}
120-
121-
template<classTag>
122-
inline
123-
typename string<Tag>::type
124-
scheme(basic_uri<Tag>const & uri) {
125-
return uri.scheme();
126-
}
127-
128-
template<classTag>
129-
inline
130-
typename string<Tag>::type
131-
user_info(basic_uri<Tag>const & uri) {
132-
return uri.user_info();
133-
}
134-
135-
template<classTag>
136-
inline
137-
typename string<Tag>::type
138-
host(basic_uri<Tag>const & uri) {
139-
return uri.host();
140-
}
141-
142-
template<classTag>
143-
inline
144-
uint16_t
145-
port(basic_uri<Tag>const & uri) {
146-
return uri.port();
147-
}
148-
149-
template<classTag>
150-
inline
151-
typename string<Tag>::type
152-
path(basic_uri<Tag>const & uri) {
153-
return uri.path();
154-
}
155-
156-
template<classTag>
157-
inline
158-
typename string<Tag>::type
159-
query(basic_uri<Tag>const & uri) {
160-
return uri.query();
161-
}
162-
163-
template<classTag>
164-
inline
165-
typename string<Tag>::type
166-
fragment(basic_uri<Tag>const & uri) {
167-
return uri.fragment();
168-
}
169-
170-
template<classTag>
171-
inline
172-
bool
173-
valid(basic_uri<Tag>const & uri) {
174-
return uri.valid();
175-
}
176-
177-
// Check that the URI concept is met by the basic_uri type.
178-
BOOST_CONCEPT_ASSERT((URI<basic_uri<boost::network::tags::default_string> >));
179-
BOOST_CONCEPT_ASSERT((URI<basic_uri<boost::network::tags::default_wstring> >));
15+
namespaceboost {namespacenetwork {namespaceuri {
18016

17+
template<classTag>
18+
structuri_base {
19+
typedeftypename string<Tag>::type string_type;
20+
21+
uri_base(string_typeconst & uri = string_type())
22+
:
23+
raw_(uri),
24+
parts_(),
25+
valid_(parse_uri(raw_, parts_))
26+
{ }
27+
28+
uri_base(const uri_base & other)
29+
:
30+
raw_(other.raw_),
31+
parts_(other.parts_),
32+
valid_(other.valid_)
33+
{ }
34+
35+
uri_base &operator=(uri_base other) {
36+
other.swap(*this);
37+
return *this;
38+
}
39+
40+
uri_base &operator=(string_typeconst & uri) {
41+
return *this =uri_base(uri);
42+
}
43+
44+
voidswap(uri_base & other) {
45+
using std::swap;
46+
47+
swap(other.raw_, raw_);
48+
swap(other.parts_, parts_);
49+
swap(other.valid_, valid_);
50+
}
51+
52+
string_typescheme()const {
53+
return parts_.scheme;
54+
}
55+
56+
string_typeuser_info()const {
57+
return parts_.user_info ? *parts_.user_info :string_type();
58+
}
59+
60+
string_typehost()const {
61+
return parts_.host ? *parts_.host :string_type();
62+
}
63+
64+
// uint16_t port() const {
65+
string_typeport()const {
66+
return parts_.port ? *parts_.port :0;
67+
}
68+
69+
string_typepath()const {
70+
return parts_.path;
71+
}
72+
73+
string_typequery()const {
74+
return parts_.query ? *parts_.query :string_type();
75+
}
76+
77+
string_typefragment()const {
78+
return parts_.fragment ? *parts_.fragment :string_type();
79+
}
80+
81+
string_typeraw()const {
82+
returnstring();
83+
}
84+
85+
string_typestring()const {
86+
return raw_;
87+
}
88+
89+
boolvalid()const {
90+
returnis_valid();
91+
}
92+
93+
boolis_valid()const {
94+
return valid_;
95+
}
96+
97+
booloperator == (uri_baseconst & other)const {
98+
return (raw_ == other.raw_) && (parts_ == other.parts_) && (valid_ == other.valid_);
99+
}
100+
101+
booloperator != (uri_baseconst & other)const {
102+
return !(*this == other);
103+
}
104+
105+
protected:
106+
107+
string_type raw_;
108+
detail::uri_parts<Tag> parts_;
109+
bool valid_;
110+
};
111+
112+
template<classTag>
113+
structbasic_uri : uri_base<Tag> {
114+
// using uri_base<Tag>::operator=;
115+
// using typename uri_base<Tag>::string_type;
116+
// using uri_base<Tag>::operator==;
117+
// using uri_base<Tag>::operator!=;
118+
basic_uri() : uri_base<Tag>() {}
119+
basic_uri(typename uri_base<Tag>::string_typeconst & uri) : uri_base<Tag>(uri) {}
120+
};
121+
122+
template<classTag>
123+
inline
124+
voidswap(basic_uri<Tag> & left, basic_uri<Tag> & right) {
125+
right.swap(left);
126+
}
127+
128+
template<classTag>
129+
inline
130+
typename string<Tag>::type
131+
scheme(basic_uri<Tag>const & uri) {
132+
return uri.scheme();
133+
}
134+
135+
template<classTag>
136+
inline
137+
typename string<Tag>::type
138+
hier_part(basic_uri<Tag>const & uri) {
139+
return uri.hier_part();
140+
}
141+
142+
template<classTag>
143+
inline
144+
typename string<Tag>::type
145+
user_info(basic_uri<Tag>const & uri) {
146+
return uri.user_info();
147+
}
148+
149+
template<classTag>
150+
inline
151+
typename string<Tag>::type
152+
host(basic_uri<Tag>const & uri) {
153+
return uri.host();
154+
}
155+
156+
template<classTag>
157+
inline
158+
// uint16_t
159+
typename string<Tag>::type
160+
port(basic_uri<Tag>const & uri) {
161+
return uri.port();
162+
}
163+
164+
template<classTag>
165+
inline
166+
typename string<Tag>::type
167+
path(basic_uri<Tag>const & uri) {
168+
return uri.path();
169+
}
170+
171+
template<classTag>
172+
inline
173+
typename string<Tag>::type
174+
query(basic_uri<Tag>const & uri) {
175+
return uri.query();
176+
}
177+
178+
template<classTag>
179+
inline
180+
typename string<Tag>::type
181+
fragment(basic_uri<Tag>const & uri) {
182+
return uri.fragment();
183+
}
184+
185+
template<classTag>
186+
inline
187+
bool
188+
is_valid(basic_uri<Tag>const & uri) {
189+
return uri.is_valid();
190+
}
191+
//
192+
// // Check that the URI concept is met by the basic_uri type.
193+
// BOOST_CONCEPT_ASSERT((URI<basic_uri<boost::network::tags::default_string> >));
194+
// BOOST_CONCEPT_ASSERT((URI<basic_uri<boost::network::tags::default_wstring> >));
195+
//
181196
}// namespace uri
182-
183197
}// namespace network
184-
185198
}// namespace boost
186199

187200
#endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp