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

Commit3d7a7a8

Browse files
committed
Added some missing headers and made minor changes for C++11 features that aren't implemented in MSVC 2012 (yet).
1 parentac5c9b3 commit3d7a7a8

File tree

9 files changed

+30
-18
lines changed

9 files changed

+30
-18
lines changed

‎include/network/message/message.hpp‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ namespace network {
2727
// Constructors
2828
message();
2929
message(messageconst & other);
30+
#if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS)
3031
message(message && other) = default;
32+
#endif// !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS)
3133

3234
// Assignment
3335
message&operator=(messageconst &other);

‎include/network/message/wrappers/body.hpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include<boost/range/iterator.hpp>
1111
#include<boost/optional.hpp>
1212
#include<network/message/message_base.hpp>
13+
#include<string>
1314

1415
namespacenetwork {
1516

‎include/network/protocol/http/response/response_base.hpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#defineNETWORK_PROTOCOL_HTTP_RESPONSE_BASE_HPP_20110930
99

1010
#include<network/message/message_base.hpp>
11+
#include<cstdint>
1112

1213
namespacenetwork {namespacehttp {
1314

‎include/network/protocol/http/server/async_impl.hpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#defineNETWORK_PROTOCOL_HTTP_SERVER_ASYNC_IMPL_20120318
99

1010
#include<functional>
11+
#include<mutex>
1112
#include<boost/asio/ip/tcp.hpp>
1213
#include<network/protocol/http/server/options.hpp>
1314
#include<network/protocol/http/server/impl/socket_options_setter.hpp>

‎include/network/protocol/http/server/connection/async.hpp‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
#ifndef NETWORK_HTTP_SERVER_CONNECTION_HEADER_BUFFER_MAX_SIZE
3939
/** Here we define a page's worth of header connection buffer data.
40-
* This can be tuned to reduce the memory cost of connections, but this
40+
* This can be tuned to reduce the memory cost of connections, but this
4141
* default size is set to be friendly to typical service applications.
4242
* This is the maximum size though and Boost.Asio's internal representation
4343
* of a streambuf would make appropriate decisions on how big a buffer
@@ -91,7 +91,7 @@ namespace network { namespace http {
9191

9292
private:
9393
staticcharconst *status_message(status_t status) {
94-
staticcharconst
94+
staticcharconst
9595
ok_[] ="OK"
9696
, created_[] ="Created"
9797
, accepted_[] ="Accepted"
@@ -160,9 +160,9 @@ namespace network { namespace http {
160160

161161
/** Function: template <class Range> set_headers(Range headers)
162162
* Precondition: headers have not been sent yet
163-
* Postcondition: headers have been linearized to a buffer,
163+
* Postcondition: headers have been linearized to a buffer,
164164
* and assumed to have been sent already when the function exits
165-
* Throws: std::logic_error in case the headers have already been sent.
165+
* Throws: std::logic_error in case the headers have already been sent.
166166
*
167167
* A call to set_headers takes a Range where each element models the
168168
* Header concept. This Range will be linearized onto a buffer, which is
@@ -171,7 +171,7 @@ namespace network { namespace http {
171171
template<classRange>
172172
voidset_headers(Range headers) {
173173
lock_guardlock(headers_mutex);
174-
if (headers_in_progress || headers_already_sent)
174+
if (headers_in_progress || headers_already_sent)
175175
boost::throw_exception(std::logic_error("Headers have already been sent."));
176176

177177
if (error_encountered)
@@ -185,7 +185,7 @@ namespace network { namespace http {
185185
<<constants::crlf();
186186
if (!boost::empty(headers)) {
187187
typedeftypename Range::const_iterator iterator;
188-
boost::transform(headers,
188+
boost::transform(headers,
189189
std::ostream_iterator<std::string>(stream),
190190
linearize_header());
191191
}else {
@@ -213,7 +213,7 @@ namespace network { namespace http {
213213
voidwrite(Rangeconst & range) {
214214
lock_guardlock(headers_mutex);
215215
if (error_encountered)boost::throw_exception(boost::system::system_error(*error_encountered));
216-
std::function<void(boost::system::error_code)> f =
216+
std::function<void(boost::system::error_code)> f =
217217
std::bind(
218218
&async_server_connection::default_error
219219
,async_server_connection::shared_from_this()
@@ -319,7 +319,7 @@ namespace network { namespace http {
319319
status_t status;
320320
request_parser parser;
321321
request request_;
322-
typenamebuffer_type::iterator new_start, data_end;
322+
buffer_type::iterator new_start, data_end;
323323
std::string partial_parsed;
324324
boost::optional<boost::system::system_error> error_encountered;
325325
pending_actions_list pending_actions;
@@ -365,7 +365,7 @@ namespace network { namespace http {
365365
new_start, data_end);
366366
boost::fusion::tie(parsed_ok, result_range) = parser.parse_until(
367367
request_parser::method_done, input_range);
368-
if (!parsed_ok) {
368+
if (!parsed_ok) {
369369
client_error();
370370
break;
371371
}elseif (parsed_ok ==true) {
@@ -479,7 +479,7 @@ namespace network { namespace http {
479479
}
480480

481481
voidclient_error() {
482-
staticcharconst * bad_request =
482+
staticcharconst * bad_request =
483483
"HTTP/1.0 400 Bad Request\r\nConnection: close\r\nContent-Type: text/plain\r\nContent-Length: 12\r\n\r\nBad Request.";
484484

485485
boost::asio::async_write(
@@ -565,17 +565,17 @@ namespace network { namespace http {
565565

566566
static std::size_tconst connection_buffer_size =
567567
NETWORK_HTTP_SERVER_CONNECTION_BUFFER_SIZE;
568-
shared_array_list temporaries =
568+
shared_array_list temporaries =
569569
std::make_shared<array_list>();
570-
shared_buffers buffers =
570+
shared_buffers buffers =
571571
std::make_shared<std::vector<boost::asio::const_buffer> >(0);
572572

573573
std::size_t range_size =boost::distance(range);
574574
buffers->reserve(
575575
(range_size / connection_buffer_size)
576576
+ ((range_size % connection_buffer_size)?1:0)
577577
);
578-
std::size_t slice_size =
578+
std::size_t slice_size =
579579
std::min(range_size,connection_buffer_size);
580580
typename boost::range_iterator<Range>::type
581581
start =boost::begin(range)
@@ -641,8 +641,8 @@ namespace network { namespace http {
641641
);
642642
}
643643
};
644-
644+
645645
}// namespace http
646646
}// namespace network
647-
647+
648648
#endif/* NETWORK_PROTOCOL_HTTP_SERVER_CONNECTION_HPP_20101027*/

‎include/network/protocol/http/server/connection/sync.hpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include<boost/lexical_cast.hpp>
3030
#include<boost/algorithm/string/case_conv.hpp>
3131
#include<functional>
32+
#include<mutex>
3233

3334
namespacenetwork {namespacehttp {
3435

@@ -337,4 +338,3 @@ class sync_server_connection : public boost::enable_shared_from_this<sync_server
337338
}// namespace network
338339

339340
#endif// NETWORK_HTTP_SERVER_SYNC_CONNECTION_HPP_
340-

‎include/network/protocol/http/server/sync_impl.hpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include<functional>
1111
#include<memory>
1212
#include<thread>
13+
#include<mutex>
1314
#include<boost/asio/ip/tcp.hpp>
1415
#include<network/protocol/http/server/impl/socket_options_setter.hpp>
1516
#include<network/protocol/http/server/options.hpp>

‎include/network/utils/thread_pool.hpp‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,14 @@ namespace network { namespace utils {
2525
structthread_pool {
2626
thread_pool(std::size_t threads =1,
2727
io_service_ptr io_service = io_service_ptr(),
28-
std::vector<std::thread> worker_threads = {});
28+
std::vector<std::thread> worker_threads = std::vector<std::thread>());
29+
#if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
2930
thread_pool(thread_poolconst&) = delete;
31+
#endif// !defined(BOOST_NO_CXX11_DELETEED_FUNCTIONS)
3032
thread_pool(thread_pool &&other);
33+
#if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
3134
thread_pool&operator=(thread_poolconst&) =delete;
35+
#endif// !defined(BOOST_NO_CXX11_DELETEED_FUNCTIONS)
3236
thread_pool&operator=(thread_pool &&other);
3337
std::size_tconstthread_count()const;
3438
voidpost(std::function<void()> f);

‎include/network/utils/thread_pool.ipp‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace network { namespace utils {
1717
structthread_pool_pimpl {
1818
thread_pool_pimpl(std::size_t threads =1,
1919
io_service_ptr io_service = io_service_ptr(),
20-
std::vector<std::thread> worker_threads ={})
20+
std::vector<std::thread> worker_threads =std::vector<std::thread>())
2121
: threads_(threads)
2222
, io_service_(io_service)
2323
, worker_threads_(std::move(worker_threads))
@@ -45,8 +45,10 @@ namespace network { namespace utils {
4545
commit =true;
4646
}
4747

48+
#if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS)
4849
thread_pool_pimpl(thread_pool_pimplconst &) = delete;
4950
thread_pool_pimpl &operator=(thread_pool_pimplconst &) =delete;
51+
#endif// !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS)
5052

5153
thread_pool_pimpl(thread_pool_pimpl&& other) {
5254
other.swap(*this);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp