Jeff Thompson | 86b6d64 | 2013-10-17 15:01:56 -0700 | [diff] [blame] | 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 <ndnboost/archive/add_facet.hpp> |
| 9 | |
| 10 | #ifndef NDNBOOST_IOSTREAMS_DETAIL_ADD_FACET_HPP_INCLUDED |
| 11 | #define NDNBOOST_IOSTREAMS_DETAIL_ADD_FACET_HPP_INCLUDED |
| 12 | |
| 13 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) |
| 14 | # pragma once |
| 15 | #endif |
| 16 | |
| 17 | #include <ndnboost/config.hpp> // NDNBOOST_DINKUMWARE_STDLIB. |
| 18 | #include <ndnboost/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 NDNBOOST_IOSTREMS_STLPORT_WITH_OLD_DINKUMWARE |
| 28 | # endif |
| 29 | #endif |
| 30 | |
| 31 | namespace ndnboost { 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 NDNBOOST_WORKAROUND(NDNBOOST_DINKUMWARE_STDLIB, == 1) || \ |
| 38 | defined(NDNBOOST_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 NDNBOOST_IOSTREAMS_DETAIL_ADD_FACET_HPP_INCLUDED |