Remove consuming_buffers from the public interface.

This commit is contained in:
chris_kohlhoff 2005-11-03 05:02:18 +00:00
parent 2424440a81
commit 230349be73
12 changed files with 32 additions and 59 deletions

View File

@ -13,7 +13,6 @@ nobase_include_HEADERS = \
asio/buffered_stream.hpp \
asio/buffered_write_stream_fwd.hpp \
asio/buffered_write_stream.hpp \
asio/consuming_buffers.hpp \
asio/datagram_socket.hpp \
asio/datagram_socket_service.hpp \
asio/deadline_timer.hpp \
@ -23,6 +22,7 @@ nobase_include_HEADERS = \
asio/demuxer_service.hpp \
asio/detail/bind_handler.hpp \
asio/detail/buffer_resize_guard.hpp \
asio/detail/consuming_buffers.hpp \
asio/detail/demuxer_run_call_stack.hpp \
asio/detail/epoll_reactor.hpp \
asio/detail/event.hpp \

View File

@ -28,7 +28,6 @@
#include "asio/buffered_stream.hpp"
#include "asio/buffered_write_stream_fwd.hpp"
#include "asio/buffered_write_stream.hpp"
#include "asio/consuming_buffers.hpp"
#include "asio/datagram_socket.hpp"
#include "asio/datagram_socket_service.hpp"
#include "asio/default_error_handler.hpp"

View File

@ -8,8 +8,8 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef ASIO_CONSUMING_BUFFERS_HPP
#define ASIO_CONSUMING_BUFFERS_HPP
#ifndef ASIO_DETAIL_CONSUMING_BUFFERS_HPP
#define ASIO_DETAIL_CONSUMING_BUFFERS_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
@ -26,29 +26,30 @@
#include "asio/buffer.hpp"
namespace asio {
namespace detail {
/// A proxy for a sub-range in a list of buffers.
// A proxy for a sub-range in a list of buffers.
template <typename Buffers>
class consuming_buffers
{
public:
/// The type for each element in the list of buffers.
// The type for each element in the list of buffers.
typedef typename Buffers::value_type value_type;
/// A forward-only iterator type that may be used to read or modify elements.
// A forward-only iterator type that may be used to read or modify elements.
typedef typename Buffers::iterator iterator;
/// A forward-only iterator type that may be used to read elements.
// A forward-only iterator type that may be used to read elements.
typedef typename Buffers::const_iterator const_iterator;
/// Construct to represent the entire list of buffers.
// Construct to represent the entire list of buffers.
consuming_buffers(const Buffers& buffers)
: buffers_(buffers),
begin_(buffers_.begin())
{
}
/// Copy constructor.
// Copy constructor.
consuming_buffers(const consuming_buffers& other)
: buffers_(other.buffers_),
begin_(buffers_.begin())
@ -58,7 +59,7 @@ public:
std::advance(begin_, std::distance(first, second));
}
/// Assignment operator.
// Assignment operator.
consuming_buffers& operator=(const consuming_buffers& other)
{
buffers_ = other.buffers_;
@ -69,31 +70,31 @@ public:
return *this;
}
/// Get a forward-only iterator to the first element.
// Get a forward-only iterator to the first element.
iterator begin()
{
return begin_;
}
/// Get a forward-only iterator to the first element.
// Get a forward-only iterator to the first element.
const_iterator begin() const
{
return begin_;
}
/// Get a forward-only iterator for one past the last element.
// Get a forward-only iterator for one past the last element.
iterator end()
{
return buffers_.end();
}
/// Get a forward-only iterator for one past the last element.
// Get a forward-only iterator for one past the last element.
const_iterator end() const
{
return buffers_.end();
}
/// Consume the specified number of bytes from the buffers.
// Consume the specified number of bytes from the buffers.
void consume(std::size_t size)
{
// Remove buffers from the start until the specified size is reached.
@ -122,8 +123,9 @@ private:
iterator begin_;
};
} // namespace detail
} // namespace asio
#include "asio/detail/pop_options.hpp"
#endif // ASIO_CONSUMING_BUFFERS_HPP
#endif // ASIO_DETAIL_CONSUMING_BUFFERS_HPP

View File

@ -28,7 +28,6 @@
#include "asio/buffered_stream.hpp"
#include "asio/buffered_write_stream_fwd.hpp"
#include "asio/buffered_write_stream.hpp"
#include "asio/consuming_buffers.hpp"
#include "asio/datagram_socket.hpp"
#include "asio/datagram_socket_service.hpp"
#include "asio/default_error_handler.hpp"

View File

