Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:44:33

0001 // (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com)
0002 // (C) Copyright 2003-2007 Jonathan Turkanis
0003 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0004 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
0005 
0006 // See http://www.boost.org/libs/iostreams for documentation.
0007 
0008 #ifndef BOOST_IOSTREAMS_FILTERING_STREAMBUF_HPP_INCLUDED
0009 #define BOOST_IOSTREAMS_FILTERING_STREAMBUF_HPP_INCLUDED
0010 
0011 #if defined(_MSC_VER)
0012 # pragma once
0013 #endif              
0014 
0015 #include <exception>
0016 #include <memory>                               // allocator.
0017 #include <boost/iostreams/chain.hpp>
0018 #include <boost/iostreams/detail/access_control.hpp>
0019 #include <boost/iostreams/detail/char_traits.hpp>
0020 #include <boost/iostreams/detail/push.hpp>
0021 #include <boost/iostreams/detail/streambuf.hpp> // pubsync.
0022 #include <boost/iostreams/detail/streambuf/chainbuf.hpp>
0023 #include <boost/mpl/if.hpp>                    
0024 
0025 namespace boost { namespace iostreams {
0026 
0027 //
0028 // Macro: BOOST_IOSTREAMS_DEFINE_FILTERBUF(name_, chain_type_, default_char_)
0029 // Description: Defines a template derived from std::basic_streambuf which uses
0030 //      a chain to perform i/o. The template has the following parameters:
0031 //      Ch - The character type.
0032 //      Tr - The character traits type.
0033 //      Alloc - The allocator type.
0034 //      Access - Indicates accessibility of the chain interface; must be either
0035 //          public_ or protected_; defaults to public_.
0036 //
0037 #define BOOST_IOSTREAMS_DEFINE_FILTER_STREAMBUF(name_, chain_type_, default_char_) \
0038     template< typename Mode, \
0039               typename Ch = default_char_, \
0040               typename Tr = BOOST_IOSTREAMS_CHAR_TRAITS(Ch), \
0041               typename Alloc = std::allocator<Ch>, \
0042               typename Access = public_ > \
0043     class name_ : public boost::iostreams::detail::chainbuf< \
0044                              chain_type_<Mode, Ch, Tr, Alloc>, Mode, Access \
0045                          > \
0046     { \
0047     public: \
0048         typedef Ch                                             char_type; \
0049         struct category \
0050             : Mode, closable_tag, streambuf_tag \
0051             { }; \
0052         BOOST_IOSTREAMS_STREAMBUF_TYPEDEFS(Tr) \
0053         typedef Mode                                           mode; \
0054         typedef chain_type_<Mode, Ch, Tr, Alloc>               chain_type; \
0055         name_() { } \
0056         BOOST_IOSTREAMS_DEFINE_PUSH_CONSTRUCTOR(name_, mode, Ch, push_impl) \
0057         ~name_() { if (this->is_complete()) this->BOOST_IOSTREAMS_PUBSYNC(); } \
0058     }; \
0059     /**/ 
0060 BOOST_IOSTREAMS_DEFINE_FILTER_STREAMBUF(filtering_streambuf, boost::iostreams::chain, char)
0061 BOOST_IOSTREAMS_DEFINE_FILTER_STREAMBUF(filtering_wstreambuf, boost::iostreams::chain, wchar_t)
0062 
0063 typedef filtering_streambuf<input>    filtering_istreambuf;
0064 typedef filtering_streambuf<output>   filtering_ostreambuf;
0065 typedef filtering_wstreambuf<input>   filtering_wistreambuf;
0066 typedef filtering_wstreambuf<output>  filtering_wostreambuf;
0067 
0068 } } // End namespaces iostreams, boost.
0069 
0070 #endif // #ifndef BOOST_IOSTREAMS_FILTERING_STREAMBUF_HPP_INCLUDED