|
Boost-Commit : |
From: technews_at_[hidden]
Date: 2008-02-18 00:07:04
Author: turkanis
Date: 2008-02-18 00:07:03 EST (Mon, 18 Feb 2008)
New Revision: 43298
URL: http://svn.boost.org/trac/boost/changeset/43298
Log:
overhaul of category_of and close(): stringstream is now dual_seekable, standard file streams and string streams are closable; public streams and streambufs are closable; close() pops filtering streams and streambufs
Text files modified:
branches/iostreams_dev/boost/iostreams/categories.hpp | 72 ++++++++++++++++++------
branches/iostreams_dev/boost/iostreams/close.hpp | 83 ++++++++++++++++++++++++---
branches/iostreams_dev/boost/iostreams/detail/broken_overload_resolution/stream.hpp | 7 ++
branches/iostreams_dev/boost/iostreams/detail/broken_overload_resolution/stream_buffer.hpp | 5 +
branches/iostreams_dev/boost/iostreams/detail/select.hpp | 14 +++-
branches/iostreams_dev/boost/iostreams/filtering_stream.hpp | 25 +++++++-
branches/iostreams_dev/boost/iostreams/filtering_streambuf.hpp | 9 ++
branches/iostreams_dev/boost/iostreams/stream.hpp | 27 +++++++-
branches/iostreams_dev/boost/iostreams/stream_buffer.hpp | 5 +
branches/iostreams_dev/boost/iostreams/traits.hpp | 119 +++++++++++++++++++++++++++++++++++++--
branches/iostreams_dev/boost/iostreams/traits_fwd.hpp | 39 +++++++++++++
branches/iostreams_dev/libs/iostreams/test/bool_trait_test.cpp | 44 ++++++++++----
branches/iostreams_dev/libs/iostreams/test/newline_test.cpp | 10 ---
13 files changed, 383 insertions(+), 76 deletions(-)
Modified: branches/iostreams_dev/boost/iostreams/categories.hpp
==============================================================================
--- branches/iostreams_dev/boost/iostreams/categories.hpp (original)
+++ branches/iostreams_dev/boost/iostreams/categories.hpp 2008-02-18 00:07:03 EST (Mon, 18 Feb 2008)
@@ -100,43 +100,79 @@
struct std_io_tag : virtual localizable_tag { };
struct istream_tag
- : virtual input_seekable,
- virtual device_tag,
+ : virtual device_tag,
virtual peekable_tag,
virtual std_io_tag
{ };
struct ostream_tag
- : virtual output_seekable,
- virtual device_tag,
- virtual peekable_tag,
+ : virtual device_tag,
virtual std_io_tag
{ };
struct iostream_tag
- : seekable_device_tag,
- istream_tag,
+ : istream_tag,
ostream_tag
{ };
struct streambuf_tag
- : seekable_device_tag,
+ : device_tag,
peekable_tag,
std_io_tag
{ };
+struct ifstream_tag
+ : input_seekable,
+ closable_tag,
+ istream_tag
+ { };
+struct ofstream_tag
+ : output_seekable,
+ closable_tag,
+ ostream_tag
+ { };
+struct fstream_tag
+ : seekable,
+ closable_tag,
+ iostream_tag
+ { };
+struct filebuf_tag
+ : seekable,
+ closable_tag,
+ streambuf_tag
+ { };
+struct istringstream_tag
+ : input_seekable,
+ closable_tag,
+ istream_tag
+ { };
+struct ostringstream_tag
+ : output_seekable,
+ closable_tag,
+ ostream_tag
+ { };
struct stringstream_tag
: dual_seekable,
- device_tag,
- std_io_tag
+ closable_tag,
+ iostream_tag
{ };
struct stringbuf_tag
: dual_seekable,
- device_tag,
- std_io_tag
+ closable_tag,
+ streambuf_tag
+ { };
+struct generic_istream_tag
+ : input_seekable,
+ istream_tag
+ { };
+struct generic_ostream_tag
+ : output_seekable,
+ ostream_tag
+ { };
+struct generic_iostream_tag
+ : seekable,
+ iostream_tag
+ { };
+struct generic_streambuf_tag
+ : seekable,
+ streambuf_tag
{ };
-
-namespace detail {
-
-struct linked_tag : streambuf_tag { };
-
-} // End namespace detail.
} } // End namespaces iostreams, boost.
Modified: branches/iostreams_dev/boost/iostreams/close.hpp
==============================================================================
--- branches/iostreams_dev/boost/iostreams/close.hpp (original)
+++ branches/iostreams_dev/boost/iostreams/close.hpp 2008-02-18 00:07:03 EST (Mon, 18 Feb 2008)
@@ -18,6 +18,7 @@
#include <boost/iostreams/flush.hpp>
#include <boost/iostreams/detail/adapter/non_blocking_adapter.hpp>
#include <boost/iostreams/detail/ios.hpp> // BOOST_IOS
+#include <boost/iostreams/detail/select.hpp>
#include <boost/iostreams/detail/wrap_unwrap.hpp>
#include <boost/iostreams/operations_fwd.hpp>
#include <boost/iostreams/traits.hpp>
@@ -124,21 +125,36 @@
//------------------Definition of close_impl----------------------------------//
+struct close_boost_stream { };
+struct close_filtering_stream { };
+
template<typename T>
struct close_tag {
- typedef typename category_of<T>::type category;
+ typedef typename category_of<T>::type category;
+ typedef typename detail::unwrapped_type<T>::type unwrapped;
typedef typename
- mpl::eval_if<
- is_convertible<category, closable_tag>,
- mpl::if_<
- mpl::or_<
- is_convertible<category, two_sequence>,
- is_convertible<category, dual_use>
- >,
- two_sequence,
- closable_tag
+ iostreams::select<
+ mpl::not_< is_convertible<category, closable_tag> >,
+ any_tag,
+ is_std_string_device<unwrapped>,
+ stringstream_tag,
+ mpl::or_<
+ is_boost_stream<unwrapped>,
+ is_boost_stream_buffer<unwrapped>
+ >,
+ close_boost_stream,
+ mpl::or_<
+ is_filtering_stream<unwrapped>,
+ is_filtering_streambuf<unwrapped>
+ >,
+ close_filtering_stream,
+ mpl::or_<
+ is_convertible<category, two_sequence>,
+ is_convertible<category, dual_use>
>,
- mpl::identity<any_tag>
+ two_sequence,
+ else_,
+ closable_tag
>::type type;
};
@@ -170,6 +186,51 @@
}
};
+template<>
+struct close_impl<stringstream_tag> {
+ template<typename T>
+ static void close(T& t)
+ {
+ t.str("");
+ }
+ template<typename T>
+ static void close(T& t, BOOST_IOS::openmode which)
+ {
+ if (which == BOOST_IOS::out)
+ t.str("");
+ }
+};
+
+template<>
+struct close_impl<close_boost_stream> {
+ template<typename T>
+ static void close(T& t)
+ {
+ t.close();
+ }
+ template<typename T>
+ static void close(T& t, BOOST_IOS::openmode which)
+ {
+ if (which == BOOST_IOS::out)
+ t.close();
+ }
+};
+
+template<>
+struct close_impl<close_filtering_stream> {
+ template<typename T>
+ static void close(T& t)
+ {
+ t.pop();
+ }
+ template<typename T>
+ static void close(T& t, BOOST_IOS::openmode which)
+ {
+ if (which == BOOST_IOS::out)
+ t.pop();
+ }
+};
+
#include <boost/iostreams/detail/config/disable_warnings.hpp> // Borland.
template<>
struct close_impl<closable_tag> {
Modified: branches/iostreams_dev/boost/iostreams/detail/broken_overload_resolution/stream.hpp
==============================================================================
--- branches/iostreams_dev/boost/iostreams/detail/broken_overload_resolution/stream.hpp (original)
+++ branches/iostreams_dev/boost/iostreams/detail/broken_overload_resolution/stream.hpp 2008-02-18 00:07:03 EST (Mon, 18 Feb 2008)
@@ -24,12 +24,17 @@
struct stream : detail::stream_base<Device, Tr, Alloc> {
public:
typedef typename char_type_of<Device>::type char_type;
+ struct category
+ : mode_of<Device>::type,
+ closable_tag,
+ detail::stream_traits<Device, Tr>::stream_tag
+ { };
BOOST_IOSTREAMS_STREAMBUF_TYPEDEFS(Tr)
private:
typedef typename
detail::stream_traits<
Device, Tr
- >::type stream_type;
+ >::stream_type stream_type;
typedef Device policy_type;
public:
stream() { }
Modified: branches/iostreams_dev/boost/iostreams/detail/broken_overload_resolution/stream_buffer.hpp
==============================================================================
--- branches/iostreams_dev/boost/iostreams/detail/broken_overload_resolution/stream_buffer.hpp (original)
+++ branches/iostreams_dev/boost/iostreams/detail/broken_overload_resolution/stream_buffer.hpp 2008-02-18 00:07:03 EST (Mon, 18 Feb 2008)
@@ -38,6 +38,11 @@
typedef T policy_type;
public:
typedef typename char_type_of<T>::type char_type;
+ struct category
+ : Mode,
+ closable_tag,
+ streambuf_tag
+ { };
BOOST_IOSTREAMS_STREAMBUF_TYPEDEFS(Tr)
stream_buffer() { }
~stream_buffer()
Modified: branches/iostreams_dev/boost/iostreams/detail/select.hpp
==============================================================================
--- branches/iostreams_dev/boost/iostreams/detail/select.hpp (original)
+++ branches/iostreams_dev/boost/iostreams/detail/select.hpp 2008-02-18 00:07:03 EST (Mon, 18 Feb 2008)
@@ -20,7 +20,7 @@
// >::type selection;
//
// Here case1, case2, ... are models of MPL::IntegralConstant with value type
-// bool, and n <= 10.
+// bool, and n <= 12.
#ifndef BOOST_IOSTREAMS_SELECT_HPP_INCLUDED
#define BOOST_IOSTREAMS_SELECT_HPP_INCLUDED
@@ -58,7 +58,11 @@
typename Case9 = mpl::true_,
typename Type9 = mpl::void_,
typename Case10 = mpl::true_,
- typename Type10 = mpl::void_ >
+ typename Type10 = mpl::void_,
+ typename Case11 = mpl::true_,
+ typename Type11 = mpl::void_,
+ typename Case12 = mpl::true_,
+ typename Type12 = mpl::void_ >
struct select {
typedef typename
mpl::eval_if<
@@ -70,8 +74,10 @@
Case6, mpl::identity<Type6>, mpl::eval_if<
Case7, mpl::identity<Type7>, mpl::eval_if<
Case8, mpl::identity<Type8>, mpl::eval_if<
- Case9, mpl::identity<Type9>, mpl::if_<
- Case10, Type10, mpl::void_ > > > > > > > > >
+ Case9, mpl::identity<Type9>, mpl::eval_if<
+ Case10, mpl::identity<Type10>, mpl::eval_if<
+ Case11, mpl::identity<Type11>, mpl::if_<
+ Case12, Type12, mpl::void_ > > > > > > > > > > >
>::type type;
};
Modified: branches/iostreams_dev/boost/iostreams/filtering_stream.hpp
==============================================================================
--- branches/iostreams_dev/boost/iostreams/filtering_stream.hpp (original)
+++ branches/iostreams_dev/boost/iostreams/filtering_stream.hpp 2008-02-18 00:07:03 EST (Mon, 18 Feb 2008)
@@ -47,7 +47,19 @@
BOOST_IOSTREAMS_BASIC_ISTREAM(Ch, Tr),
else_,
BOOST_IOSTREAMS_BASIC_OSTREAM(Ch, Tr)
- >::type type;
+ >::type stream_type;
+ typedef typename
+ iostreams::select< // Dismbiguation required for Tru64.
+ mpl::and_<
+ is_convertible<Mode, input>,
+ is_convertible<Mode, output>
+ >,
+ iostream_tag,
+ is_convertible<Mode, input>,
+ istream_tag,
+ else_,
+ ostream_tag
+ >::type stream_tag;
};
template<typename Chain, typename Access>
@@ -60,7 +72,7 @@
typename Chain::mode,
typename Chain::char_type,
typename Chain::traits_type
- >::type
+ >::stream_type
{
public:
typedef Chain chain_type;
@@ -74,7 +86,7 @@
typename Chain::mode,
typename Chain::char_type,
typename Chain::traits_type
- >::type stream_type;
+ >::stream_type stream_type;
filtering_stream_base() : stream_type(0) { this->set_chain(&chain_); }
private:
void notify() { this->rdbuf(chain_.empty() ? 0 : &chain_.front()); }
@@ -111,6 +123,11 @@
{ \
public: \
typedef Ch char_type; \
+ struct category \
+ : Mode, \
+ closable_tag, \
+ detail::filtering_stream_traits<Mode, Ch, Tr>::stream_tag \
+ { }; \
BOOST_IOSTREAMS_STREAMBUF_TYPEDEFS(Tr) \
typedef Mode mode; \
typedef chain_type_<Mode, Ch, Tr, Alloc> chain_type; \
@@ -133,7 +150,7 @@
}; \
/**/
BOOST_IOSTREAMS_DEFINE_FILTER_STREAM(filtering_stream, boost::iostreams::chain, char)
-BOOST_IOSTREAMS_DEFINE_FILTER_STREAM(wfiltering_stream, boost::iostreams::chain, wchar_t)
+BOOST_IOSTREAMS_DEFINE_FILTER_STREAM(wfiltering_stream, boost::iostreams::chain, wchar_t)
typedef filtering_stream<input> filtering_istream;
typedef filtering_stream<output> filtering_ostream;
Modified: branches/iostreams_dev/boost/iostreams/filtering_streambuf.hpp
==============================================================================
--- branches/iostreams_dev/boost/iostreams/filtering_streambuf.hpp (original)
+++ branches/iostreams_dev/boost/iostreams/filtering_streambuf.hpp 2008-02-18 00:07:03 EST (Mon, 18 Feb 2008)
@@ -35,15 +35,20 @@
// public_ or protected_; defaults to public_.
//
#define BOOST_IOSTREAMS_DEFINE_FILTER_STREAMBUF(name_, chain_type_, default_char_) \
- template< typename Mode, typename Ch = default_char_, \
+ template< typename Mode, \
+ typename Ch = default_char_, \
typename Tr = BOOST_IOSTREAMS_CHAR_TRAITS(Ch), \
- typename Alloc = std::allocator<Ch>, typename Access = public_ > \
+ typename Alloc = std::allocator<Ch>, \
+ typename Access = public_ > \
class name_ : public boost::iostreams::detail::chainbuf< \
chain_type_<Mode, Ch, Tr, Alloc>, Mode, Access \
> \
{ \
public: \
typedef Ch char_type; \
+ struct category \
+ : Mode, closable_tag, streambuf_tag \
+ { }; \
BOOST_IOSTREAMS_STREAMBUF_TYPEDEFS(Tr) \
typedef Mode mode; \
typedef chain_type_<Mode, Ch, Tr, Alloc> chain_type; \
Modified: branches/iostreams_dev/boost/iostreams/stream.hpp
==============================================================================
--- branches/iostreams_dev/boost/iostreams/stream.hpp (original)
+++ branches/iostreams_dev/boost/iostreams/stream.hpp 2008-02-18 00:07:03 EST (Mon, 18 Feb 2008)
@@ -41,7 +41,19 @@
BOOST_IOSTREAMS_BASIC_ISTREAM(char_type, traits_type),
else_,
BOOST_IOSTREAMS_BASIC_OSTREAM(char_type, traits_type)
- >::type type;
+ >::type stream_type;
+ typedef typename
+ iostreams::select< // Dismbiguation required for Tru64.
+ mpl::and_<
+ is_convertible<mode, input>,
+ is_convertible<mode, output>
+ >,
+ iostream_tag,
+ is_convertible<mode, input>,
+ istream_tag,
+ else_,
+ ostream_tag
+ >::type stream_tag;
};
// By encapsulating initialization in a base, we can define the macro
@@ -58,14 +70,14 @@
>,
typename Base = // VC6 Workaround.
BOOST_DEDUCED_TYPENAME
- detail::stream_traits<Device, Tr>::type >
+ detail::stream_traits<Device, Tr>::stream_type >
class stream_base
: protected base_from_member< stream_buffer<Device, Tr, Alloc> >,
public Base
{
private:
- typedef base_from_member< stream_buffer<Device, Tr, Alloc> > pbase_type;
- typedef typename stream_traits<Device, Tr>::type stream_type;
+ typedef base_from_member< stream_buffer<Device, Tr, Alloc> > pbase_type;
+ typedef typename stream_traits<Device, Tr>::stream_type stream_type;
protected:
using pbase_type::member; // Avoid warning about 'this' in initializer list.
public:
@@ -100,12 +112,17 @@
struct stream : detail::stream_base<Device, Tr, Alloc> {
public:
typedef typename char_type_of<Device>::type char_type;
+ struct category
+ : mode_of<Device>::type,
+ closable_tag,
+ detail::stream_traits<Device, Tr>::stream_tag
+ { };
BOOST_IOSTREAMS_STREAMBUF_TYPEDEFS(Tr)
private:
typedef typename
detail::stream_traits<
Device, Tr
- >::type stream_type;
+ >::stream_type stream_type;
typedef Device policy_type;
public:
stream() { }
Modified: branches/iostreams_dev/boost/iostreams/stream_buffer.hpp
==============================================================================
--- branches/iostreams_dev/boost/iostreams/stream_buffer.hpp (original)
+++ branches/iostreams_dev/boost/iostreams/stream_buffer.hpp 2008-02-18 00:07:03 EST (Mon, 18 Feb 2008)
@@ -76,6 +76,11 @@
typedef T policy_type;
public:
typedef typename char_type_of<T>::type char_type;
+ struct category
+ : Mode,
+ closable_tag,
+ streambuf_tag
+ { };
BOOST_IOSTREAMS_STREAMBUF_TYPEDEFS(Tr)
public:
stream_buffer() { }
Modified: branches/iostreams_dev/boost/iostreams/traits.hpp
==============================================================================
--- branches/iostreams_dev/boost/iostreams/traits.hpp (original)
+++ branches/iostreams_dev/boost/iostreams/traits.hpp 2008-02-18 00:07:03 EST (Mon, 18 Feb 2008)
@@ -40,9 +40,9 @@
#endif // #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
#include <boost/type_traits/is_convertible.hpp>
-namespace boost { namespace iostreams {
+namespace boost { namespace iostreams {
-//------------------Definitions of predicates for streams and stream buffers--//
+//----------Definitions of predicates for streams and stream buffers----------//
#ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //--------------------------------//
@@ -50,6 +50,12 @@
BOOST_IOSTREAMS_BOOL_TRAIT_DEF(is_ostream, std::basic_ostream, 2)
BOOST_IOSTREAMS_BOOL_TRAIT_DEF(is_iostream, std::basic_iostream, 2)
BOOST_IOSTREAMS_BOOL_TRAIT_DEF(is_streambuf, std::basic_streambuf, 2)
+BOOST_IOSTREAMS_BOOL_TRAIT_DEF(is_ifstream, std::basic_ifstream, 2)
+BOOST_IOSTREAMS_BOOL_TRAIT_DEF(is_ofstream, std::basic_ofstream, 2)
+BOOST_IOSTREAMS_BOOL_TRAIT_DEF(is_fstream, std::basic_fstream, 2)
+BOOST_IOSTREAMS_BOOL_TRAIT_DEF(is_filebuf, std::basic_filebuf, 2)
+BOOST_IOSTREAMS_BOOL_TRAIT_DEF(is_istringstream, std::basic_istringstream, 3)
+BOOST_IOSTREAMS_BOOL_TRAIT_DEF(is_ostringstream, std::basic_ostringstream, 3)
BOOST_IOSTREAMS_BOOL_TRAIT_DEF(is_stringstream, std::basic_stringstream, 3)
BOOST_IOSTREAMS_BOOL_TRAIT_DEF(is_stringbuf, std::basic_stringbuf, 3)
@@ -67,13 +73,99 @@
: mpl::or_< is_istream<T>, is_ostream<T>, is_streambuf<T> >
{ };
+template<typename T>
+struct is_std_file_device
+ : mpl::or_<
+ is_ifstream<T>,
+ is_ofstream<T>,
+ is_fstream<T>,
+ is_filebuf<T>
+ >
+ { };
+
+template<typename T>
+struct is_std_string_device
+ : mpl::or_<
+ is_istringstream<T>,
+ is_ostringstream<T>,
+ is_stringstream<T>,
+ is_stringbuf<T>
+ >
+ { };
+
+template<typename Device, typename Tr, typename Alloc>
+struct stream;
+
+template<typename T, typename Tr, typename Alloc, typename Mode>
+class stream_buffer;
+
+template< typename Mode, typename Ch, typename Tr,
+ typename Alloc, typename Access >
+class filtering_stream;
+
+template< typename Mode, typename Ch, typename Tr,
+ typename Alloc, typename Access >
+class wfiltering_stream;
+
+template< typename Mode, typename Ch, typename Tr,
+ typename Alloc, typename Access >
+class filtering_streambuf;
+
+template< typename Mode, typename Ch, typename Tr,
+ typename Alloc, typename Access >
+class filtering_wstreambuf;
+
namespace detail {
template<typename T, typename Tr>
class linked_streambuf;
+BOOST_IOSTREAMS_BOOL_TRAIT_DEF( is_boost_stream,
+ boost::iostreams::stream,
+ 3 )
+BOOST_IOSTREAMS_BOOL_TRAIT_DEF( is_boost_stream_buffer,
+ boost::iostreams::stream_buffer,
+ 4 )
+BOOST_IOSTREAMS_BOOL_TRAIT_DEF( is_filtering_stream_impl,
+ boost::iostreams::filtering_stream,
+ 5 )
+BOOST_IOSTREAMS_BOOL_TRAIT_DEF( is_filtering_wstream_impl,
+ boost::iostreams::wfiltering_stream,
+ 5 )
+BOOST_IOSTREAMS_BOOL_TRAIT_DEF( is_filtering_streambuf_impl,
+ boost::iostreams::filtering_streambuf,
+ 5 )
+BOOST_IOSTREAMS_BOOL_TRAIT_DEF( is_filtering_wstreambuf_impl,
+ boost::iostreams::filtering_wstreambuf,
+ 5 )
BOOST_IOSTREAMS_BOOL_TRAIT_DEF(is_linked, linked_streambuf, 2)
+template<typename T>
+struct is_filtering_stream
+ : mpl::or_<
+ is_filtering_stream_impl<T>,
+ is_filtering_wstream_impl<T>
+ >
+ { };
+
+template<typename T>
+struct is_filtering_streambuf
+ : mpl::or_<
+ is_filtering_streambuf_impl<T>,
+ is_filtering_wstreambuf_impl<T>
+ >
+ { };
+
+template<typename T>
+struct is_boost
+ : mpl::or_<
+ is_boost_stream<T>,
+ is_boost_stream_buffer<T>,
+ is_filtering_stream<T>,
+ is_filtering_streambuf<T>
+ >
+ { };
+
} // End namespace detail.
//------------------Definitions of char_type_of-------------------------------//
@@ -155,15 +247,26 @@
typedef typename detail::unwrapped_type<T>::type U;
typedef typename
mpl::eval_if<
- is_std_io<U>,
+ mpl::and_<
+ is_std_io<U>,
+ mpl::not_< detail::is_boost<U> >
+ >,
iostreams::select< // Disambiguation for Tru64
- is_iostream<U>, iostream_tag,
- is_istream<U>, istream_tag,
- is_ostream<U>, ostream_tag,
- is_streambuf<U>, streambuf_tag
+ is_filebuf<U>, filebuf_tag,
+ is_ifstream<U>, ifstream_tag,
+ is_ofstream<U>, ofstream_tag,
+ is_fstream<U>, fstream_tag,
+ is_stringbuf<U>, stringbuf_tag,
+ is_istringstream<U>, istringstream_tag,
+ is_ostringstream<U>, ostringstream_tag,
+ is_stringstream<U>, stringstream_tag,
+ is_streambuf<U>, generic_streambuf_tag,
+ is_iostream<U>, generic_iostream_tag,
+ is_istream<U>, generic_istream_tag,
+ is_ostream<U>, generic_ostream_tag
>,
detail::member_category<U>
- >::type type;
+ >::type type;
};
//------------------Definition of get_category--------------------------------//
Modified: branches/iostreams_dev/boost/iostreams/traits_fwd.hpp
==============================================================================
--- branches/iostreams_dev/boost/iostreams/traits_fwd.hpp (original)
+++ branches/iostreams_dev/boost/iostreams/traits_fwd.hpp 2008-02-18 00:07:03 EST (Mon, 18 Feb 2008)
@@ -31,15 +31,39 @@
struct is_streambuf;
template<typename T>
+struct is_istringstream;
+
+template<typename T>
+struct is_ostringstream;
+
+template<typename T>
struct is_stringstream;
template<typename T>
struct is_stringbuf;
template<typename T>
+struct is_ifstream;
+
+template<typename T>
+struct is_ofstream;
+
+template<typename T>
+struct is_fstream;
+
+template<typename T>
+struct is_filebuf;
+
+template<typename T>
struct is_std_io;
template<typename T>
+struct is_std_file_device;
+
+template<typename T>
+struct is_std_string_device;
+
+template<typename T>
struct char_type_of;
template<typename T>
@@ -63,8 +87,23 @@
namespace detail {
template<typename T>
+struct is_boost_stream;
+
+template<typename T>
+struct is_boost_stream_buffer;
+
+template<typename T>
+struct is_filtering_stream;
+
+template<typename T>
+struct is_filtering_streambuf;
+
+template<typename T>
struct is_linked;
+template<typename T>
+struct is_boost;
+
} // End namespace detail.
} } // End namespaces iostreams, boost.
Modified: branches/iostreams_dev/libs/iostreams/test/bool_trait_test.cpp
==============================================================================
--- branches/iostreams_dev/libs/iostreams/test/bool_trait_test.cpp (original)
+++ branches/iostreams_dev/libs/iostreams/test/bool_trait_test.cpp 2008-02-18 00:07:03 EST (Mon, 18 Feb 2008)
@@ -42,6 +42,9 @@
typedef io::filtering_stream<seekable> filtering_iostream;
typedef io::filtering_stream<seekable, wchar_t> filtering_wiostream;
+typedef io::detail::linked_streambuf<char> linkedbuf;
+typedef io::detail::linked_streambuf<wchar_t> wlinkedbuf;
+
#define BOOST_CHECK_BOOL_TRAIT(trait, type, status) \
BOOST_CHECK(trait< type >::value == status)
/**/
@@ -59,7 +62,8 @@
filtering_istream_, filtering_wistream_, \
filtering_ostream_, filtering_wostream_, \
filtering_iostream_, filtering_wiostream_, \
- filtering_istreambuf_, filtering_wistreambuf_ ) \
+ filtering_istreambuf_, filtering_wistreambuf_, \
+ linkedbuf_, wlinkedbuf_ ) \
BOOST_CHECK_BOOL_TRAIT(trait, std::istream, istream_); \
BOOST_CHECK_BOOL_TRAIT(trait, std::wistream, wistream_); \
BOOST_CHECK_BOOL_TRAIT(trait, std::ostream, ostream_); \
@@ -99,6 +103,8 @@
BOOST_CHECK_BOOL_TRAIT(trait, filtering_wiostream, filtering_wiostream_); \
BOOST_CHECK_BOOL_TRAIT(trait, io::filtering_istreambuf, filtering_istreambuf_); \
BOOST_CHECK_BOOL_TRAIT(trait, io::filtering_wistreambuf, filtering_wistreambuf_); \
+ BOOST_CHECK_BOOL_TRAIT(trait, linkedbuf, linkedbuf_); \
+ BOOST_CHECK_BOOL_TRAIT(trait, wlinkedbuf, wlinkedbuf_); \
BOOST_CHECK_BOOL_TRAIT(trait, io::array, false); \
BOOST_CHECK_BOOL_TRAIT(trait, int, false);
/**/
@@ -112,7 +118,8 @@
true, true, false, false, true, true, false, false,
true, true, false, false, true, true, false, false,
true, true, false, false, true, true, false, false,
- true, true, false, false, true, true, false, false
+ true, true, false, false, true, true, false, false,
+ false, false
);
// Test is_ostream
@@ -122,7 +129,8 @@
false, false, true, true, true, true, false, false,
false, false, true, true, true, true, false, false,
false, false, true, true, true, true, false, false,
- false, false, true, true, true, true, false, false
+ false, false, true, true, true, true, false, false,
+ false, false
);
// Test is_iostream
@@ -132,7 +140,8 @@
false, false, false, false, true, true, false, false,
false, false, false, false, true, true, false, false,
false, false, false, false, true, true, false, false,
- false, false, false, false, true, true, false, false
+ false, false, false, false, true, true, false, false,
+ false, false
);
// Test is_streambuf
@@ -142,7 +151,8 @@
false, false, false, false, false, false, true, true,
false, false, false, false, false, false, true, true,
false, false, false, false, false, false, true, true,
- false, false, false, false, false, false, true, true
+ false, false, false, false, false, false, true, true,
+ true, true
);
// Test is_std_io
@@ -152,7 +162,8 @@
true, true, true, true, true, true, true, true,
true, true, true, true, true, true, true, true,
true, true, true, true, true, true, true, true,
- true, true, true, true, true, true, true, true
+ true, true, true, true, true, true, true, true,
+ true, true
);
// Test is_std_file_device
@@ -162,7 +173,8 @@
true, true, true, true, true, true, true, true,
false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false,
- false, false, false, false, false, false, false, false
+ false, false, false, false, false, false, false, false,
+ false, false
);
// Test is_std_string_device
@@ -172,7 +184,8 @@
false, false, false, false, false, false, false, false,
true, true, true, true, true, true, true, true,
false, false, false, false, false, false, false, false,
- false, false, false, false, false, false, false, false
+ false, false, false, false, false, false, false, false,
+ false, false
);
// Test is_boost_stream
@@ -182,7 +195,8 @@
false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false,
true, true, true, true, true, true, false, false,
- false, false, false, false, false, false, false, false
+ false, false, false, false, false, false, false, false,
+ false, false
);
// Test is_boost_stream_buffer
@@ -192,7 +206,8 @@
false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false,
false, false, false, false, false, false, true, true,
- false, false, false, false, false, false, false, false
+ false, false, false, false, false, false, false, false,
+ false, false
);
// Test is_filtering_stream
@@ -202,7 +217,8 @@
false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false,
- true, true, true, true, true, true, false, false
+ true, true, true, true, true, true, false, false,
+ false, false
);
// Test is_filtering_streambuf
@@ -212,7 +228,8 @@
false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false,
- false, false, false, false, false, false, true, true
+ false, false, false, false, false, false, true, true,
+ false, false
);
// Test is_boost
@@ -222,7 +239,8 @@
false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false,
true, true, true, true, true, true, true, true,
- true, true, true, true, true, true, true, true
+ true, true, true, true, true, true, true, true,
+ false, false
);
}
Modified: branches/iostreams_dev/libs/iostreams/test/newline_test.cpp
==============================================================================
--- branches/iostreams_dev/libs/iostreams/test/newline_test.cpp (original)
+++ branches/iostreams_dev/libs/iostreams/test/newline_test.cpp 2008-02-18 00:07:03 EST (Mon, 18 Feb 2008)
@@ -217,7 +217,6 @@
in.push(io::newline_checker(io::newline::posix));
in.push(string_source(::posix));
BOOST_CHECK_NO_THROW(io::copy(in, io::null_sink()));
- in.pop(); // pop source.
checker = BOOST_IOSTREAMS_COMPONENT(in, 0, io::newline_checker);
BOOST_CHECK(checker->is_posix());
BOOST_CHECK(!checker->is_dos());
@@ -237,7 +236,6 @@
false, "failed checking for dos line endings"
);
}
- in.pop(); // pop source.
checker = BOOST_IOSTREAMS_COMPONENT(in, 0, io::newline_checker);
BOOST_CHECK(!checker->is_posix());
BOOST_CHECK(checker->is_dos());
@@ -251,7 +249,6 @@
in.push(io::newline_checker(io::newline::mac));
in.push(string_source(::mac));
BOOST_CHECK_NO_THROW(io::copy(in, io::null_sink()));
- in.pop(); // pop source.
checker = BOOST_IOSTREAMS_COMPONENT(in, 0, io::newline_checker);
BOOST_CHECK(!checker->is_posix());
BOOST_CHECK(!checker->is_dos());
@@ -265,7 +262,6 @@
in.push(io::newline_checker(io::newline::posix));
in.push(string_source(::no_final_newline));
BOOST_CHECK_NO_THROW(io::copy(in, io::null_sink()));
- in.pop(); // pop source.
checker = BOOST_IOSTREAMS_COMPONENT(in, 0, io::newline_checker);
BOOST_CHECK(checker->is_posix());
BOOST_CHECK(!checker->is_dos());
@@ -279,7 +275,6 @@
in.push(io::newline_checker());
in.push(string_source(::mixed));
BOOST_CHECK_NO_THROW(io::copy(in, io::null_sink()));
- in.pop(); // pop source.
checker = BOOST_IOSTREAMS_COMPONENT(in, 0, io::newline_checker);
BOOST_CHECK(!checker->is_posix());
BOOST_CHECK(!checker->is_dos());
@@ -345,7 +340,6 @@
out.push(io::newline_checker(io::newline::posix));
out.push(io::null_sink());
BOOST_CHECK_NO_THROW(io::copy(string_source(::posix), out))
- out.pop(); // pop source.
checker = BOOST_IOSTREAMS_COMPONENT(out, 0, io::newline_checker);
BOOST_CHECK(checker->is_posix());
BOOST_CHECK(!checker->is_dos());
@@ -359,7 +353,6 @@
out.push(io::newline_checker(io::newline::dos));
out.push(io::null_sink());
BOOST_CHECK_NO_THROW(io::copy(string_source(::dos), out))
- out.pop(); // pop source.
checker = BOOST_IOSTREAMS_COMPONENT(out, 0, io::newline_checker);
BOOST_CHECK(!checker->is_posix());
BOOST_CHECK(checker->is_dos());
@@ -373,7 +366,6 @@
out.push(io::newline_checker(io::newline::mac));
out.push(io::null_sink());
BOOST_CHECK_NO_THROW(io::copy(string_source(::mac), out))
- out.pop(); // pop source.
checker = BOOST_IOSTREAMS_COMPONENT(out, 0, io::newline_checker);
BOOST_CHECK(!checker->is_posix());
BOOST_CHECK(!checker->is_dos());
@@ -387,7 +379,6 @@
out.push(io::newline_checker(io::newline::posix));
out.push(io::null_sink());
BOOST_CHECK_NO_THROW(io::copy(string_source(::no_final_newline), out))
- out.pop(); // pop source.
checker = BOOST_IOSTREAMS_COMPONENT(out, 0, io::newline_checker);
BOOST_CHECK(checker->is_posix());
BOOST_CHECK(!checker->is_dos());
@@ -401,7 +392,6 @@
out.push(io::newline_checker());
out.push(io::null_sink());
BOOST_CHECK_NO_THROW(io::copy(string_source(::mixed), out))
- out.pop(); // pop source.
checker = BOOST_IOSTREAMS_COMPONENT(out, 0, io::newline_checker);
BOOST_CHECK(!checker->is_posix());
BOOST_CHECK(!checker->is_dos());
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk