BVB Source Codes

mars Show char_traits.hpp Source code

Return Download mars: download char_traits.hpp Source code - Download mars Source code - Type:.hpp
  1. // (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com)
  2. // (C) Copyright 2003-2007 Jonathan Turkanis
  3. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
  5.  
  6. // See http://www.boost.org/libs/iostreams for documentation.
  7.  
  8. #ifndef BOOST_IOSTREAMS_CHAR_TRAITS_HPP_INCLUDED
  9. #define BOOST_IOSTREAMS_CHAR_TRAITS_HPP_INCLUDED
  10.  
  11. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  12. # pragma once
  13. #endif
  14.  
  15. #include <boost/config.hpp>
  16. #include <cstddef>
  17. #include <cstdio>  // EOF.
  18. #include <string>  // std::char_traits.
  19. #include <boost/iostreams/detail/char_traits.hpp>
  20. #include <boost/iostreams/detail/config/wide_streams.hpp>
  21. #ifndef BOOST_IOSTREAMS_NO_WIDE_STREAMS
  22. # include <cwchar>
  23. #endif
  24.  
  25. #ifdef BOOST_NO_STDC_NAMESPACE
  26. namespace std { using ::wint_t; }
  27. #endif
  28.  
  29. namespace mars_boost {} namespace boost = mars_boost; namespace mars_boost { namespace iostreams {
  30.  
  31. // Dinkumware that comes with QNX Momentics 6.3.0, 4.0.2, incorrectly defines
  32. // the EOF and WEOF macros to not std:: qualify the wint_t type (and so does
  33. // Sun C++ 5.8 + STLport 4). Fix by placing the def in this scope.
  34. // NOTE: Use BOOST_WORKAROUND?
  35. #if (defined(__QNX__) && defined(BOOST_DINKUMWARE_STDLIB))  \
  36.     || defined(__SUNPRO_CC)
  37. using ::std::wint_t;
  38. #endif
  39.  
  40. const int WOULD_BLOCK = (int) (EOF - 1);
  41.  
  42. #ifndef BOOST_IOSTREAMS_NO_WIDE_STREAMS
  43. const std::wint_t WWOULD_BLOCK = (std::wint_t) (WEOF - 1);
  44. #endif
  45.  
  46. template<typename Ch>
  47. struct char_traits;
  48.  
  49. template<>
  50. struct char_traits<char> : BOOST_IOSTREAMS_CHAR_TRAITS(char) {
  51.     static char newline() { return '\n'; }
  52.     static int good() { return '\n'; }
  53.     static int would_block() { return WOULD_BLOCK; }
  54.     static bool is_good(int c) { return c != EOF && c != WOULD_BLOCK; }
  55.     static bool is_eof(int c) { return c == EOF; }
  56.     static bool would_block(int c) { return c == WOULD_BLOCK; }
  57. };
  58.  
  59. #ifndef BOOST_IOSTREAMS_NO_WIDE_STREAMS
  60. template<>
  61. struct char_traits<wchar_t> : std::char_traits<wchar_t> {
  62.     static wchar_t newline() { return L'\n'; }
  63.     static std::wint_t good() { return L'\n'; }
  64.     static std::wint_t would_block() { return WWOULD_BLOCK; }
  65.     static bool is_good(std::wint_t c) { return c != WEOF && c != WWOULD_BLOCK; }
  66.     static bool is_eof(std::wint_t c) { return c == WEOF; }
  67.     static bool would_block(std::wint_t c) { return c == WWOULD_BLOCK; }
  68. };
  69. #endif
  70.  
  71. } } // End namespaces iostreams, boost.
  72.  
  73. #endif // #ifndef BOOST_IOSTREAMS_CHAR_TRAITS_HPP_INCLUDED
  74.  
downloadchar_traits.hpp Source code - Download mars Source code
Related Source Codes/Software:
Hero - Elegant transition library for iOS & tvOS 2017-06-09
deep-photo-styletransfer - Code and data for paper "Deep Photo Style Transfer... 2017-06-09
mastodon - A GNU Social-compatible microblogging server ... 2017-06-09
plyr - A simple HTML5, YouTube and Vimeo player ... 2017-06-08
prepack - Prepack is a partial evaluator for JavaScript. Pre... 2017-06-08
Public-APIs - 2017-06-09
lottie-ios - An iOS library to natively render After Effects ve... 2017-06-09
Awesome-Hacking - A collection of various awesome lists for hackers,... 2017-06-09
algorithms - Minimal examples of data structures and algorithms... 2017-06-10
lectures - Oxford Deep NLP 2017 course 2017-06-10
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top