1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/ossrv_pub/boost_apis/boost/iostreams/char_traits.hpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,72 @@
1.4 +// (C) Copyright Jonathan Turkanis 2003.
1.5 +// Distributed under the Boost Software License, Version 1.0. (See accompanying
1.6 +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
1.7 +
1.8 +// See http://www.boost.org/libs/iostreams for documentation.
1.9 +
1.10 +#ifndef BOOST_IOSTREAMS_CHAR_TRAITS_HPP_INCLUDED
1.11 +#define BOOST_IOSTREAMS_CHAR_TRAITS_HPP_INCLUDED
1.12 +
1.13 +#if defined(_MSC_VER) && (_MSC_VER >= 1020)
1.14 +# pragma once
1.15 +#endif
1.16 +
1.17 +#include <boost/config.hpp>
1.18 +#include <cstddef>
1.19 +#include <cstdio> // EOF.
1.20 +#include <string> // std::char_traits.
1.21 +#include <boost/iostreams/detail/char_traits.hpp>
1.22 +#include <boost/iostreams/detail/config/wide_streams.hpp>
1.23 +#ifndef BOOST_IOSTREAMS_NO_WIDE_STREAMS
1.24 +# include <cwchar>
1.25 +#endif
1.26 +
1.27 +#ifdef BOOST_NO_STDC_NAMESPACE
1.28 +namespace std { using ::wint_t; }
1.29 +#endif
1.30 +
1.31 +namespace boost { namespace iostreams {
1.32 +
1.33 +// Dinkumware that comes with QNX Momentics 6.3.0, 4.0.2, incorrectly defines the
1.34 +// EOF and WEOF macros to not std:: qualify the wint_t type (and so does
1.35 +// Sun C++ 5.8 + STLport 4). Fix by placing the def in this scope.
1.36 +// NOTE: Use BOOST_WORKAROUND?
1.37 +#if (defined(__QNX__) && defined(BOOST_DINKUMWARE_STDLIB)) \
1.38 + || defined(__SUNPRO_CC)
1.39 +using ::std::wint_t;
1.40 +#endif
1.41 +
1.42 +const int WOULD_BLOCK = (int) (EOF - 1);
1.43 +
1.44 +#ifndef BOOST_IOSTREAMS_NO_WIDE_STREAMS
1.45 +const std::wint_t WWOULD_BLOCK = (std::wint_t) (WEOF - 1);
1.46 +#endif
1.47 +
1.48 +template<typename Ch>
1.49 +struct char_traits;
1.50 +
1.51 +template<>
1.52 +struct char_traits<char> : BOOST_IOSTREAMS_CHAR_TRAITS(char) {
1.53 + static char newline() { return '\n'; }
1.54 + static int good() { return '\n'; }
1.55 + static int would_block() { return WOULD_BLOCK; }
1.56 + static bool is_good(int c) { return c != EOF && c != WOULD_BLOCK; }
1.57 + static bool is_eof(int c) { return c == EOF; }
1.58 + static bool would_block(int c) { return c == WOULD_BLOCK; }
1.59 +};
1.60 +
1.61 +#ifndef BOOST_IOSTREAMS_NO_WIDE_STREAMS
1.62 +template<>
1.63 +struct char_traits<wchar_t> : std::char_traits<wchar_t> {
1.64 + static wchar_t newline() { return L'\n'; }
1.65 + static std::wint_t good() { return L'\n'; }
1.66 + static std::wint_t would_block() { return WWOULD_BLOCK; }
1.67 + static bool is_good(std::wint_t c) { return c != WEOF && c != WWOULD_BLOCK; }
1.68 + static bool is_eof(std::wint_t c) { return c == WEOF; }
1.69 + static bool would_block(std::wint_t c) { return c == WWOULD_BLOCK; }
1.70 +};
1.71 +#endif
1.72 +
1.73 +} } // End namespaces iostreams, boost.
1.74 +
1.75 +#endif // #ifndef BOOST_IOSTREAMS_CHAR_TRAITS_HPP_INCLUDED