annotate DEPENDENCIES/generic/include/boost/iostreams/char_traits.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com)
Chris@16 2 // (C) Copyright 2003-2007 Jonathan Turkanis
Chris@16 3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
Chris@16 4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
Chris@16 5
Chris@16 6 // See http://www.boost.org/libs/iostreams for documentation.
Chris@16 7
Chris@16 8 #ifndef BOOST_IOSTREAMS_CHAR_TRAITS_HPP_INCLUDED
Chris@16 9 #define BOOST_IOSTREAMS_CHAR_TRAITS_HPP_INCLUDED
Chris@16 10
Chris@16 11 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
Chris@16 12 # pragma once
Chris@16 13 #endif
Chris@16 14
Chris@16 15 #include <boost/config.hpp>
Chris@16 16 #include <cstddef>
Chris@16 17 #include <cstdio> // EOF.
Chris@16 18 #include <string> // std::char_traits.
Chris@16 19 #include <boost/iostreams/detail/char_traits.hpp>
Chris@16 20 #include <boost/iostreams/detail/config/wide_streams.hpp>
Chris@16 21 #ifndef BOOST_IOSTREAMS_NO_WIDE_STREAMS
Chris@16 22 # include <cwchar>
Chris@16 23 #endif
Chris@16 24
Chris@16 25 #ifdef BOOST_NO_STDC_NAMESPACE
Chris@16 26 namespace std { using ::wint_t; }
Chris@16 27 #endif
Chris@16 28
Chris@16 29 namespace boost { namespace iostreams {
Chris@16 30
Chris@16 31 // Dinkumware that comes with QNX Momentics 6.3.0, 4.0.2, incorrectly defines
Chris@16 32 // the EOF and WEOF macros to not std:: qualify the wint_t type (and so does
Chris@16 33 // Sun C++ 5.8 + STLport 4). Fix by placing the def in this scope.
Chris@16 34 // NOTE: Use BOOST_WORKAROUND?
Chris@16 35 #if (defined(__QNX__) && defined(BOOST_DINKUMWARE_STDLIB)) \
Chris@16 36 || defined(__SUNPRO_CC)
Chris@16 37 using ::std::wint_t;
Chris@16 38 #endif
Chris@16 39
Chris@16 40 const int WOULD_BLOCK = (int) (EOF - 1);
Chris@16 41
Chris@16 42 #ifndef BOOST_IOSTREAMS_NO_WIDE_STREAMS
Chris@16 43 const std::wint_t WWOULD_BLOCK = (std::wint_t) (WEOF - 1);
Chris@16 44 #endif
Chris@16 45
Chris@16 46 template<typename Ch>
Chris@16 47 struct char_traits;
Chris@16 48
Chris@16 49 template<>
Chris@16 50 struct char_traits<char> : BOOST_IOSTREAMS_CHAR_TRAITS(char) {
Chris@16 51 static char newline() { return '\n'; }
Chris@16 52 static int good() { return '\n'; }
Chris@16 53 static int would_block() { return WOULD_BLOCK; }
Chris@16 54 static bool is_good(int c) { return c != EOF && c != WOULD_BLOCK; }
Chris@16 55 static bool is_eof(int c) { return c == EOF; }
Chris@16 56 static bool would_block(int c) { return c == WOULD_BLOCK; }
Chris@16 57 };
Chris@16 58
Chris@16 59 #ifndef BOOST_IOSTREAMS_NO_WIDE_STREAMS
Chris@16 60 template<>
Chris@16 61 struct char_traits<wchar_t> : std::char_traits<wchar_t> {
Chris@16 62 static wchar_t newline() { return L'\n'; }
Chris@16 63 static std::wint_t good() { return L'\n'; }
Chris@16 64 static std::wint_t would_block() { return WWOULD_BLOCK; }
Chris@16 65 static bool is_good(std::wint_t c) { return c != WEOF && c != WWOULD_BLOCK; }
Chris@16 66 static bool is_eof(std::wint_t c) { return c == WEOF; }
Chris@16 67 static bool would_block(std::wint_t c) { return c == WWOULD_BLOCK; }
Chris@16 68 };
Chris@16 69 #endif
Chris@16 70
Chris@16 71 } } // End namespaces iostreams, boost.
Chris@16 72
Chris@16 73 #endif // #ifndef BOOST_IOSTREAMS_CHAR_TRAITS_HPP_INCLUDED