blob: 32aa5344912882786dd0f36b1002866512dbd2e6 [file] [log] [blame]
Jeff Thompson86b6d642013-10-17 15:01:56 -07001// (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
31namespace ndnboost { namespace iostreams { namespace detail {
32
33template<class Facet>
34inline 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