@ -22,8 +22,8 @@
#include <boost/config.hpp>
#include "asio/detail/pop_options.hpp"
#include "asio/consuming_buffers.hpp"
#include "asio/detail/bind_handler.hpp"
#include "asio/detail/consuming_buffers.hpp"
namespace asio {
@ -196,7 +196,7 @@ template <typename Sync_Read_Stream, typename Mutable_Buffers>
std::size_t read_n(Sync_Read_Stream& s, const Mutable_Buffers& buffers,
std::size_t* total_bytes_transferred = 0)
{
consuming_buffers<Mutable_Buffers> tmp(buffers);
asio::detail::consuming_buffers<Mutable_Buffers> tmp(buffers);
std::size_t bytes_transferred = 0;
std::size_t total_transferred = 0;
while (tmp.begin() != tmp.end())
@ -257,7 +257,7 @@ template <typename Sync_Read_Stream, typename Mutable_Buffers,
std::size_t read_n(Sync_Read_Stream& s, const Mutable_Buffers& buffers,
std::size_t* total_bytes_transferred, Error_Handler error_handler)
{
consuming_buffers<Mutable_Buffers> tmp(buffers);
asio::detail::consuming_buffers<Mutable_Buffers> tmp(buffers);
std::size_t bytes_transferred = 0;
std::size_t total_transferred = 0;
while (tmp.begin() != tmp.end())
@ -313,7 +313,7 @@ namespace detail
private:
Async_Read_Stream& stream_;
consuming_buffers<Mutable_Buffers> buffers_;
asio::detail::consuming_buffers<Mutable_Buffers> buffers_;
std::size_t total_transferred_;
Handler handler_;
};
@ -443,7 +443,7 @@ template <typename Sync_Read_Stream, typename Mutable_Buffers>
std::size_t read_at_least_n(Sync_Read_Stream& s, const Mutable_Buffers& buffers,
std::size_t min_length, std::size_t* total_bytes_transferred = 0)
{
consuming_buffers<Mutable_Buffers> tmp(buffers);
asio::detail::consuming_buffers<Mutable_Buffers> tmp(buffers);
std::size_t bytes_transferred = 0;
std::size_t total_transferred = 0;
while (tmp.begin() != tmp.end() && total_transferred < min_length)
@ -512,7 +512,7 @@ std::size_t read_at_least_n(Sync_Read_Stream& s, const Mutable_Buffers& buffers,
std::size_t min_length, std::size_t* total_bytes_transferred,
Error_Handler error_handler)
{
consuming_buffers<Mutable_Buffers> tmp(buffers);
asio::detail::consuming_buffers<Mutable_Buffers> tmp(buffers);
std::size_t bytes_transferred = 0;
std::size_t total_transferred = 0;
while (tmp.begin() != tmp.end() && total_transferred < min_length)
@ -570,7 +570,7 @@ namespace detail
private:
Async_Read_Stream& stream_;
consuming_buffers<Mutable_Buffers> buffers_;
asio::detail::consuming_buffers<Mutable_Buffers> buffers_;
std::size_t min_length_;
std::size_t total_transferred_;
Handler handler_;

View File

@ -22,8 +22,8 @@
#include <boost/config.hpp>
#include "asio/detail/pop_options.hpp"
#include "asio/consuming_buffers.hpp"
#include "asio/detail/bind_handler.hpp"
#include "asio/detail/consuming_buffers.hpp"
namespace asio {
@ -189,7 +189,7 @@ template <typename Sync_Write_Stream, typename Const_Buffers>
std::size_t write_n(Sync_Write_Stream& s, const Const_Buffers& buffers,
std::size_t* total_bytes_transferred = 0)
{
consuming_buffers<Const_Buffers> tmp(buffers);
asio::detail::consuming_buffers<Const_Buffers> tmp(buffers);
std::size_t bytes_transferred = 0;
std::size_t total_transferred = 0;
while (tmp.begin() != tmp.end())
@ -246,7 +246,7 @@ template <typename Sync_Write_Stream, typename Const_Buffers,
std::size_t write_n(Sync_Write_Stream& s, const Const_Buffers& buffers,
std::size_t* total_bytes_transferred, Error_Handler error_handler)
{
consuming_buffers<Const_Buffers> tmp(buffers);
asio::detail::consuming_buffers<Const_Buffers> tmp(buffers);
std::size_t bytes_transferred = 0;
std::size_t total_transferred = 0;
while (tmp.begin() != tmp.end())
@ -302,7 +302,7 @@ namespace detail
private:
Async_Write_Stream& stream_;
consuming_buffers<Const_Buffers> buffers_;
asio::detail::consuming_buffers<Const_Buffers> buffers_;
std::size_t total_transferred_;
Handler handler_;
};
@ -419,7 +419,7 @@ template <typename Sync_Write_Stream, typename Const_Buffers>
std::size_t write_at_least_n(Sync_Write_Stream& s, const Const_Buffers& buffers,
std::size_t min_length, std::size_t* total_bytes_transferred = 0)
{
consuming_buffers<Const_Buffers> tmp(buffers);
asio::detail::consuming_buffers<Const_Buffers> tmp(buffers);
std::size_t bytes_transferred = 0;
std::size_t total_transferred = 0;
while (tmp.begin() != tmp.end() && total_transferred < min_length)
@ -482,7 +482,7 @@ std::size_t write_at_least_n(Sync_Write_Stream& s, const Const_Buffers& buffers,
std::size_t min_length, std::size_t* total_bytes_transferred,
Error_Handler error_handler)
{
consuming_buffers<Const_Buffers> tmp(buffers);
asio::detail::consuming_buffers<Const_Buffers> tmp(buffers);
std::size_t bytes_transferred = 0;
std::size_t total_transferred = 0;
while (tmp.begin() != tmp.end() && total_transferred < min_length)
@ -540,7 +540,7 @@ namespace detail
private:
Async_Write_Stream& stream_;
consuming_buffers<Const_Buffers> buffers_;
asio::detail::consuming_buffers<Const_Buffers> buffers_;
std::size_t min_length_;
std::size_t total_transferred_;
Handler handler_;

View File

@ -15,7 +15,6 @@ noinst_PROGRAMS = \
tests/unit/buffered_stream_test \
tests/unit/buffered_write_stream_test \
tests/unit/buffer_test \
tests/unit/consuming_buffers_test \
tests/unit/datagram_socket_service_test \
tests/unit/datagram_socket_test \
tests/unit/deadline_timer_service_test \
@ -109,7 +108,6 @@ TESTS = \
tests/unit/buffered_stream_test \
tests/unit/buffered_write_stream_test \
tests/unit/buffer_test \
tests/unit/consuming_buffers_test \
tests/unit/datagram_socket_service_test \
tests/unit/datagram_socket_test \
tests/unit/deadline_timer_service_test \
@ -202,7 +200,6 @@ tests_unit_basic_stream_socket_test_SOURCES = tests/unit/basic_stream_socket_tes
tests_unit_buffered_read_stream_test_SOURCES = tests/unit/buffered_read_stream_test.cpp
tests_unit_buffered_stream_test_SOURCES = tests/unit/buffered_stream_test.cpp
tests_unit_buffered_write_stream_test_SOURCES = tests/unit/buffered_write_stream_test.cpp
tests_unit_consuming_buffers_test_SOURCES = tests/unit/consuming_buffers_test.cpp
tests_unit_datagram_socket_service_test_SOURCES = tests/unit/datagram_socket_service_test.cpp
tests_unit_deadline_timer_service_test_SOURCES = tests/unit/deadline_timer_service_test.cpp
tests_unit_default_error_handler_test_SOURCES = tests/unit/default_error_handler_test.cpp

View File

@ -21,7 +21,6 @@ UNIT_TEST_EXES = \
tests\unit\buffered_stream_test.exe \
tests\unit\buffered_write_stream_test.exe \
tests\unit\buffer_test.exe \
tests\unit\consuming_buffers_test.exe \
tests\unit\datagram_socket_service_test.exe \
tests\unit\datagram_socket_test.exe \
tests\unit\deadline_timer_service_test.exe \

View File

@ -22,7 +22,6 @@ UNIT_TEST_EXES = \
tests/unit/buffered_stream_test.exe \
tests/unit/buffered_write_stream_test.exe \
tests/unit/buffer_test.exe \
tests/unit/consuming_buffers_test.exe \
tests/unit/datagram_socket_service_test.exe \
tests/unit/datagram_socket_test.exe \
tests/unit/deadline_timer_service_test.exe \

View File

@ -41,7 +41,6 @@ UNIT_TEST_EXES = \
tests\unit\buffered_stream_test.exe \
tests\unit\buffered_write_stream_test.exe \
tests\unit\buffer_test.exe \
tests\unit\consuming_buffers_test.exe \
tests\unit\datagram_socket_service_test.exe \
tests\unit\datagram_socket_test.exe \
tests\unit\deadline_timer_service_test.exe \

View File

@ -13,7 +13,6 @@ run buffer_test.cpp ;
run buffered_read_stream_test.cpp ;
run buffered_stream_test.cpp ;
run buffered_write_stream_test.cpp ;
run consuming_buffers_test.cpp ;
run datagram_socket_service_test.cpp ;
run datagram_socket_test.cpp ;
run deadline_timer_service_test.cpp ;

View File

@ -1,20 +0,0 @@
//
// consuming_buffers_test.cpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2005 Christopher M. Kohlhoff (chris@kohlhoff.com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Test that header file is self-contained.
#include "asio/consuming_buffers.hpp"
#include "unit_test.hpp"
test_suite* init_unit_test_suite(int argc, char* argv[])
{
test_suite* test = BOOST_TEST_SUITE("consuming_buffers");
return test;
}