source: NonGTP/Boost/boost/archive/add_facet.hpp @ 857

Revision 857, 1.8 KB checked in by igarcia, 19 years ago (diff)
Line 
1#ifndef BOOST_ARCHIVE_ADD_FACET_HPP
2#define BOOST_ARCHIVE_ADD_FACET_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// add_facet.hpp
11
12// (C) Copyright 2003 Robert Ramey - http://www.rrsd.com .
13// Use, modification and distribution is subject to the Boost Software
14// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
15// http://www.boost.org/LICENSE_1_0.txt)
16
17//  See http://www.boost.org for updates, documentation, and revision history.
18
19#include <locale>
20#include <boost/config.hpp>
21#include <boost/detail/workaround.hpp>
22
23// does STLport uses native STL for locales?
24#if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) \
25&& defined(_STLP_NO_OWN_IOSTREAMS)
26// and this native STL lib is old Dinkumware (has not defined _CPPLIB_VER)
27#  if (defined(_YVALS) && !defined(__IBMCPP__)) || !defined(_CPPLIB_VER)
28#    define BOOST_ARCHIVE_OLD_DINKUMWARE_BENEATH_STLPORT
29#  endif
30#endif
31
32namespace boost {
33namespace archive {
34
35template<class Facet>
36inline std::locale *
37add_facet(const std::locale &l, Facet * f){
38    return
39        #if defined BOOST_ARCHIVE_OLD_DINKUMWARE_BENEATH_STLPORT
40            // std namespace used for native locale
41            new std::locale(std::_Addfac(l, f));
42        #elif BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) // old Dinkumwar
43            // std namespace used for native locale
44            new std::locale(std::_Addfac(l, f));
45        #else
46            // standard compatible
47            new std::locale(l, f);
48        #endif
49}
50
51} // namespace archive
52} // namespace boost
53
54#undef BOOST_ARCHIVE_OLD_DINKUMWARE_BENEATH_STLPORT
55
56#endif // BOOST_ARCHIVE_ADD_FACET_HPP
Note: See TracBrowser for help on using the repository browser.