ios.hpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. // See http://www.boost.org/libs/iostreams for documentation.
  6. #ifndef BOOST_IOSTREAMS_DETAIL_IOS_HPP_INCLUDED
  7. #define BOOST_IOSTREAMS_DETAIL_IOS_HPP_INCLUDED
  8. #if defined(_MSC_VER)
  9. # pragma once
  10. #endif
  11. #include <boost/config.hpp> // BOOST_MSVC.
  12. #include <boost/detail/workaround.hpp>
  13. #include <boost/iostreams/detail/config/wide_streams.hpp>
  14. #ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES
  15. # if !BOOST_WORKAROUND(__MWERKS__, <= 0x3003)
  16. # include <ios>
  17. # else
  18. # include <istream>
  19. # include <ostream>
  20. # endif
  21. #else
  22. # include <exception>
  23. # include <iosfwd>
  24. #endif
  25. namespace boost { namespace iostreams { namespace detail {
  26. #ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //--------------------------------//
  27. # define BOOST_IOSTREAMS_BASIC_IOS(ch, tr) std::basic_ios< ch, tr >
  28. # if !BOOST_WORKAROUND(__MWERKS__, <= 0x3003) && \
  29. !BOOST_WORKAROUND(__BORLANDC__, < 0x600) \
  30. /**/
  31. #define BOOST_IOS std::ios
  32. #define BOOST_IOSTREAMS_FAILURE std::ios::failure
  33. # else
  34. #define BOOST_IOS std::ios_base
  35. #define BOOST_IOSTREAMS_FAILURE std::ios_base::failure
  36. # endif
  37. #else // #ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //-----------------------//
  38. #define BOOST_IOS std::ios
  39. #define BOOST_IOSTREAMS_BASIC_IOS(ch, tr) std::ios
  40. #define BOOST_IOSTREAMS_FAILURE boost::iostreams::detail::failure
  41. class failure : std::exception {
  42. public:
  43. explicit failure(const std::string& what_arg) : what_(what_arg) { }
  44. const char* what() const { return what_.c_str(); }
  45. private:
  46. std::string what_;
  47. };
  48. #endif // #ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //----------------------//
  49. } } } // End namespace failure, iostreams, boost.
  50. #endif // #ifndef BOOST_IOSTREAMS_DETAIL_IOS_HPP_INCLUDED