]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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 | // Borrowed from <boost/archive/add_facet.hpp> | |
9 | ||
10 | #ifndef BOOST_IOSTREAMS_DETAIL_ADD_FACET_HPP_INCLUDED | |
11 | #define BOOST_IOSTREAMS_DETAIL_ADD_FACET_HPP_INCLUDED | |
12 | ||
13 | #if defined(_MSC_VER) | |
14 | # pragma once | |
15 | #endif | |
16 | ||
17 | #include <boost/config.hpp> // BOOST_DINKUMWARE_STDLIB. | |
18 | #include <boost/detail/workaround.hpp> | |
19 | ||
20 | //------------------Definition of add_facet-----------------------------------// | |
21 | ||
22 | // Does STLport uses old Dinkumware locale? | |
23 | #if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && \ | |
24 | defined(_STLP_NO_OWN_IOSTREAMS) \ | |
25 | /**/ | |
26 | # if (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER) | |
27 | # define BOOST_IOSTREMS_STLPORT_WITH_OLD_DINKUMWARE | |
28 | # endif | |
29 | #endif | |
30 | ||
31 | namespace boost { namespace iostreams { namespace detail { | |
32 | ||
33 | template<class Facet> | |
34 | inline std::locale add_facet(const std::locale &l, Facet * f) | |
35 | { | |
36 | return | |
37 | #if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) || \ | |
38 | defined(BOOST_IOSTREMS_STLPORT_WITH_OLD_DINKUMWARE) \ | |
39 | /**/ | |
40 | std::locale(std::_Addfac(l, f)); | |
41 | #else | |
42 | // standard compatible | |
43 | std::locale(l, f); | |
44 | #endif | |
45 | } | |
46 | ||
47 | } } } // End namespaces detail, iostreams, boost. | |
48 | ||
49 | #endif // #ifndef BOOST_IOSTREAMS_DETAIL_ADD_FACET_HPP_INCLUDED |