Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:30:53

0001 // ----------------------------------------------------------------------------
0002 //  compat_workarounds : general framework for non-conformance workarounds
0003 // ----------------------------------------------------------------------------
0004 
0005 //  Copyright Samuel Krempp 2003. Use, modification, and distribution are
0006 //  subject to the Boost Software License, Version 1.0. (See accompanying
0007 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0008 
0009 // see http://www.boost.org/libs/format for library home page
0010 
0011 // ----------------------------------------------------------------------------
0012 
0013 
0014 //  this file defines  wrapper classes to hide non-conforming 
0015 // std::char_traits<>  and std::allocator<> traits
0016 //  and Includes : config_macros.hpp (defines config macros
0017 //  and compiler-specific switches)
0018 
0019 // Non-conformant Std-libs fail to supply conformant traits (std::char_traits,
0020 //  std::allocator) and/or  the std::string doesnt support them.
0021 // We don't want to have hundreds of #ifdef workarounds, so we define 
0022 // replacement traits.
0023 // But both char_traits and allocator traits are visible in the interface, 
0024 // (inside the final string type),  thus we need to keep both 
0025 // the replacement type (typedefed to 'compatible_type') for real use,
0026 // and the original stdlib type (typedef to 'type_for_string') for interface
0027 //  visibility. This is what Compat* classes do (as well as be transparent 
0028 // when good allocator and char traits are present)
0029 
0030 #ifndef BOOST_FORMAT_COMPAT_WORKAROUNDS_HPP
0031 #define BOOST_FORMAT_COMPAT_WORKAROUNDS_HPP
0032 
0033 namespace boost {
0034     namespace io {
0035 
0036         // gcc-2.95 char traits (non-conformantly named string_char_traits) 
0037         // lack several functions so we extend them in a replacement class.
0038         template<class Tr>
0039         class CompatTraits; 
0040 
0041         // std::allocator<Ch> in gcc-2.95 is ok, but basic_string only works 
0042         // with plain 'std::alloc' still, alt_stringbuf requires a functionnal
0043         // alloc template argument, so we need a replacement allocator
0044         template<class Alloc>
0045         class CompatAlloc; 
0046     } // N.S. io
0047 }// N.S. boost
0048 
0049 
0050 #include <boost/format/detail/config_macros.hpp>
0051    // sets-up macros and load compiler-specific workarounds headers.
0052 
0053 #if !defined(BOOST_FORMAT_STREAMBUF_DEFINED)
0054 // workarounds-gcc-2.95 might have defined own streambuf
0055 #include <streambuf>
0056 #endif
0057 
0058 #if !defined(BOOST_FORMAT_OSTREAM_DEFINED)
0059 // workarounds-gcc-2.95 might already have included <iostream>
0060 #include <ostream>
0061 #endif
0062 
0063 
0064 
0065 namespace boost {
0066     namespace io {
0067 
0068         // **** CompatTraits general definitions : ----------------------------
0069         template<class Tr>
0070         class CompatTraits
0071         {        // general case : be transparent
0072         public:
0073             typedef Tr  compatible_type;
0074         };
0075 
0076         // **** CompatAlloc general definitions : -----------------------------
0077         template<class Alloc>
0078         class CompatAlloc
0079         {        // general case : be transparent
0080         public:
0081             typedef Alloc  compatible_type;
0082         };
0083 
0084     } //N.S. io
0085 } // N.S. boost
0086 #endif // include guard