replace boost::tuple by std::tuple
This commit is contained in:
		
							parent
							
								
									cf21074f10
								
							
						
					
					
						commit
						69b3457e83
					
				| @ -1,6 +1,6 @@ | ||||
| /*
 | ||||
| 
 | ||||
| Copyright (c) 2013, Project OSRM, Dennis Luxen, others | ||||
| Copyright (c) 2015, Project OSRM, Dennis Luxen, others | ||||
| All rights reserved. | ||||
| 
 | ||||
| Redistribution and use in source and binary forms, with or without modification, | ||||
| @ -52,8 +52,7 @@ void Connection::start() | ||||
| { | ||||
|     TCP_socket.async_read_some( | ||||
|         boost::asio::buffer(incoming_data_buffer), | ||||
|         strand.wrap(boost::bind(&Connection::handle_read, | ||||
|                                 this->shared_from_this(), | ||||
|         strand.wrap(boost::bind(&Connection::handle_read, this->shared_from_this(), | ||||
|                                 boost::asio::placeholders::error, | ||||
|                                 boost::asio::placeholders::bytes_transferred))); | ||||
| } | ||||
| @ -68,11 +67,9 @@ void Connection::handle_read(const boost::system::error_code &error, std::size_t | ||||
|     // no error detected, let's parse the request
 | ||||
|     CompressionType compression_type(noCompression); | ||||
|     boost::tribool result; | ||||
|     boost::tie(result, boost::tuples::ignore) = | ||||
|         RequestParser().Parse(request, | ||||
|                               incoming_data_buffer.data(), | ||||
|                               incoming_data_buffer.data() + bytes_transferred, | ||||
|                               compression_type); | ||||
|     std::tie(result, std::ignore) = | ||||
|         RequestParser().Parse(request, incoming_data_buffer.data(), | ||||
|                               incoming_data_buffer.data() + bytes_transferred, compression_type); | ||||
| 
 | ||||
|     // the request has been parsed
 | ||||
|     if (result) | ||||
| @ -110,29 +107,26 @@ void Connection::handle_read(const boost::system::error_code &error, std::size_t | ||||
|             break; | ||||
|         } | ||||
|         // write result to stream
 | ||||
|         boost::asio::async_write(TCP_socket, | ||||
|                                  output_buffer, | ||||
|                                  strand.wrap(boost::bind(&Connection::handle_write, | ||||
|                                                          this->shared_from_this(), | ||||
|                                                          boost::asio::placeholders::error))); | ||||
|         boost::asio::async_write( | ||||
|             TCP_socket, output_buffer, | ||||
|             strand.wrap(boost::bind(&Connection::handle_write, this->shared_from_this(), | ||||
|                                     boost::asio::placeholders::error))); | ||||
|     } | ||||
|     else if (!result) | ||||
|     { // request is not parseable
 | ||||
|         reply = Reply::StockReply(Reply::badRequest); | ||||
| 
 | ||||
|         boost::asio::async_write(TCP_socket, | ||||
|                                  reply.ToBuffers(), | ||||
|                                  strand.wrap(boost::bind(&Connection::handle_write, | ||||
|                                                          this->shared_from_this(), | ||||
|                                                          boost::asio::placeholders::error))); | ||||
|         boost::asio::async_write( | ||||
|             TCP_socket, reply.ToBuffers(), | ||||
|             strand.wrap(boost::bind(&Connection::handle_write, this->shared_from_this(), | ||||
|                                     boost::asio::placeholders::error))); | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         // we don't have a result yet, so continue reading
 | ||||
|         TCP_socket.async_read_some( | ||||
|             boost::asio::buffer(incoming_data_buffer), | ||||
|             strand.wrap(boost::bind(&Connection::handle_read, | ||||
|                                     this->shared_from_this(), | ||||
|             strand.wrap(boost::bind(&Connection::handle_read, this->shared_from_this(), | ||||
|                                     boost::asio::placeholders::error, | ||||
|                                     boost::asio::placeholders::bytes_transferred))); | ||||
|     } | ||||
|  | ||||
| @ -36,7 +36,7 @@ RequestParser::RequestParser() : state_(method_start), header({"", ""}) {} | ||||
| 
 | ||||
| void RequestParser::Reset() { state_ = method_start; } | ||||
| 
 | ||||
| boost::tuple<boost::tribool, char *> | ||||
| std::tuple<boost::tribool, char *> | ||||
| RequestParser::Parse(Request &req, char *begin, char *end, http::CompressionType &compression_type) | ||||
| { | ||||
|     while (begin != end) | ||||
| @ -44,11 +44,11 @@ RequestParser::Parse(Request &req, char *begin, char *end, http::CompressionType | ||||
|         boost::tribool result = consume(req, *begin++, compression_type); | ||||
|         if (result || !result) | ||||
|         { | ||||
|             return boost::make_tuple(result, begin); | ||||
|             return std::make_tuple(result, begin); | ||||
|         } | ||||
|     } | ||||
|     boost::tribool result = boost::indeterminate; | ||||
|     return boost::make_tuple(result, begin); | ||||
|     return std::make_tuple(result, begin); | ||||
| } | ||||
| 
 | ||||
| boost::tribool | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| /*
 | ||||
| 
 | ||||
| Copyright (c) 2013, Project OSRM, Dennis Luxen, others | ||||
| Copyright (c) 2015, Project OSRM, Dennis Luxen, others | ||||
| All rights reserved. | ||||
| 
 | ||||
| Redistribution and use in source and binary forms, with or without modification, | ||||
| @ -32,7 +32,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| #include "Http/Header.h" | ||||
| 
 | ||||
| #include <boost/logic/tribool.hpp> | ||||
| #include <boost/tuple/tuple.hpp> | ||||
| 
 | ||||
| #include <tuple> | ||||
| 
 | ||||
| namespace http | ||||
| { | ||||
| @ -45,7 +46,7 @@ class RequestParser | ||||
|     RequestParser(); | ||||
|     void Reset(); | ||||
| 
 | ||||
|     boost::tuple<boost::tribool, char *> | ||||
|     std::tuple<boost::tribool, char *> | ||||
|     Parse(Request &req, char *begin, char *end, CompressionType &compression_type); | ||||
| 
 | ||||
|   private: | ||||
| @ -60,27 +61,29 @@ class RequestParser | ||||
|     inline bool isDigit(int c); | ||||
| 
 | ||||
|     enum state | ||||
|     { method_start, | ||||
|       method, | ||||
|       uri_start, | ||||
|       uri, | ||||
|       http_version_h, | ||||
|       http_version_t_1, | ||||
|       http_version_t_2, | ||||
|       http_version_p, | ||||
|       http_version_slash, | ||||
|       http_version_major_start, | ||||
|       http_version_major, | ||||
|       http_version_minor_start, | ||||
|       http_version_minor, | ||||
|       expecting_newline_1, | ||||
|       header_line_start, | ||||
|       header_lws, | ||||
|       header_name, | ||||
|       space_before_header_value, | ||||
|       header_value, | ||||
|       expecting_newline_2, | ||||
|       expecting_newline_3 } state_; | ||||
|     { | ||||
|         method_start, | ||||
|         method, | ||||
|         uri_start, | ||||
|         uri, | ||||
|         http_version_h, | ||||
|         http_version_t_1, | ||||
|         http_version_t_2, | ||||
|         http_version_p, | ||||
|         http_version_slash, | ||||
|         http_version_major_start, | ||||
|         http_version_major, | ||||
|         http_version_minor_start, | ||||
|         http_version_minor, | ||||
|         expecting_newline_1, | ||||
|         header_line_start, | ||||
|         header_lws, | ||||
|         header_name, | ||||
|         space_before_header_value, | ||||
|         header_value, | ||||
|         expecting_newline_2, | ||||
|         expecting_newline_3 | ||||
|     } state_; | ||||
| 
 | ||||
|     Header header; | ||||
| }; | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user