annotate DEPENDENCIES/generic/include/boost/archive/basic_streambuf_locale_saver.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 #ifndef BOOST_ARCHIVE_BASIC_STREAMBUF_LOCALE_SAVER_HPP
Chris@16 2 #define BOOST_ARCHIVE_BASIC_STREAMBUF_LOCALE_SAVER_HPP
Chris@16 3
Chris@16 4 // MS compatible compilers support #pragma once
Chris@101 5 #if defined(_MSC_VER)
Chris@16 6 # pragma once
Chris@16 7 #endif
Chris@16 8
Chris@16 9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
Chris@101 10 // basic_streambuf_locale_saver.hpp
Chris@16 11
Chris@16 12 // (C) Copyright 2005 Robert Ramey - http://www.rrsd.com
Chris@16 13
Chris@16 14 // Use, modification and distribution is subject to the Boost Software
Chris@16 15 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 16 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 17
Chris@16 18 // See http://www.boost.org for updates, documentation, and revision history.
Chris@16 19
Chris@16 20 // note derived from boost/io/ios_state.hpp
Chris@16 21 // Copyright 2002, 2005 Daryle Walker. Use, modification, and distribution
Chris@16 22 // are subject to the Boost Software License, Version 1.0. (See accompanying
Chris@16 23 // file LICENSE_1_0.txt or a copy at <http://www.boost.org/LICENSE_1_0.txt>.)
Chris@16 24
Chris@16 25 // See <http://www.boost.org/libs/io/> for the library's home page.
Chris@16 26
Chris@16 27 #ifndef BOOST_NO_STD_LOCALE
Chris@16 28
Chris@16 29 #include <locale> // for std::locale
Chris@16 30 #include <streambuf> // for std::basic_streambuf
Chris@16 31
Chris@16 32 #include <boost/config.hpp>
Chris@16 33 #include <boost/noncopyable.hpp>
Chris@16 34
Chris@16 35 #ifdef BOOST_MSVC
Chris@16 36 # pragma warning(push)
Chris@16 37 # pragma warning(disable : 4511 4512)
Chris@16 38 #endif
Chris@16 39
Chris@16 40 namespace boost{
Chris@16 41 namespace archive{
Chris@16 42
Chris@16 43 template < typename Ch, class Tr >
Chris@16 44 class basic_streambuf_locale_saver :
Chris@16 45 private boost::noncopyable
Chris@16 46 {
Chris@16 47 public:
Chris@16 48 typedef ::std::basic_streambuf<Ch, Tr> state_type;
Chris@16 49 typedef ::std::locale aspect_type;
Chris@16 50 explicit basic_streambuf_locale_saver( state_type &s )
Chris@16 51 : s_save_( s ), a_save_( s.getloc() )
Chris@16 52 {}
Chris@101 53 explicit basic_streambuf_locale_saver( state_type &s, aspect_type const &a )
Chris@16 54 : s_save_( s ), a_save_( s.pubimbue(a) )
Chris@16 55 {}
Chris@16 56 ~basic_streambuf_locale_saver()
Chris@16 57 { this->restore(); }
Chris@101 58 void restore(){
Chris@101 59 s_save_.pubsync();
Chris@101 60 s_save_.pubimbue( a_save_ );
Chris@101 61 }
Chris@16 62 private:
Chris@16 63 state_type & s_save_;
Chris@16 64 aspect_type const a_save_;
Chris@16 65 };
Chris@16 66
Chris@16 67 } // archive
Chris@16 68 } // boost
Chris@16 69
Chris@16 70 #ifdef BOOST_MSVC
Chris@16 71 #pragma warning(pop)
Chris@16 72 #endif
Chris@16 73
Chris@16 74 #endif // BOOST_NO_STD_LOCALE
Chris@16 75 #endif // BOOST_ARCHIVE_BASIC_STREAMBUF_LOCALE_SAVER_HPP