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

Commitf8684e4

Browse files
committed
Replaced old, old URI class with the new dependency.
1 parent6686ebd commitf8684e4

40 files changed

+92
-2841
lines changed

‎CMakeLists.txt‎

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ if (Boost_FOUND)
107107
add_subdirectory(libs/network/src)
108108
if (CPP-NETLIB_BUILD_TESTS)
109109
add_subdirectory(deps/googletest)
110-
add_subdirectory(libs/network/test)
111110
add_subdirectory(deps/uri/test)
111+
add_subdirectory(libs/network/test)
112112
endif (CPP-NETLIB_BUILD_TESTS)
113113
if (CPP-NETLIB_BUILD_EXAMPLES)
114114
add_subdirectory(libs/network/example)
@@ -123,39 +123,39 @@ enable_testing()
123123

124124
install(DIRECTORY boostDESTINATION${CMAKE_INSTALL_INCLUDEDIR})
125125

126-
###
127-
## Export Targets
128-
# (so cpp-netlib can be easily used by other CMake projects)
129-
# [see http://www.cmake.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file]
130-
131-
# Add all targets to the build-tree export set
132-
export(TARGETS cppnetlib-client-connections cppnetlib-server-parsers cppnetlib-uri
133-
FILE"${PROJECT_BINARY_DIR}/cppnetlibTargets.cmake")
134-
# Export the package for use from the build-tree
135-
# (this registers the build-tree with a global CMake-registry)
136-
export(PACKAGE cppnetlib)
137-
# Create the cppnetlibConfig.cmake and cppnetlibConfigVersion files
138-
file(RELATIVE_PATH REL_INCLUDE_DIR"${INSTALL_CMAKE_DIR}"
139-
"${CMAKE_INSTALL_FULL_INCLUDEDIR}")
140-
# ... for the build tree
141-
set(CONF_INCLUDE_DIRS"${PROJECT_SOURCE_DIR}"${Boost_INCLUDE_DIRS})
142-
configure_file(cppnetlibConfig.cmake.in
143-
"${PROJECT_BINARY_DIR}/cppnetlibConfig.cmake" @ONLY)
144-
# ... for the install tree
145-
set(CONF_INCLUDE_DIRS"\${CPPNETLIB_CMAKE_DIR}/${REL_INCLUDE_DIR}")
146-
set(CONF_INCLUDE_DIRS${CONF_INCLUDE_DIRS}${Boost_INCLUDE_DIRS})
147-
configure_file(cppnetlibConfig.cmake.in
148-
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/cppnetlibConfig.cmake" @ONLY)
149-
# ... for both
150-
configure_file(cppnetlibConfigVersion.cmake.in
151-
"${PROJECT_BINARY_DIR}/cppnetlibConfigVersion.cmake" @ONLY)
152-
# Install the cppnetlibConfig.cmake and cppnetlibConfigVersion.cmake
153-
install(FILES
154-
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/cppnetlibConfig.cmake"
155-
"${PROJECT_BINARY_DIR}/cppnetlibConfigVersion.cmake"
156-
DESTINATION"${INSTALL_CMAKE_DIR}"
157-
COMPONENT dev)
158-
# Install the export set for use with the install-tree
159-
install(EXPORT cppnetlibTargets
160-
DESTINATION"${INSTALL_CMAKE_DIR}"
161-
COMPONENT dev)
126+
# ###
127+
# ## Export Targets
128+
##(so cpp-netlib can be easily used by other CMake projects)
129+
##[see http://www.cmake.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file]
130+
#
131+
##Add all targets to the build-tree export set
132+
#export(TARGETS cppnetlib-client-connections cppnetlib-server-parsers cppnetlib-uri
133+
# FILE "${PROJECT_BINARY_DIR}/cppnetlibTargets.cmake")
134+
##Export the package for use from the build-tree
135+
##(this registers the build-tree with a global CMake-registry)
136+
#export(PACKAGE cppnetlib)
137+
##Create the cppnetlibConfig.cmake and cppnetlibConfigVersion files
138+
#file(RELATIVE_PATH REL_INCLUDE_DIR "${INSTALL_CMAKE_DIR}"
139+
# "${CMAKE_INSTALL_FULL_INCLUDEDIR}")
140+
##... for the build tree
141+
#set(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}" ${Boost_INCLUDE_DIRS})
142+
#configure_file(cppnetlibConfig.cmake.in
143+
# "${PROJECT_BINARY_DIR}/cppnetlibConfig.cmake" @ONLY)
144+
##... for the install tree
145+
#set(CONF_INCLUDE_DIRS "\${CPPNETLIB_CMAKE_DIR}/${REL_INCLUDE_DIR}")
146+
#set(CONF_INCLUDE_DIRS ${CONF_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
147+
#configure_file(cppnetlibConfig.cmake.in
148+
# "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/cppnetlibConfig.cmake" @ONLY)
149+
##... for both
150+
#configure_file(cppnetlibConfigVersion.cmake.in
151+
# "${PROJECT_BINARY_DIR}/cppnetlibConfigVersion.cmake" @ONLY)
152+
##Install the cppnetlibConfig.cmake and cppnetlibConfigVersion.cmake
153+
#install(FILES
154+
# "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/cppnetlibConfig.cmake"
155+
# "${PROJECT_BINARY_DIR}/cppnetlibConfigVersion.cmake"
156+
# DESTINATION "${INSTALL_CMAKE_DIR}"
157+
# COMPONENT dev)
158+
##Install the export set for use with the install-tree
159+
#install(EXPORT cppnetlibTargets
160+
# DESTINATION "${INSTALL_CMAKE_DIR}"
161+
# COMPONENT dev)

‎boost/network/protocol/http/impl/request.hpp‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818

1919
#include<cstdint>
20+
#include<network/uri/uri.hpp>
2021
#include<boost/algorithm/string.hpp>
2122
#include<boost/fusion/container/map.hpp>
2223
#include<boost/fusion/sequence/intrinsic/at_key.hpp>
@@ -29,7 +30,6 @@
2930
#include<boost/network/protocol/http/message/wrappers/headers.hpp>
3031
#include<boost/network/support/is_async.hpp>
3132
#include<boost/network/traits/vector.hpp>
32-
#include<boost/network/uri/uri.hpp>
3333

3434
namespaceboost {
3535
namespacenetwork {
@@ -50,7 +50,7 @@ namespace http {
5050
*/
5151
template<classTag>
5252
structbasic_request :publicbasic_message<Tag> {
53-
boost::network::uri::uri uri_;
53+
::network::uri uri_;
5454
std::uint16_t source_port_;
5555
typedef basic_message<Tag> base_type;
5656

@@ -62,7 +62,7 @@ struct basic_request : public basic_message<Tag> {
6262
explicitbasic_request(string_typeconst& uri_)
6363
: uri_(uri_), source_port_(0) {}
6464

65-
explicitbasic_request(boost::network::uri::uriconst& uri_)
65+
explicitbasic_request(::network::uriconst& uri_)
6666
: uri_(uri_), source_port_(0) {}
6767

6868
basic_request() : base_type(), source_port_(0) {}
@@ -83,29 +83,29 @@ struct basic_request : public basic_message<Tag> {
8383
boost::swap(other.source_port_,this->source_port_);
8484
}
8585

86-
string_typeconsthost()const {return uri_.host(); }
86+
string_typeconsthost()const {return uri_.host().to_string(); }
8787

8888
port_typeport()const {
89-
boost::optional<port_type> port =uri::port_us(uri_);
90-
if (!port) {
89+
if (uri_.has_port()) {
90+
return uri_.port<std::uint16_t>();
91+
}
92+
else {
9193
typedef constants<Tag> consts;
92-
returnboost::iequals(uri_.scheme(),string_type(consts::https())) ?443
93-
:80;
94+
returnboost::iequals(uri_.scheme(),string_type(consts::https())) ?443 :80;
9495
}
95-
return *port;
9696
}
9797

98-
string_typeconstpath()const {return uri_.path(); }
98+
string_typeconstpath()const {return uri_.path().to_string(); }
9999

100-
string_typeconstquery()const {return uri_.query(); }
100+
string_typeconstquery()const {return uri_.query().to_string(); }
101101

102-
string_typeconstanchor()const {return uri_.fragment(); }
102+
string_typeconstanchor()const {return uri_.fragment().to_string(); }
103103

104-
string_typeconstprotocol()const {return uri_.scheme(); }
104+
string_typeconstprotocol()const {return uri_.scheme().to_string(); }
105105

106106
voiduri(string_typeconst& new_uri)const { uri_ = new_uri; }
107107

108-
boost::network::uri::uriconst&uri()const {return uri_; }
108+
::network::uriconst&uri()const {return uri_; }
109109

110110
voidsource_port(const std::uint16_t port) { source_port_ = port; }
111111

‎boost/network/protocol/http/message/wrappers/port.hpp‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// http://www.boost.org/LICENSE_1_0.txt)
1111

1212
#include<cstdint>
13-
#include<boost/network/uri/accessors.hpp>
13+
#include<network/uri/uri.hpp>
1414
#include<boost/optional.hpp>
1515
#include<boost/version.hpp>
1616

@@ -38,13 +38,14 @@ struct port_wrapper {
3838
// conversions no longer work correctly with MSVC. The conversion therefore
3939
// has to be done explicitly with as_optional().
4040
boost::optional<std::uint16_t>as_optional()const {
41-
returnuri::port_us(message_.uri());
42-
}
4341
#else
4442
operator boost::optional<std::uint16_t>()const {
45-
returnuri::port_us(message_.uri());
46-
}
4743
#endif
44+
if (message_.uri().has_port()) {
45+
return message_.uri().templateport<std::uint16_t>();
46+
}
47+
return boost::optional<std::uint16_t>();
48+
}
4849

4950
};
5051

‎boost/network/protocol/http/message/wrappers/uri.hpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// (See accompanying file LICENSE_1_0.txt or copy at
88
// http://www.boost.org/LICENSE_1_0.txt)
99

10-
#include<boost/network/uri/uri.hpp>
10+
#include<network/uri/uri.hpp>
1111

1212
namespaceboost {
1313
namespacenetwork {
@@ -22,8 +22,8 @@ struct uri_wrapper {
2222
basic_request<Tag>const& message_;
2323
explicituri_wrapper(basic_request<Tag>const& message) : message_(message) {}
2424
typedeftypename basic_request<Tag>::string_type string_type;
25-
operatorstring_type() {return message_.uri().raw(); }
26-
operatorboost::network::uri::uri() {return message_.uri(); }
25+
operatorstring_type() {return message_.uri().to_string(); }
26+
operator::network::uri() {return message_.uri(); }
2727
};
2828
}// namespace impl
2929

‎boost/network/protocol/stream_handler.hpp‎

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,8 @@ struct stream_handler {
7373
tcp_sock_->async_write_some(buffers, handler);
7474
}
7575
}
76-
catch (const std::error_code& e) {
77-
std::cerr << e.message() << std::endl;
78-
}
79-
catch (const std::system_error& e) {
80-
std::cerr << e.code() <<":" << e.what() << std::endl;
76+
catch (const std::system_error&) {
77+
// print system error
8178
}
8279
}
8380

@@ -93,11 +90,8 @@ struct stream_handler {
9390
tcp_sock_->async_read_some(buffers, handler);
9491
}
9592
}
96-
catch (const std::error_code& e) {
97-
std::cerr << e.message() << std::endl;
98-
}
9993
catch (const std::system_error& e) {
100-
std::cerr << e.code() <<":" << e.what() << std::endl;
94+
// print system error
10195
}
10296
}
10397

@@ -126,11 +120,8 @@ struct stream_handler {
126120
tcp_sock_->shutdown(::asio::ip::tcp::socket::shutdown_send, e);
127121
}
128122
}
129-
catch (const std::error_code& e) {
130-
std::cerr << e.message() << std::endl;
131-
}
132123
catch (const std::system_error& e) {
133-
std::cerr << e.code() <<":" << e.what() << std::endl;
124+
134125
}
135126
}
136127

@@ -162,11 +153,8 @@ struct stream_handler {
162153
// NOOP
163154
}
164155
}
165-
catch (const std::error_code& e) {
166-
std::cerr << e.message() << std::endl;
167-
}
168156
catch (const std::system_error& e) {
169-
std::cerr << e.code() <<":" << e.what() << std::endl;
157+
170158
}
171159
}
172160
std::shared_ptr<tcp_socket>get_tcp_socket() {return tcp_sock_; }

‎boost/network/uri.hpp‎

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

‎boost/network/uri/accessors.hpp‎

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp