Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/boost/archive/basic_streambuf_locale_saver.hpp @ 29

Last change on this file since 29 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 1.9 KB
Line 
1#ifndef BOOST_ARCHIVE_BASIC_STREAMBUF_LOCALE_SAVER_HPP
2#define BOOST_ARCHIVE_BASIC_STREAMBUF_LOCALE_SAVER_HPP
3
4// MS compatible compilers support #pragma once
5#if defined(_MSC_VER) && (_MSC_VER >= 1020)
6# pragma once
7#endif
8
9/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10// basic_streambuf_local_saver.hpp
11
12// (C) Copyright 2005 Robert Ramey - http://www.rrsd.com
13
14// Use, modification and distribution is subject to the Boost Software
15// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
16// http://www.boost.org/LICENSE_1_0.txt)
17
18//  See http://www.boost.org for updates, documentation, and revision history.
19
20// note derived from boost/io/ios_state.hpp
21// Copyright 2002, 2005 Daryle Walker.  Use, modification, and distribution
22// are subject to the Boost Software License, Version 1.0.  (See accompanying
23// file LICENSE_1_0.txt or a copy at <http://www.boost.org/LICENSE_1_0.txt>.)
24
25//  See <http://www.boost.org/libs/io/> for the library's home page.
26
27#ifndef BOOST_NO_STD_LOCALE
28#include <locale>     // for std::locale
29#endif
30#include <streambuf>  // for std::basic_streambuf
31
32namespace boost{
33namespace archive{
34
35#ifndef BOOST_NO_STD_LOCALE
36template < typename Ch, class Tr >
37class basic_streambuf_locale_saver
38{
39public:
40    typedef ::std::basic_streambuf<Ch, Tr> state_type;
41    typedef ::std::locale aspect_type;
42    explicit basic_streambuf_locale_saver( state_type &s )
43        : s_save_( s ), a_save_( s.getloc() )
44        {}
45    basic_streambuf_locale_saver( state_type &s, aspect_type const &a )
46        : s_save_( s ), a_save_( s.pubimbue(a) )
47        {}
48    ~basic_streambuf_locale_saver()
49        { this->restore(); }
50    void  restore()
51        { s_save_.pubimbue( a_save_ ); }
52private:
53    state_type &       s_save_;
54    aspect_type const  a_save_;
55};
56
57} // archive
58} // boost
59
60#endif // BOOST_NO_STD_LOCALE
61#endif // BOOST_ARCHIVE_BASIC_STREAMBUF_LOCALE_SAVER_HPP
Note: See TracBrowser for help on using the repository browser.