| 1 | // (C) Copyright Jonathan Turkanis 2003. |
|---|
| 2 | // Distributed under the Boost Software License, Version 1.0. (See accompanying |
|---|
| 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.) |
|---|
| 4 | |
|---|
| 5 | // See http://www.boost.org/libs/iostreams for documentation. |
|---|
| 6 | |
|---|
| 7 | // Borrowed from <boost/archive/add_facet.hpp> |
|---|
| 8 | |
|---|
| 9 | #ifndef BOOST_IOSTREAMS_DETAIL_ADD_FACET_HPP_INCLUDED |
|---|
| 10 | #define BOOST_IOSTREAMS_DETAIL_ADD_FACET_HPP_INCLUDED |
|---|
| 11 | |
|---|
| 12 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) |
|---|
| 13 | # pragma once |
|---|
| 14 | #endif |
|---|
| 15 | |
|---|
| 16 | #include <boost/config.hpp> // BOOST_DINKUMWARE_STDLIB. |
|---|
| 17 | #include <boost/detail/workaround.hpp> |
|---|
| 18 | |
|---|
| 19 | //------------------Definition of add_facet-----------------------------------// |
|---|
| 20 | |
|---|
| 21 | // Does STLport uses old Dinkumware locale? |
|---|
| 22 | #if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && \ |
|---|
| 23 | defined(_STLP_NO_OWN_IOSTREAMS) \ |
|---|
| 24 | /**/ |
|---|
| 25 | # if (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER) |
|---|
| 26 | # define BOOST_IOSTREMS_STLPORT_WITH_OLD_DINKUMWARE |
|---|
| 27 | # endif |
|---|
| 28 | #endif |
|---|
| 29 | |
|---|
| 30 | namespace boost { namespace iostreams { namespace detail { |
|---|
| 31 | |
|---|
| 32 | template<class Facet> |
|---|
| 33 | inline std::locale add_facet(const std::locale &l, Facet * f) |
|---|
| 34 | { |
|---|
| 35 | return |
|---|
| 36 | #if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) || \ |
|---|
| 37 | defined(BOOST_IOSTREMS_STLPORT_WITH_OLD_DINKUMWARE) \ |
|---|
| 38 | /**/ |
|---|
| 39 | std::locale(std::_Addfac(l, f)); |
|---|
| 40 | #else |
|---|
| 41 | // standard compatible |
|---|
| 42 | std::locale(l, f); |
|---|
| 43 | #endif |
|---|
| 44 | } |
|---|
| 45 | |
|---|
| 46 | } } } // End namespaces detail, iostreams, boost. |
|---|
| 47 | |
|---|
| 48 | #endif // #ifndef BOOST_IOSTREAMS_DETAIL_ADD_FACET_HPP_INCLUDED |
|---|