Back to home page

EIC code displayed by LXR

 
 

    


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

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_CHAR_TRAITS_HPP_INCLUDED
0009 #define BOOST_IOSTREAMS_CHAR_TRAITS_HPP_INCLUDED
0010 
0011 #if defined(_MSC_VER)
0012 # pragma once
0013 #endif 
0014 
0015 #include <boost/config.hpp>
0016 #include <cstddef>
0017 #include <cstdio>  // EOF.
0018 #include <string>  // std::char_traits.
0019 #include <boost/iostreams/detail/char_traits.hpp>
0020 #include <boost/iostreams/detail/config/wide_streams.hpp>
0021 #ifndef BOOST_IOSTREAMS_NO_WIDE_STREAMS
0022 # include <cwchar>
0023 #endif
0024 
0025 #ifdef BOOST_NO_STDC_NAMESPACE
0026 namespace std { using ::wint_t; }
0027 #endif
0028 
0029 namespace boost { namespace iostreams {
0030 
0031 // Dinkumware that comes with QNX Momentics 6.3.0, 4.0.2, incorrectly defines
0032 // the EOF and WEOF macros to not std:: qualify the wint_t type (and so does
0033 // Sun C++ 5.8 + STLport 4). Fix by placing the def in this scope.
0034 // NOTE: Use BOOST_WORKAROUND?
0035 #if (defined(__QNX__) && defined(BOOST_DINKUMWARE_STDLIB))  \
0036     || defined(__SUNPRO_CC)
0037 using ::std::wint_t;
0038 #endif
0039 
0040 const int WOULD_BLOCK = (int) (EOF - 1);
0041 
0042 #ifndef BOOST_IOSTREAMS_NO_WIDE_STREAMS
0043 const std::wint_t WWOULD_BLOCK = (std::wint_t) (WEOF - 1);
0044 #endif
0045 
0046 template<typename Ch>
0047 struct char_traits;
0048 
0049 template<>
0050 struct char_traits<char> : BOOST_IOSTREAMS_CHAR_TRAITS(char) {
0051     static char newline() { return '\n'; }
0052     static int good() { return '\n'; }
0053     static int would_block() { return WOULD_BLOCK; }
0054     static bool is_good(int c) { return c != EOF && c != WOULD_BLOCK; }
0055     static bool is_eof(int c) { return c == EOF; }
0056     static bool would_block(int c) { return c == WOULD_BLOCK; }
0057 };
0058 
0059 #ifndef BOOST_IOSTREAMS_NO_WIDE_STREAMS
0060 template<>
0061 struct char_traits<wchar_t> : std::char_traits<wchar_t> {
0062     static wchar_t newline() { return L'\n'; }
0063     static std::wint_t good() { return L'\n'; }
0064     static std::wint_t would_block() { return WWOULD_BLOCK; }
0065     static bool is_good(std::wint_t c) { return c != WEOF && c != WWOULD_BLOCK; }
0066     static bool is_eof(std::wint_t c) { return c == WEOF; }
0067     static bool would_block(std::wint_t c) { return c == WWOULD_BLOCK; }
0068 };
0069 #endif
0070 
0071 } } // End namespaces iostreams, boost.
0072 
0073 #endif // #ifndef BOOST_IOSTREAMS_CHAR_TRAITS_HPP_INCLUDED