// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) // (C) Copyright 2003-2007 Jonathan Turkanis // 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.) // See http://www.boost.org/libs/iostreams for documentation. #ifndef BOOST_IOSTREAMS_FILTERING_STREAMBUF_HPP_INCLUDED #define BOOST_IOSTREAMS_FILTERING_STREAMBUF_HPP_INCLUDED #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once #endif #include #include // allocator. #include #include #include #include #include // pubsync. #include #include namespace boost { namespace iostreams { // // Macro: BOOST_IOSTREAMS_DEFINE_FILTERBUF(name_, chain_type_, default_char_) // Description: Defines a template derived from std::basic_streambuf which uses // a chain to perform i/o. The template has the following parameters: // Ch - The character type. // Tr - The character traits type. // Alloc - The allocator type. // Access - Indicates accessibility of the chain interface; must be either // public_ or protected_; defaults to public_. // #define BOOST_IOSTREAMS_DEFINE_FILTER_STREAMBUF(name_, chain_type_, default_char_) \ template< typename Mode, \ typename Ch = default_char_, \ typename Tr = BOOST_IOSTREAMS_CHAR_TRAITS(Ch), \ typename Alloc = std::allocator, \ typename Access = public_ > \ class name_ : public boost::iostreams::detail::chainbuf< \ chain_type_, 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_ chain_type; \ name_() { } \ BOOST_IOSTREAMS_DEFINE_PUSH_CONSTRUCTOR(name_, mode, Ch, push_impl) \ ~name_() { if (this->is_complete()) this->BOOST_IOSTREAMS_PUBSYNC(); } \ }; \ /**/ BOOST_IOSTREAMS_DEFINE_FILTER_STREAMBUF(filtering_streambuf, boost::iostreams::chain, char) BOOST_IOSTREAMS_DEFINE_FILTER_STREAMBUF(filtering_wstreambuf, boost::iostreams::chain, wchar_t) typedef filtering_streambuf filtering_istreambuf; typedef filtering_streambuf filtering_ostreambuf; typedef filtering_wstreambuf filtering_wistreambuf; typedef filtering_wstreambuf filtering_wostreambuf; } } // End namespaces iostreams, boost. #endif // #ifndef BOOST_IOSTREAMS_FILTERING_STREAMBUF_HPP_INCLUDED