2003-01-22 17:51:52 +01:00
|
|
|
// Locale support -*- C++ -*-
|
|
|
|
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
2011-01-21 20:41:13 +01:00
|
|
|
// 2006, 2007, 2008, 2009, 2010, 2011
|
2003-01-22 17:51:52 +01:00
|
|
|
// Free Software Foundation, Inc.
|
|
|
|
//
|
|
|
|
// This file is part of the GNU ISO C++ Library. This library is free
|
|
|
|
// software; you can redistribute it and/or modify it under the
|
|
|
|
// terms of the GNU General Public License as published by the
|
2009-04-09 17:00:19 +02:00
|
|
|
// Free Software Foundation; either version 3, or (at your option)
|
2003-01-22 17:51:52 +01:00
|
|
|
// any later version.
|
|
|
|
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
2009-04-09 17:00:19 +02:00
|
|
|
// Under Section 7 of GPL version 3, you are granted additional
|
|
|
|
// permissions described in the GCC Runtime Library Exception, version
|
|
|
|
// 3.1, as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
// You should have received a copy of the GNU General Public License and
|
|
|
|
// a copy of the GCC Runtime Library Exception along with this program;
|
|
|
|
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
|
|
// <http://www.gnu.org/licenses/>.
|
2003-01-22 17:51:52 +01:00
|
|
|
|
2010-12-19 10:21:16 +01:00
|
|
|
/** @file bits/locale_classes.h
|
2003-01-22 17:51:52 +01:00
|
|
|
* This is an internal header file, included by other library headers.
|
2010-12-19 10:21:16 +01:00
|
|
|
* Do not attempt to use it directly. @headername{locale}
|
2003-01-22 17:51:52 +01:00
|
|
|
*/
|
|
|
|
|
2006-12-06 00:24:07 +01:00
|
|
|
//
|
|
|
|
// ISO C++ 14882: 22.1 Locales
|
|
|
|
//
|
|
|
|
|
2003-07-05 06:05:45 +02:00
|
|
|
#ifndef _LOCALE_CLASSES_H
|
|
|
|
#define _LOCALE_CLASSES_H 1
|
2003-01-22 17:51:52 +01:00
|
|
|
|
|
|
|
#pragma GCC system_header
|
|
|
|
|
|
|
|
#include <bits/localefwd.h>
|
|
|
|
#include <string>
|
2006-09-14 11:48:15 +02:00
|
|
|
#include <ext/atomicity.h>
|
2003-01-22 17:51:52 +01:00
|
|
|
|
PR libstdc++/36104 part four
2011-01-30 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/36104 part four
* include/bits/c++config (_GLIBCXX_STD): Remove.
(_GLIBCXX_STD_D, _GLIBCXX_PR): Now _GLIBCXX_STD_C.
(_GLIBCXX_P): Now _GLIBCXX_STD_A.
(_GLIBCXX_NAMESPACE_DEBUG, _GLIBCXX_NAMESPACE_PARALLEL,
_GLIBCXX_NAMESPACE_PROFILE, _GLIBCXX_NAMESPACE_VERSION): Remove.
(_GLIBCXX_INLINE_DEBUG, _GLIBCXX_INLINE_PARALLEL,
_GLIBCXX_INLINE_PROFILE): Remove.
(_GLIBCXX_BEGIN_NAMESPACE(X)): Remove.
(_GLIBCXX_END_NAMESPACE): Remove.
(_GLIBCXX_BEGIN_NESTED_NAMESPACE(X, Y)): Remove.
(_GLIBCXX_END_NESTED_NAMESPACE): Remove.
(_GLIBCXX_BEGIN_NAMESPACE_ALGO): Add.
(_GLIBCXX_END_NAMESPACE_ALGO): Add.
(_GLIBCXX_BEGIN_NAMESPACE_CONTAINER): Add.
(_GLIBCXX_END_NAMESPACE_CONTAINER): Add.
(_GLIBCXX_BEGIN_NAMESPACE_VERSION): Add.
(_GLIBCXX_END_NAMESPACE_VERSION): Add.
(_GLIBCXX_BEGIN_LDBL_NAMESPACE): To _GLIBCXX_BEGIN_NAMESPACE_LDBL.
(_GLIBCXX_END_LDBL_NAMESPACE): To _GLIBCXX_END_NAMESPACE_LDBL.
(_GLIBCXX_VISIBILITY_ATTR): Revert to _GLIBCXX_VISIBILITY.
* include/*: Use new macros for namespace scope.
* config/*: Same.
* src/*: Same.
* src/Makefile.am (sources): Remove debug_list.cc, add
compatibility-debug_list-2.cc.
(parallel_sources): Remove parallel_list.cc, add
compatibility-parallel_list-2.cc.
(compatibility-parallel_list-2.[o,lo]): New rule.
* src/Makefile.in: Regenerate.
* src/debug_list.cc: Remove.
* src/parallel_list.cc: Remove.
* src/compatibility-list-2.cc: New.
* src/compatibility-debug_list-2.cc: New.
* src/compatibility-parallel_list-2.cc: New.
* doc/doxygen/user.cfg.in: Adjust macros.
* testsuite/20_util/auto_ptr/assign_neg.cc: Adjust line numbers, macros.
* testsuite/20_util/declval/requirements/1_neg.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg1.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg2.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg3.cc: Same.
* testsuite/20_util/forward/c_neg.cc: Same.
* testsuite/20_util/forward/f_neg.cc: Same.
* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Same.
* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Same.
* testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Same.
* testsuite/20_util/ratio/operations/ops_overflow_neg.cc: Same.
* testsuite/20_util/shared_ptr/cons/43820_neg.cc: Same.
* testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc: Same.
* testsuite/23_containers/forward_list/capacity/1.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
assign_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
insert_neg.cc: Same.
* testsuite/23_containers/list/capacity/29134.cc: Same.
* testsuite/23_containers/list/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/insert_neg.cc: Same.
* testsuite/23_containers/vector/bool/capacity/29134.cc: Same.
* testsuite/23_containers/vector/bool/modifiers/insert/31370.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc: Same.
* testsuite/25_algorithms/sort/35588.cc: Same.
* testsuite/27_io/ios_base/cons/assign_neg.cc: Same.
* testsuite/27_io/ios_base/cons/copy_neg.cc: Same.
* testsuite/ext/profile/mutex_extensions_neg.cc: Same.
* testsuite/ext/profile/profiler_algos.cc: Same.
* testsuite/ext/type_traits/add_unsigned_floating_neg.cc: Same.
* testsuite/ext/type_traits/add_unsigned_integer_neg.cc: Same.
* testsuite/ext/type_traits/remove_unsigned_floating_neg.cc: Same.
* testsuite/ext/type_traits/remove_unsigned_integer_neg.cc: Same.
* testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc: Same.
From-SVN: r169421
2011-01-30 23:39:36 +01:00
|
|
|
namespace std _GLIBCXX_VISIBILITY(default)
|
|
|
|
{
|
|
|
|
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
2005-12-19 01:56:05 +01:00
|
|
|
|
2003-01-22 17:51:52 +01:00
|
|
|
// 22.1.1 Class locale
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
|
|
|
* @brief Container class for localization functionality.
|
2010-02-10 06:45:24 +01:00
|
|
|
* @ingroup locales
|
2003-12-20 16:51:09 +01:00
|
|
|
*
|
|
|
|
* The locale class is first a class wrapper for C library locales. It is
|
|
|
|
* also an extensible container for user-defined localization. A locale is
|
|
|
|
* a collection of facets that implement various localization features such
|
|
|
|
* as money, time, and number printing.
|
|
|
|
*
|
|
|
|
* Constructing C++ locales does not change the C library locale.
|
|
|
|
*
|
|
|
|
* This library supports efficient construction and copying of locales
|
|
|
|
* through a reference counting implementation of the locale class.
|
|
|
|
*/
|
2003-01-22 17:51:52 +01:00
|
|
|
class locale
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Types:
|
2003-12-20 16:51:09 +01:00
|
|
|
/// Definition of locale::category.
|
2004-01-10 11:15:35 +01:00
|
|
|
typedef int category;
|
2003-01-22 17:51:52 +01:00
|
|
|
|
|
|
|
// Forward decls and friends:
|
|
|
|
class facet;
|
|
|
|
class id;
|
|
|
|
class _Impl;
|
|
|
|
|
|
|
|
friend class facet;
|
|
|
|
friend class _Impl;
|
|
|
|
|
|
|
|
template<typename _Facet>
|
2004-02-08 05:46:42 +01:00
|
|
|
friend bool
|
2003-01-22 17:51:52 +01:00
|
|
|
has_facet(const locale&) throw();
|
2003-05-13 22:13:15 +02:00
|
|
|
|
|
|
|
template<typename _Facet>
|
2004-02-08 05:46:42 +01:00
|
|
|
friend const _Facet&
|
2003-05-13 22:13:15 +02:00
|
|
|
use_facet(const locale&);
|
2003-06-27 09:25:38 +02:00
|
|
|
|
|
|
|
template<typename _Cache>
|
2003-07-10 08:21:13 +02:00
|
|
|
friend struct __use_cache;
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2003-12-20 16:51:09 +01:00
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
* @brief Category values.
|
|
|
|
*
|
|
|
|
* The standard category values are none, ctype, numeric, collate, time,
|
|
|
|
* monetary, and messages. They form a bitmask that supports union and
|
|
|
|
* intersection. The category all is the union of these values.
|
|
|
|
*
|
|
|
|
* NB: Order must match _S_facet_categories definition in locale.cc
|
|
|
|
*/
|
2003-01-22 17:51:52 +01:00
|
|
|
static const category none = 0;
|
2004-02-08 05:46:42 +01:00
|
|
|
static const category ctype = 1L << 0;
|
|
|
|
static const category numeric = 1L << 1;
|
|
|
|
static const category collate = 1L << 2;
|
|
|
|
static const category time = 1L << 3;
|
|
|
|
static const category monetary = 1L << 4;
|
|
|
|
static const category messages = 1L << 5;
|
|
|
|
static const category all = (ctype | numeric | collate |
|
|
|
|
time | monetary | messages);
|
2003-12-20 16:51:09 +01:00
|
|
|
//@}
|
2003-01-22 17:51:52 +01:00
|
|
|
|
|
|
|
// Construct/copy/destroy:
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
|
|
|
* @brief Default constructor.
|
|
|
|
*
|
|
|
|
* Constructs a copy of the global locale. If no locale has been
|
2010-02-04 19:20:34 +01:00
|
|
|
* explicitly set, this is the C locale.
|
2003-12-20 16:51:09 +01:00
|
|
|
*/
|
2003-01-22 17:51:52 +01:00
|
|
|
locale() throw();
|
|
|
|
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
|
|
|
* @brief Copy constructor.
|
|
|
|
*
|
|
|
|
* Constructs a copy of @a other.
|
|
|
|
*
|
|
|
|
* @param other The locale to copy.
|
|
|
|
*/
|
2003-01-22 17:51:52 +01:00
|
|
|
locale(const locale& __other) throw();
|
|
|
|
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
|
|
|
* @brief Named locale constructor.
|
|
|
|
*
|
|
|
|
* Constructs a copy of the named C library locale.
|
|
|
|
*
|
|
|
|
* @param s Name of the locale to construct.
|
|
|
|
* @throw std::runtime_error if s is null or an undefined locale.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
explicit
|
2003-01-22 17:51:52 +01:00
|
|
|
locale(const char* __s);
|
|
|
|
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
|
|
|
* @brief Construct locale with facets from another locale.
|
|
|
|
*
|
|
|
|
* Constructs a copy of the locale @a base. The facets specified by @a
|
|
|
|
* cat are replaced with those from the locale named by @a s. If base is
|
|
|
|
* named, this locale instance will also be named.
|
|
|
|
*
|
|
|
|
* @param base The locale to copy.
|
|
|
|
* @param s Name of the locale to use facets from.
|
2004-02-08 05:46:42 +01:00
|
|
|
* @param cat Set of categories defining the facets to use from s.
|
2003-12-20 16:51:09 +01:00
|
|
|
* @throw std::runtime_error if s is null or an undefined locale.
|
|
|
|
*/
|
2003-01-22 17:51:52 +01:00
|
|
|
locale(const locale& __base, const char* __s, category __cat);
|
|
|
|
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
|
|
|
* @brief Construct locale with facets from another locale.
|
|
|
|
*
|
|
|
|
* Constructs a copy of the locale @a base. The facets specified by @a
|
|
|
|
* cat are replaced with those from the locale @a add. If @a base and @a
|
|
|
|
* add are named, this locale instance will also be named.
|
|
|
|
*
|
|
|
|
* @param base The locale to copy.
|
|
|
|
* @param add The locale to use facets from.
|
|
|
|
* @param cat Set of categories defining the facets to use from add.
|
|
|
|
*/
|
2003-01-22 17:51:52 +01:00
|
|
|
locale(const locale& __base, const locale& __add, category __cat);
|
|
|
|
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
|
|
|
* @brief Construct locale with another facet.
|
|
|
|
*
|
|
|
|
* Constructs a copy of the locale @a other. The facet @f is added to
|
|
|
|
* @other, replacing an existing facet of type Facet if there is one. If
|
|
|
|
* @f is null, this locale is a copy of @a other.
|
|
|
|
*
|
|
|
|
* @param other The locale to copy.
|
|
|
|
* @param f The facet to add in.
|
|
|
|
*/
|
2003-01-22 17:51:52 +01:00
|
|
|
template<typename _Facet>
|
|
|
|
locale(const locale& __other, _Facet* __f);
|
|
|
|
|
2003-12-20 16:51:09 +01:00
|
|
|
/// Locale destructor.
|
2003-01-22 17:51:52 +01:00
|
|
|
~locale() throw();
|
|
|
|
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
|
|
|
* @brief Assignment operator.
|
|
|
|
*
|
|
|
|
* Set this locale to be a copy of @a other.
|
|
|
|
*
|
|
|
|
* @param other The locale to copy.
|
|
|
|
* @return A reference to this locale.
|
|
|
|
*/
|
|
|
|
const locale&
|
2003-01-22 17:51:52 +01:00
|
|
|
operator=(const locale& __other) throw();
|
|
|
|
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
|
|
|
* @brief Construct locale with another facet.
|
|
|
|
*
|
|
|
|
* Constructs and returns a new copy of this locale. Adds or replaces an
|
|
|
|
* existing facet of type Facet from the locale @a other into the new
|
|
|
|
* locale.
|
|
|
|
*
|
|
|
|
* @param Facet The facet type to copy from other
|
|
|
|
* @param other The locale to copy from.
|
|
|
|
* @return Newly constructed locale.
|
|
|
|
* @throw std::runtime_error if other has no facet of type Facet.
|
|
|
|
*/
|
2003-01-22 17:51:52 +01:00
|
|
|
template<typename _Facet>
|
2004-02-08 05:46:42 +01:00
|
|
|
locale
|
2003-01-22 17:51:52 +01:00
|
|
|
combine(const locale& __other) const;
|
|
|
|
|
|
|
|
// Locale operations:
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
|
|
|
* @brief Return locale name.
|
|
|
|
* @return Locale name or "*" if unnamed.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
string
|
2003-01-22 17:51:52 +01:00
|
|
|
name() const;
|
|
|
|
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
|
|
|
* @brief Locale equality.
|
|
|
|
*
|
|
|
|
* @param other The locale to compare against.
|
|
|
|
* @return True if other and this refer to the same locale instance, are
|
2004-02-08 05:46:42 +01:00
|
|
|
* copies, or have the same name. False otherwise.
|
2003-12-20 16:51:09 +01:00
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
bool
|
2010-02-17 06:43:24 +01:00
|
|
|
operator==(const locale& __other) const throw();
|
2003-01-22 17:51:52 +01:00
|
|
|
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
|
|
|
* @brief Locale inequality.
|
|
|
|
*
|
|
|
|
* @param other The locale to compare against.
|
|
|
|
* @return ! (*this == other)
|
|
|
|
*/
|
2007-04-25 11:25:05 +02:00
|
|
|
bool
|
2010-02-17 06:43:24 +01:00
|
|
|
operator!=(const locale& __other) const throw()
|
2007-04-25 11:25:05 +02:00
|
|
|
{ return !(this->operator==(__other)); }
|
2003-01-22 17:51:52 +01:00
|
|
|
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
|
|
|
* @brief Compare two strings according to collate.
|
|
|
|
*
|
|
|
|
* Template operator to compare two strings using the compare function of
|
|
|
|
* the collate facet in this locale. One use is to provide the locale to
|
|
|
|
* the sort function. For example, a vector v of strings could be sorted
|
|
|
|
* according to locale loc by doing:
|
|
|
|
* @code
|
|
|
|
* std::sort(v.begin(), v.end(), loc);
|
|
|
|
* @endcode
|
|
|
|
*
|
|
|
|
* @param s1 First string to compare.
|
|
|
|
* @param s2 Second string to compare.
|
|
|
|
* @return True if collate<Char> facet compares s1 < s2, else false.
|
|
|
|
*/
|
2003-01-22 17:51:52 +01:00
|
|
|
template<typename _Char, typename _Traits, typename _Alloc>
|
2004-02-08 05:46:42 +01:00
|
|
|
bool
|
2003-01-22 17:51:52 +01:00
|
|
|
operator()(const basic_string<_Char, _Traits, _Alloc>& __s1,
|
|
|
|
const basic_string<_Char, _Traits, _Alloc>& __s2) const;
|
|
|
|
|
|
|
|
// Global locale objects:
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
|
|
|
* @brief Set global locale
|
|
|
|
*
|
|
|
|
* This function sets the global locale to the argument and returns a
|
|
|
|
* copy of the previous global locale. If the argument has a name, it
|
|
|
|
* will also call std::setlocale(LC_ALL, loc.name()).
|
|
|
|
*
|
|
|
|
* @param locale The new locale to make global.
|
|
|
|
* @return Copy of the old global locale.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
static locale
|
2003-01-22 17:51:52 +01:00
|
|
|
global(const locale&);
|
|
|
|
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
2010-02-04 19:20:34 +01:00
|
|
|
* @brief Return reference to the C locale.
|
2003-12-20 16:51:09 +01:00
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
static const locale&
|
2003-01-22 17:51:52 +01:00
|
|
|
classic();
|
|
|
|
|
|
|
|
private:
|
|
|
|
// The (shared) implementation
|
2004-02-08 05:46:42 +01:00
|
|
|
_Impl* _M_impl;
|
2003-01-22 17:51:52 +01:00
|
|
|
|
|
|
|
// The "C" reference locale
|
[multiple changes]
2003-10-02 Benjamin Kosnik <bkoz@redhat.com>
* config/linker-map.gnu: Export _S_get_c_locale instead of
_S_c_locale object.
2003-10-02 Petur Runolfsson <peturr02@ru.is>
* config/locale/generic/c_locale.cc
(category_names, locale::_S_categories): Const qualify.
* config/locale/gnu/c_locale.cc: Same.
* config/locale/generic/time_members.h (__timepunct::__timepunct):
Copy string contents before assigning to _M_name_timepunct,
qualify strcpy and strlen with std::.
* config/locale/gnu/time_members.h: Same.
* config/locale/gnu/messages_members.h (messages::messages):
Copy string contents before assigning to _M_name_messages,
qualify strcpy and strlen with std::.
* config/os/gnu-linux/ctype_noninline.h
(ctype<char>::classic_table()): Don't call locale::classic().
* include/bits/locale_classes.h
(locale::_S_categories): Const qualify.
(locale::_S_once, locale::_S_initialize_once,
locale::facet::_S_once, locale::facet::_S_initialize_once,
locale::facet::_S_get_c_locale): Declare.
(locale::_S_initialize): Don't define.
(locale::facet::_S_c_locale): Make private.
(locale::facet::_S_c_name): Same, const qualify.
(locale::_Impl::_Impl(facet**, size_t, bool)): Drop unused
parameters, add throw() specifier.
* include/bits/locale_facets.h (__timepunct::_M_name_timepunct,
messages::_M_name_messages): Const qualify.
* src/locale.cc
(locale::_S_once, locale::facet::_S_once): Define.
(locale::classic): Move initialization code...
(locale::_S_initialize_once): ...here.
(locale::_S_initialize): Call _S_initialize_once through
__gthread_once.
(locale::facet::_S_initialize_once): Initialize _S_c_locale.
(locale::facet::_S_get_c_locale): Call _S_initialize_once through
__gthread_once before returning _S_c_locale.
* src/localename.cc (locale::_Impl::_Impl(facet**, size_t, bool)):
Drop unused parameters, add throw() specifier, don't initialize
locale::facet::_S_c_locale and _S_c_name.
* config/locale/generic/messages_members.h:
Replace _S_c_locale with _S_get_c_locale().
* config/locale/gnu/c_locale.cc: Same.
* config/locale/gnu/messages_members.h: Same.
* config/locale/gnu/numeric_members.cc: Same.
* config/locale/gnu/time_members.cc: Same.
* config/os/gnu-linux/ctype_noninline.h: Same.
* include/bits/locale_facets.h: Same.
* include/bits/locale_facets.tcc: Same.
* src/codecvt.cc: Same.
* src/ctype.cc: Same.
From-SVN: r72040
2003-10-02 18:56:39 +02:00
|
|
|
static _Impl* _S_classic;
|
2003-01-22 17:51:52 +01:00
|
|
|
|
|
|
|
// Current global locale
|
2004-02-08 05:46:42 +01:00
|
|
|
static _Impl* _S_global;
|
2003-01-22 17:51:52 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
// Names of underlying locale categories.
|
2003-06-27 09:25:38 +02:00
|
|
|
// NB: locale::global() has to know how to modify all the
|
|
|
|
// underlying categories, not just the ones required by the C++
|
|
|
|
// standard.
|
[multiple changes]
2003-10-02 Benjamin Kosnik <bkoz@redhat.com>
* config/linker-map.gnu: Export _S_get_c_locale instead of
_S_c_locale object.
2003-10-02 Petur Runolfsson <peturr02@ru.is>
* config/locale/generic/c_locale.cc
(category_names, locale::_S_categories): Const qualify.
* config/locale/gnu/c_locale.cc: Same.
* config/locale/generic/time_members.h (__timepunct::__timepunct):
Copy string contents before assigning to _M_name_timepunct,
qualify strcpy and strlen with std::.
* config/locale/gnu/time_members.h: Same.
* config/locale/gnu/messages_members.h (messages::messages):
Copy string contents before assigning to _M_name_messages,
qualify strcpy and strlen with std::.
* config/os/gnu-linux/ctype_noninline.h
(ctype<char>::classic_table()): Don't call locale::classic().
* include/bits/locale_classes.h
(locale::_S_categories): Const qualify.
(locale::_S_once, locale::_S_initialize_once,
locale::facet::_S_once, locale::facet::_S_initialize_once,
locale::facet::_S_get_c_locale): Declare.
(locale::_S_initialize): Don't define.
(locale::facet::_S_c_locale): Make private.
(locale::facet::_S_c_name): Same, const qualify.
(locale::_Impl::_Impl(facet**, size_t, bool)): Drop unused
parameters, add throw() specifier.
* include/bits/locale_facets.h (__timepunct::_M_name_timepunct,
messages::_M_name_messages): Const qualify.
* src/locale.cc
(locale::_S_once, locale::facet::_S_once): Define.
(locale::classic): Move initialization code...
(locale::_S_initialize_once): ...here.
(locale::_S_initialize): Call _S_initialize_once through
__gthread_once.
(locale::facet::_S_initialize_once): Initialize _S_c_locale.
(locale::facet::_S_get_c_locale): Call _S_initialize_once through
__gthread_once before returning _S_c_locale.
* src/localename.cc (locale::_Impl::_Impl(facet**, size_t, bool)):
Drop unused parameters, add throw() specifier, don't initialize
locale::facet::_S_c_locale and _S_c_name.
* config/locale/generic/messages_members.h:
Replace _S_c_locale with _S_get_c_locale().
* config/locale/gnu/c_locale.cc: Same.
* config/locale/gnu/messages_members.h: Same.
* config/locale/gnu/numeric_members.cc: Same.
* config/locale/gnu/time_members.cc: Same.
* config/os/gnu-linux/ctype_noninline.h: Same.
* include/bits/locale_facets.h: Same.
* include/bits/locale_facets.tcc: Same.
* src/codecvt.cc: Same.
* src/ctype.cc: Same.
From-SVN: r72040
2003-10-02 18:56:39 +02:00
|
|
|
static const char* const* const _S_categories;
|
2003-06-27 09:25:38 +02:00
|
|
|
|
2003-01-22 17:51:52 +01:00
|
|
|
// Number of standard categories. For C++, these categories are
|
|
|
|
// collate, ctype, monetary, numeric, time, and messages. These
|
|
|
|
// directly correspond to ISO C99 macros LC_COLLATE, LC_CTYPE,
|
|
|
|
// LC_MONETARY, LC_NUMERIC, and LC_TIME. In addition, POSIX (IEEE
|
|
|
|
// 1003.1-2001) specifies LC_MESSAGES.
|
|
|
|
// In addition to the standard categories, the underlying
|
|
|
|
// operating system is allowed to define extra LC_*
|
|
|
|
// macros. For GNU systems, the following are also valid:
|
|
|
|
// LC_PAPER, LC_NAME, LC_ADDRESS, LC_TELEPHONE, LC_MEASUREMENT,
|
|
|
|
// and LC_IDENTIFICATION.
|
2006-03-06 19:06:47 +01:00
|
|
|
enum { _S_categories_size = 6 + _GLIBCXX_NUM_CATEGORIES };
|
2003-01-22 17:51:52 +01:00
|
|
|
|
[multiple changes]
2003-10-02 Benjamin Kosnik <bkoz@redhat.com>
* config/linker-map.gnu: Export _S_get_c_locale instead of
_S_c_locale object.
2003-10-02 Petur Runolfsson <peturr02@ru.is>
* config/locale/generic/c_locale.cc
(category_names, locale::_S_categories): Const qualify.
* config/locale/gnu/c_locale.cc: Same.
* config/locale/generic/time_members.h (__timepunct::__timepunct):
Copy string contents before assigning to _M_name_timepunct,
qualify strcpy and strlen with std::.
* config/locale/gnu/time_members.h: Same.
* config/locale/gnu/messages_members.h (messages::messages):
Copy string contents before assigning to _M_name_messages,
qualify strcpy and strlen with std::.
* config/os/gnu-linux/ctype_noninline.h
(ctype<char>::classic_table()): Don't call locale::classic().
* include/bits/locale_classes.h
(locale::_S_categories): Const qualify.
(locale::_S_once, locale::_S_initialize_once,
locale::facet::_S_once, locale::facet::_S_initialize_once,
locale::facet::_S_get_c_locale): Declare.
(locale::_S_initialize): Don't define.
(locale::facet::_S_c_locale): Make private.
(locale::facet::_S_c_name): Same, const qualify.
(locale::_Impl::_Impl(facet**, size_t, bool)): Drop unused
parameters, add throw() specifier.
* include/bits/locale_facets.h (__timepunct::_M_name_timepunct,
messages::_M_name_messages): Const qualify.
* src/locale.cc
(locale::_S_once, locale::facet::_S_once): Define.
(locale::classic): Move initialization code...
(locale::_S_initialize_once): ...here.
(locale::_S_initialize): Call _S_initialize_once through
__gthread_once.
(locale::facet::_S_initialize_once): Initialize _S_c_locale.
(locale::facet::_S_get_c_locale): Call _S_initialize_once through
__gthread_once before returning _S_c_locale.
* src/localename.cc (locale::_Impl::_Impl(facet**, size_t, bool)):
Drop unused parameters, add throw() specifier, don't initialize
locale::facet::_S_c_locale and _S_c_name.
* config/locale/generic/messages_members.h:
Replace _S_c_locale with _S_get_c_locale().
* config/locale/gnu/c_locale.cc: Same.
* config/locale/gnu/messages_members.h: Same.
* config/locale/gnu/numeric_members.cc: Same.
* config/locale/gnu/time_members.cc: Same.
* config/os/gnu-linux/ctype_noninline.h: Same.
* include/bits/locale_facets.h: Same.
* include/bits/locale_facets.tcc: Same.
* src/codecvt.cc: Same.
* src/ctype.cc: Same.
From-SVN: r72040
2003-10-02 18:56:39 +02:00
|
|
|
#ifdef __GTHREADS
|
|
|
|
static __gthread_once_t _S_once;
|
|
|
|
#endif
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
explicit
|
2003-01-22 17:51:52 +01:00
|
|
|
locale(_Impl*) throw();
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
static void
|
[multiple changes]
2003-10-02 Benjamin Kosnik <bkoz@redhat.com>
* config/linker-map.gnu: Export _S_get_c_locale instead of
_S_c_locale object.
2003-10-02 Petur Runolfsson <peturr02@ru.is>
* config/locale/generic/c_locale.cc
(category_names, locale::_S_categories): Const qualify.
* config/locale/gnu/c_locale.cc: Same.
* config/locale/generic/time_members.h (__timepunct::__timepunct):
Copy string contents before assigning to _M_name_timepunct,
qualify strcpy and strlen with std::.
* config/locale/gnu/time_members.h: Same.
* config/locale/gnu/messages_members.h (messages::messages):
Copy string contents before assigning to _M_name_messages,
qualify strcpy and strlen with std::.
* config/os/gnu-linux/ctype_noninline.h
(ctype<char>::classic_table()): Don't call locale::classic().
* include/bits/locale_classes.h
(locale::_S_categories): Const qualify.
(locale::_S_once, locale::_S_initialize_once,
locale::facet::_S_once, locale::facet::_S_initialize_once,
locale::facet::_S_get_c_locale): Declare.
(locale::_S_initialize): Don't define.
(locale::facet::_S_c_locale): Make private.
(locale::facet::_S_c_name): Same, const qualify.
(locale::_Impl::_Impl(facet**, size_t, bool)): Drop unused
parameters, add throw() specifier.
* include/bits/locale_facets.h (__timepunct::_M_name_timepunct,
messages::_M_name_messages): Const qualify.
* src/locale.cc
(locale::_S_once, locale::facet::_S_once): Define.
(locale::classic): Move initialization code...
(locale::_S_initialize_once): ...here.
(locale::_S_initialize): Call _S_initialize_once through
__gthread_once.
(locale::facet::_S_initialize_once): Initialize _S_c_locale.
(locale::facet::_S_get_c_locale): Call _S_initialize_once through
__gthread_once before returning _S_c_locale.
* src/localename.cc (locale::_Impl::_Impl(facet**, size_t, bool)):
Drop unused parameters, add throw() specifier, don't initialize
locale::facet::_S_c_locale and _S_c_name.
* config/locale/generic/messages_members.h:
Replace _S_c_locale with _S_get_c_locale().
* config/locale/gnu/c_locale.cc: Same.
* config/locale/gnu/messages_members.h: Same.
* config/locale/gnu/numeric_members.cc: Same.
* config/locale/gnu/time_members.cc: Same.
* config/os/gnu-linux/ctype_noninline.h: Same.
* include/bits/locale_facets.h: Same.
* include/bits/locale_facets.tcc: Same.
* src/codecvt.cc: Same.
* src/ctype.cc: Same.
From-SVN: r72040
2003-10-02 18:56:39 +02:00
|
|
|
_S_initialize();
|
|
|
|
|
|
|
|
static void
|
2010-02-17 06:43:24 +01:00
|
|
|
_S_initialize_once() throw();
|
2003-01-22 17:51:52 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
static category
|
2003-01-22 17:51:52 +01:00
|
|
|
_S_normalize_category(category);
|
|
|
|
|
|
|
|
void
|
|
|
|
_M_coalesce(const locale& __base, const locale& __add, category __cat);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-06-27 09:25:38 +02:00
|
|
|
// 22.1.1.1.2 Class locale::facet
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
|
|
|
* @brief Localization functionality base class.
|
2010-02-10 06:45:24 +01:00
|
|
|
* @ingroup locales
|
2003-12-20 16:51:09 +01:00
|
|
|
*
|
|
|
|
* The facet class is the base class for a localization feature, such as
|
|
|
|
* money, time, and number printing. It provides common support for facets
|
|
|
|
* and reference management.
|
|
|
|
*
|
|
|
|
* Facets may not be copied or assigned.
|
|
|
|
*/
|
2003-06-27 09:25:38 +02:00
|
|
|
class locale::facet
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
friend class locale;
|
|
|
|
friend class locale::_Impl;
|
|
|
|
|
2003-12-15 20:48:50 +01:00
|
|
|
mutable _Atomic_word _M_refcount;
|
2003-06-27 09:25:38 +02:00
|
|
|
|
|
|
|
// Contains data from the underlying "C" library for the classic locale.
|
[multiple changes]
2003-10-02 Benjamin Kosnik <bkoz@redhat.com>
* config/linker-map.gnu: Export _S_get_c_locale instead of
_S_c_locale object.
2003-10-02 Petur Runolfsson <peturr02@ru.is>
* config/locale/generic/c_locale.cc
(category_names, locale::_S_categories): Const qualify.
* config/locale/gnu/c_locale.cc: Same.
* config/locale/generic/time_members.h (__timepunct::__timepunct):
Copy string contents before assigning to _M_name_timepunct,
qualify strcpy and strlen with std::.
* config/locale/gnu/time_members.h: Same.
* config/locale/gnu/messages_members.h (messages::messages):
Copy string contents before assigning to _M_name_messages,
qualify strcpy and strlen with std::.
* config/os/gnu-linux/ctype_noninline.h
(ctype<char>::classic_table()): Don't call locale::classic().
* include/bits/locale_classes.h
(locale::_S_categories): Const qualify.
(locale::_S_once, locale::_S_initialize_once,
locale::facet::_S_once, locale::facet::_S_initialize_once,
locale::facet::_S_get_c_locale): Declare.
(locale::_S_initialize): Don't define.
(locale::facet::_S_c_locale): Make private.
(locale::facet::_S_c_name): Same, const qualify.
(locale::_Impl::_Impl(facet**, size_t, bool)): Drop unused
parameters, add throw() specifier.
* include/bits/locale_facets.h (__timepunct::_M_name_timepunct,
messages::_M_name_messages): Const qualify.
* src/locale.cc
(locale::_S_once, locale::facet::_S_once): Define.
(locale::classic): Move initialization code...
(locale::_S_initialize_once): ...here.
(locale::_S_initialize): Call _S_initialize_once through
__gthread_once.
(locale::facet::_S_initialize_once): Initialize _S_c_locale.
(locale::facet::_S_get_c_locale): Call _S_initialize_once through
__gthread_once before returning _S_c_locale.
* src/localename.cc (locale::_Impl::_Impl(facet**, size_t, bool)):
Drop unused parameters, add throw() specifier, don't initialize
locale::facet::_S_c_locale and _S_c_name.
* config/locale/generic/messages_members.h:
Replace _S_c_locale with _S_get_c_locale().
* config/locale/gnu/c_locale.cc: Same.
* config/locale/gnu/messages_members.h: Same.
* config/locale/gnu/numeric_members.cc: Same.
* config/locale/gnu/time_members.cc: Same.
* config/os/gnu-linux/ctype_noninline.h: Same.
* include/bits/locale_facets.h: Same.
* include/bits/locale_facets.tcc: Same.
* src/codecvt.cc: Same.
* src/ctype.cc: Same.
From-SVN: r72040
2003-10-02 18:56:39 +02:00
|
|
|
static __c_locale _S_c_locale;
|
2003-06-27 09:25:38 +02:00
|
|
|
|
|
|
|
// String literal for the name of the classic locale.
|
[multiple changes]
2003-10-02 Benjamin Kosnik <bkoz@redhat.com>
* config/linker-map.gnu: Export _S_get_c_locale instead of
_S_c_locale object.
2003-10-02 Petur Runolfsson <peturr02@ru.is>
* config/locale/generic/c_locale.cc
(category_names, locale::_S_categories): Const qualify.
* config/locale/gnu/c_locale.cc: Same.
* config/locale/generic/time_members.h (__timepunct::__timepunct):
Copy string contents before assigning to _M_name_timepunct,
qualify strcpy and strlen with std::.
* config/locale/gnu/time_members.h: Same.
* config/locale/gnu/messages_members.h (messages::messages):
Copy string contents before assigning to _M_name_messages,
qualify strcpy and strlen with std::.
* config/os/gnu-linux/ctype_noninline.h
(ctype<char>::classic_table()): Don't call locale::classic().
* include/bits/locale_classes.h
(locale::_S_categories): Const qualify.
(locale::_S_once, locale::_S_initialize_once,
locale::facet::_S_once, locale::facet::_S_initialize_once,
locale::facet::_S_get_c_locale): Declare.
(locale::_S_initialize): Don't define.
(locale::facet::_S_c_locale): Make private.
(locale::facet::_S_c_name): Same, const qualify.
(locale::_Impl::_Impl(facet**, size_t, bool)): Drop unused
parameters, add throw() specifier.
* include/bits/locale_facets.h (__timepunct::_M_name_timepunct,
messages::_M_name_messages): Const qualify.
* src/locale.cc
(locale::_S_once, locale::facet::_S_once): Define.
(locale::classic): Move initialization code...
(locale::_S_initialize_once): ...here.
(locale::_S_initialize): Call _S_initialize_once through
__gthread_once.
(locale::facet::_S_initialize_once): Initialize _S_c_locale.
(locale::facet::_S_get_c_locale): Call _S_initialize_once through
__gthread_once before returning _S_c_locale.
* src/localename.cc (locale::_Impl::_Impl(facet**, size_t, bool)):
Drop unused parameters, add throw() specifier, don't initialize
locale::facet::_S_c_locale and _S_c_name.
* config/locale/generic/messages_members.h:
Replace _S_c_locale with _S_get_c_locale().
* config/locale/gnu/c_locale.cc: Same.
* config/locale/gnu/messages_members.h: Same.
* config/locale/gnu/numeric_members.cc: Same.
* config/locale/gnu/time_members.cc: Same.
* config/os/gnu-linux/ctype_noninline.h: Same.
* include/bits/locale_facets.h: Same.
* include/bits/locale_facets.tcc: Same.
* src/codecvt.cc: Same.
* src/ctype.cc: Same.
From-SVN: r72040
2003-10-02 18:56:39 +02:00
|
|
|
static const char _S_c_name[2];
|
|
|
|
|
|
|
|
#ifdef __GTHREADS
|
2004-02-08 05:46:42 +01:00
|
|
|
static __gthread_once_t _S_once;
|
[multiple changes]
2003-10-02 Benjamin Kosnik <bkoz@redhat.com>
* config/linker-map.gnu: Export _S_get_c_locale instead of
_S_c_locale object.
2003-10-02 Petur Runolfsson <peturr02@ru.is>
* config/locale/generic/c_locale.cc
(category_names, locale::_S_categories): Const qualify.
* config/locale/gnu/c_locale.cc: Same.
* config/locale/generic/time_members.h (__timepunct::__timepunct):
Copy string contents before assigning to _M_name_timepunct,
qualify strcpy and strlen with std::.
* config/locale/gnu/time_members.h: Same.
* config/locale/gnu/messages_members.h (messages::messages):
Copy string contents before assigning to _M_name_messages,
qualify strcpy and strlen with std::.
* config/os/gnu-linux/ctype_noninline.h
(ctype<char>::classic_table()): Don't call locale::classic().
* include/bits/locale_classes.h
(locale::_S_categories): Const qualify.
(locale::_S_once, locale::_S_initialize_once,
locale::facet::_S_once, locale::facet::_S_initialize_once,
locale::facet::_S_get_c_locale): Declare.
(locale::_S_initialize): Don't define.
(locale::facet::_S_c_locale): Make private.
(locale::facet::_S_c_name): Same, const qualify.
(locale::_Impl::_Impl(facet**, size_t, bool)): Drop unused
parameters, add throw() specifier.
* include/bits/locale_facets.h (__timepunct::_M_name_timepunct,
messages::_M_name_messages): Const qualify.
* src/locale.cc
(locale::_S_once, locale::facet::_S_once): Define.
(locale::classic): Move initialization code...
(locale::_S_initialize_once): ...here.
(locale::_S_initialize): Call _S_initialize_once through
__gthread_once.
(locale::facet::_S_initialize_once): Initialize _S_c_locale.
(locale::facet::_S_get_c_locale): Call _S_initialize_once through
__gthread_once before returning _S_c_locale.
* src/localename.cc (locale::_Impl::_Impl(facet**, size_t, bool)):
Drop unused parameters, add throw() specifier, don't initialize
locale::facet::_S_c_locale and _S_c_name.
* config/locale/generic/messages_members.h:
Replace _S_c_locale with _S_get_c_locale().
* config/locale/gnu/c_locale.cc: Same.
* config/locale/gnu/messages_members.h: Same.
* config/locale/gnu/numeric_members.cc: Same.
* config/locale/gnu/time_members.cc: Same.
* config/os/gnu-linux/ctype_noninline.h: Same.
* include/bits/locale_facets.h: Same.
* include/bits/locale_facets.tcc: Same.
* src/codecvt.cc: Same.
* src/ctype.cc: Same.
From-SVN: r72040
2003-10-02 18:56:39 +02:00
|
|
|
#endif
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
static void
|
[multiple changes]
2003-10-02 Benjamin Kosnik <bkoz@redhat.com>
* config/linker-map.gnu: Export _S_get_c_locale instead of
_S_c_locale object.
2003-10-02 Petur Runolfsson <peturr02@ru.is>
* config/locale/generic/c_locale.cc
(category_names, locale::_S_categories): Const qualify.
* config/locale/gnu/c_locale.cc: Same.
* config/locale/generic/time_members.h (__timepunct::__timepunct):
Copy string contents before assigning to _M_name_timepunct,
qualify strcpy and strlen with std::.
* config/locale/gnu/time_members.h: Same.
* config/locale/gnu/messages_members.h (messages::messages):
Copy string contents before assigning to _M_name_messages,
qualify strcpy and strlen with std::.
* config/os/gnu-linux/ctype_noninline.h
(ctype<char>::classic_table()): Don't call locale::classic().
* include/bits/locale_classes.h
(locale::_S_categories): Const qualify.
(locale::_S_once, locale::_S_initialize_once,
locale::facet::_S_once, locale::facet::_S_initialize_once,
locale::facet::_S_get_c_locale): Declare.
(locale::_S_initialize): Don't define.
(locale::facet::_S_c_locale): Make private.
(locale::facet::_S_c_name): Same, const qualify.
(locale::_Impl::_Impl(facet**, size_t, bool)): Drop unused
parameters, add throw() specifier.
* include/bits/locale_facets.h (__timepunct::_M_name_timepunct,
messages::_M_name_messages): Const qualify.
* src/locale.cc
(locale::_S_once, locale::facet::_S_once): Define.
(locale::classic): Move initialization code...
(locale::_S_initialize_once): ...here.
(locale::_S_initialize): Call _S_initialize_once through
__gthread_once.
(locale::facet::_S_initialize_once): Initialize _S_c_locale.
(locale::facet::_S_get_c_locale): Call _S_initialize_once through
__gthread_once before returning _S_c_locale.
* src/localename.cc (locale::_Impl::_Impl(facet**, size_t, bool)):
Drop unused parameters, add throw() specifier, don't initialize
locale::facet::_S_c_locale and _S_c_name.
* config/locale/generic/messages_members.h:
Replace _S_c_locale with _S_get_c_locale().
* config/locale/gnu/c_locale.cc: Same.
* config/locale/gnu/messages_members.h: Same.
* config/locale/gnu/numeric_members.cc: Same.
* config/locale/gnu/time_members.cc: Same.
* config/os/gnu-linux/ctype_noninline.h: Same.
* include/bits/locale_facets.h: Same.
* include/bits/locale_facets.tcc: Same.
* src/codecvt.cc: Same.
* src/ctype.cc: Same.
From-SVN: r72040
2003-10-02 18:56:39 +02:00
|
|
|
_S_initialize_once();
|
|
|
|
|
|
|
|
protected:
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
|
|
|
* @brief Facet constructor.
|
|
|
|
*
|
|
|
|
* This is the constructor provided by the standard. If refs is 0, the
|
|
|
|
* facet is destroyed when the last referencing locale is destroyed.
|
|
|
|
* Otherwise the facet will never be destroyed.
|
|
|
|
*
|
|
|
|
* @param refs The initial value for reference count.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
explicit
|
2003-12-15 20:48:50 +01:00
|
|
|
facet(size_t __refs = 0) throw() : _M_refcount(__refs ? 1 : 0)
|
2003-06-27 09:25:38 +02:00
|
|
|
{ }
|
|
|
|
|
2003-12-20 16:51:09 +01:00
|
|
|
/// Facet destructor.
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual
|
2003-06-27 09:25:38 +02:00
|
|
|
~facet();
|
|
|
|
|
|
|
|
static void
|
2004-02-08 05:46:42 +01:00
|
|
|
_S_create_c_locale(__c_locale& __cloc, const char* __s,
|
2003-06-27 09:25:38 +02:00
|
|
|
__c_locale __old = 0);
|
|
|
|
|
|
|
|
static __c_locale
|
2010-02-17 06:43:24 +01:00
|
|
|
_S_clone_c_locale(__c_locale& __cloc) throw();
|
2003-06-27 09:25:38 +02:00
|
|
|
|
|
|
|
static void
|
|
|
|
_S_destroy_c_locale(__c_locale& __cloc);
|
|
|
|
|
2009-05-19 20:20:47 +02:00
|
|
|
static __c_locale
|
|
|
|
_S_lc_ctype_c_locale(__c_locale __cloc, const char* __s);
|
|
|
|
|
2003-10-03 01:06:13 +02:00
|
|
|
// Returns data from the underlying "C" library data for the
|
|
|
|
// classic locale.
|
[multiple changes]
2003-10-02 Benjamin Kosnik <bkoz@redhat.com>
* config/linker-map.gnu: Export _S_get_c_locale instead of
_S_c_locale object.
2003-10-02 Petur Runolfsson <peturr02@ru.is>
* config/locale/generic/c_locale.cc
(category_names, locale::_S_categories): Const qualify.
* config/locale/gnu/c_locale.cc: Same.
* config/locale/generic/time_members.h (__timepunct::__timepunct):
Copy string contents before assigning to _M_name_timepunct,
qualify strcpy and strlen with std::.
* config/locale/gnu/time_members.h: Same.
* config/locale/gnu/messages_members.h (messages::messages):
Copy string contents before assigning to _M_name_messages,
qualify strcpy and strlen with std::.
* config/os/gnu-linux/ctype_noninline.h
(ctype<char>::classic_table()): Don't call locale::classic().
* include/bits/locale_classes.h
(locale::_S_categories): Const qualify.
(locale::_S_once, locale::_S_initialize_once,
locale::facet::_S_once, locale::facet::_S_initialize_once,
locale::facet::_S_get_c_locale): Declare.
(locale::_S_initialize): Don't define.
(locale::facet::_S_c_locale): Make private.
(locale::facet::_S_c_name): Same, const qualify.
(locale::_Impl::_Impl(facet**, size_t, bool)): Drop unused
parameters, add throw() specifier.
* include/bits/locale_facets.h (__timepunct::_M_name_timepunct,
messages::_M_name_messages): Const qualify.
* src/locale.cc
(locale::_S_once, locale::facet::_S_once): Define.
(locale::classic): Move initialization code...
(locale::_S_initialize_once): ...here.
(locale::_S_initialize): Call _S_initialize_once through
__gthread_once.
(locale::facet::_S_initialize_once): Initialize _S_c_locale.
(locale::facet::_S_get_c_locale): Call _S_initialize_once through
__gthread_once before returning _S_c_locale.
* src/localename.cc (locale::_Impl::_Impl(facet**, size_t, bool)):
Drop unused parameters, add throw() specifier, don't initialize
locale::facet::_S_c_locale and _S_c_name.
* config/locale/generic/messages_members.h:
Replace _S_c_locale with _S_get_c_locale().
* config/locale/gnu/c_locale.cc: Same.
* config/locale/gnu/messages_members.h: Same.
* config/locale/gnu/numeric_members.cc: Same.
* config/locale/gnu/time_members.cc: Same.
* config/os/gnu-linux/ctype_noninline.h: Same.
* include/bits/locale_facets.h: Same.
* include/bits/locale_facets.tcc: Same.
* src/codecvt.cc: Same.
* src/ctype.cc: Same.
From-SVN: r72040
2003-10-02 18:56:39 +02:00
|
|
|
static __c_locale
|
|
|
|
_S_get_c_locale();
|
|
|
|
|
condition_variable.cc (condition_variable, [...]): Mark throw()
* src/condition_variable.cc (condition_variable,
condition_variable_any constructors): Mark throw()
* src/hash.cc (operator() for long double, string, and wstring): Mark
throw ().
* src/strstream.cc (strstreambuf constructors, freeze, str, pcount,
_M_setup, rdbuf, str): Mark throw ().
* src/chrono.cc (new): Mark throw ().
* include/std/system_error (system_category, generic_category): Mark
throw () and const.
* include/std/chrono (now): Mark throw ().
* include/std/condition_variable (condition_variable,
~condition_variable, condition_variable_any,
~condition_variable_any): Mark throw ().
* include/std/mutex (mutex): Mark throw ().
* include/bits/stl_list.h (swap, transfer, reverse, hook, unhook): Mark
throw.
* include/bits/functional_hash.h (operator() on size_t): Mark pure and throw ().
* include/bits/locale_facets.tcc (__verify_grouping): Mark pure.
* include/bits/locale_classes.h (_S_initialize_once,
_S_clone_c_locale): Mark throw ().
(_S_get_c_name): Mark const and throw ().
(_M_id, _M_compare, _M_transform, _M_compare, _M_transform): Mark throw ().
* include/bits/locale_facets.h (__convert_to_v explicit instances):
Mark throw ().
(_M_convert_to_wmask, _M_initialize_ctype, _S_format_float): Mark throw ().
* include/bits/ios_base.h (_M_dispose_callbacks, _M_init, imbue,
ios_base): Mark throw ()
* include/bits/locale_facets_nonio.h (_M_put): Mark throw.
* include/backward/strstream (strstreambuf constructors): Mark throw ().
(str, freeze, _M_setupf): Mark throw ().
(pcount): Mark pure and throw ().
(rdbuf): Mark const and throw ().
From-SVN: r146328
2009-04-18 23:19:18 +02:00
|
|
|
_GLIBCXX_CONST static const char*
|
2010-02-17 06:43:24 +01:00
|
|
|
_S_get_c_name() throw();
|
2003-10-03 01:06:13 +02:00
|
|
|
|
2003-06-27 09:25:38 +02:00
|
|
|
private:
|
2007-04-25 11:25:05 +02:00
|
|
|
void
|
2003-06-27 09:25:38 +02:00
|
|
|
_M_add_reference() const throw()
|
2006-05-24 18:37:42 +02:00
|
|
|
{ __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); }
|
2003-06-27 09:25:38 +02:00
|
|
|
|
2007-04-25 11:25:05 +02:00
|
|
|
void
|
2003-06-27 09:25:38 +02:00
|
|
|
_M_remove_reference() const throw()
|
|
|
|
{
|
2010-08-13 00:56:59 +02:00
|
|
|
// Be race-detector-friendly. For more info see bits/c++config.
|
2010-08-13 13:48:34 +02:00
|
|
|
_GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_refcount);
|
2006-05-24 18:37:42 +02:00
|
|
|
if (__gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1) == 1)
|
2003-06-27 09:25:38 +02:00
|
|
|
{
|
2010-08-13 13:48:34 +02:00
|
|
|
_GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_refcount);
|
2009-02-04 00:44:53 +01:00
|
|
|
__try
|
2004-02-08 05:46:42 +01:00
|
|
|
{ delete this; }
|
2009-02-04 00:44:53 +01:00
|
|
|
__catch(...)
|
2003-06-27 09:25:38 +02:00
|
|
|
{ }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
facet(const facet&); // Not defined.
|
|
|
|
|
2004-05-23 01:46:34 +02:00
|
|
|
facet&
|
2003-06-27 09:25:38 +02:00
|
|
|
operator=(const facet&); // Not defined.
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 22.1.1.1.3 Class locale::id
|
2003-12-20 16:51:09 +01:00
|
|
|
/**
|
|
|
|
* @brief Facet ID class.
|
2010-02-10 06:45:24 +01:00
|
|
|
* @ingroup locales
|
2003-12-20 16:51:09 +01:00
|
|
|
*
|
|
|
|
* The ID class provides facets with an index used to identify them.
|
|
|
|
* Every facet class must define a public static member locale::id, or be
|
|
|
|
* derived from a facet that provides this member, otherwise the facet
|
|
|
|
* cannot be used in a locale. The locale::id ensures that each class
|
|
|
|
* type gets a unique identifier.
|
|
|
|
*/
|
2003-06-27 09:25:38 +02:00
|
|
|
class locale::id
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
friend class locale;
|
|
|
|
friend class locale::_Impl;
|
|
|
|
|
|
|
|
template<typename _Facet>
|
2004-02-08 05:46:42 +01:00
|
|
|
friend const _Facet&
|
2003-06-27 09:25:38 +02:00
|
|
|
use_facet(const locale&);
|
|
|
|
|
|
|
|
template<typename _Facet>
|
2004-02-08 05:46:42 +01:00
|
|
|
friend bool
|
2010-02-17 06:43:24 +01:00
|
|
|
has_facet(const locale&) throw();
|
2003-06-27 09:25:38 +02:00
|
|
|
|
|
|
|
// NB: There is no accessor for _M_index because it may be used
|
|
|
|
// before the constructor is run; the effect of calling a member
|
|
|
|
// function (even an inline) would be undefined.
|
2004-02-08 05:46:42 +01:00
|
|
|
mutable size_t _M_index;
|
2003-06-27 09:25:38 +02:00
|
|
|
|
|
|
|
// Last id number assigned.
|
2004-02-08 05:46:42 +01:00
|
|
|
static _Atomic_word _S_refcount;
|
2003-06-27 09:25:38 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
void
|
2003-06-27 09:25:38 +02:00
|
|
|
operator=(const id&); // Not defined.
|
|
|
|
|
|
|
|
id(const id&); // Not defined.
|
|
|
|
|
|
|
|
public:
|
|
|
|
// NB: This class is always a static data member, and thus can be
|
|
|
|
// counted on to be zero-initialized.
|
2003-12-20 16:51:09 +01:00
|
|
|
/// Constructor.
|
2003-06-27 09:25:38 +02:00
|
|
|
id() { }
|
|
|
|
|
2003-10-09 23:17:11 +02:00
|
|
|
size_t
|
2010-02-17 06:43:24 +01:00
|
|
|
_M_id() const throw();
|
2003-06-27 09:25:38 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Implementation object for locale.
|
2003-01-22 17:51:52 +01:00
|
|
|
class locale::_Impl
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Friends.
|
|
|
|
friend class locale;
|
|
|
|
friend class locale::facet;
|
|
|
|
|
2003-06-27 09:25:38 +02:00
|
|
|
template<typename _Facet>
|
2004-02-08 05:46:42 +01:00
|
|
|
friend bool
|
2003-06-27 09:25:38 +02:00
|
|
|
has_facet(const locale&) throw();
|
|
|
|
|
2003-01-22 17:51:52 +01:00
|
|
|
template<typename _Facet>
|
2004-02-08 05:46:42 +01:00
|
|
|
friend const _Facet&
|
2003-01-22 17:51:52 +01:00
|
|
|
use_facet(const locale&);
|
|
|
|
|
2003-06-27 09:25:38 +02:00
|
|
|
template<typename _Cache>
|
2003-07-10 08:21:13 +02:00
|
|
|
friend struct __use_cache;
|
2003-01-22 17:51:52 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
// Data Members.
|
2003-12-15 20:48:50 +01:00
|
|
|
_Atomic_word _M_refcount;
|
2003-02-01 17:37:20 +01:00
|
|
|
const facet** _M_facets;
|
2004-02-08 05:46:42 +01:00
|
|
|
size_t _M_facets_size;
|
2003-06-27 09:25:38 +02:00
|
|
|
const facet** _M_caches;
|
2004-02-08 05:46:42 +01:00
|
|
|
char** _M_names;
|
|
|
|
static const locale::id* const _S_id_ctype[];
|
|
|
|
static const locale::id* const _S_id_numeric[];
|
|
|
|
static const locale::id* const _S_id_collate[];
|
|
|
|
static const locale::id* const _S_id_time[];
|
|
|
|
static const locale::id* const _S_id_monetary[];
|
|
|
|
static const locale::id* const _S_id_messages[];
|
2003-01-22 17:51:52 +01:00
|
|
|
static const locale::id* const* const _S_facet_categories[];
|
|
|
|
|
2007-04-25 11:25:05 +02:00
|
|
|
void
|
2003-01-22 17:51:52 +01:00
|
|
|
_M_add_reference() throw()
|
2006-05-24 18:37:42 +02:00
|
|
|
{ __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); }
|
2003-01-22 17:51:52 +01:00
|
|
|
|
2007-04-25 11:25:05 +02:00
|
|
|
void
|
2003-01-22 17:51:52 +01:00
|
|
|
_M_remove_reference() throw()
|
|
|
|
{
|
2010-08-13 00:56:59 +02:00
|
|
|
// Be race-detector-friendly. For more info see bits/c++config.
|
2010-08-13 13:48:34 +02:00
|
|
|
_GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_refcount);
|
2006-05-24 18:37:42 +02:00
|
|
|
if (__gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1) == 1)
|
2003-01-22 17:51:52 +01:00
|
|
|
{
|
2010-08-13 13:48:34 +02:00
|
|
|
_GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_refcount);
|
2009-02-04 00:44:53 +01:00
|
|
|
__try
|
2004-02-08 05:46:42 +01:00
|
|
|
{ delete this; }
|
2009-02-04 00:44:53 +01:00
|
|
|
__catch(...)
|
2003-01-22 17:51:52 +01:00
|
|
|
{ }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_Impl(const _Impl&, size_t);
|
|
|
|
_Impl(const char*, size_t);
|
[multiple changes]
2003-10-02 Benjamin Kosnik <bkoz@redhat.com>
* config/linker-map.gnu: Export _S_get_c_locale instead of
_S_c_locale object.
2003-10-02 Petur Runolfsson <peturr02@ru.is>
* config/locale/generic/c_locale.cc
(category_names, locale::_S_categories): Const qualify.
* config/locale/gnu/c_locale.cc: Same.
* config/locale/generic/time_members.h (__timepunct::__timepunct):
Copy string contents before assigning to _M_name_timepunct,
qualify strcpy and strlen with std::.
* config/locale/gnu/time_members.h: Same.
* config/locale/gnu/messages_members.h (messages::messages):
Copy string contents before assigning to _M_name_messages,
qualify strcpy and strlen with std::.
* config/os/gnu-linux/ctype_noninline.h
(ctype<char>::classic_table()): Don't call locale::classic().
* include/bits/locale_classes.h
(locale::_S_categories): Const qualify.
(locale::_S_once, locale::_S_initialize_once,
locale::facet::_S_once, locale::facet::_S_initialize_once,
locale::facet::_S_get_c_locale): Declare.
(locale::_S_initialize): Don't define.
(locale::facet::_S_c_locale): Make private.
(locale::facet::_S_c_name): Same, const qualify.
(locale::_Impl::_Impl(facet**, size_t, bool)): Drop unused
parameters, add throw() specifier.
* include/bits/locale_facets.h (__timepunct::_M_name_timepunct,
messages::_M_name_messages): Const qualify.
* src/locale.cc
(locale::_S_once, locale::facet::_S_once): Define.
(locale::classic): Move initialization code...
(locale::_S_initialize_once): ...here.
(locale::_S_initialize): Call _S_initialize_once through
__gthread_once.
(locale::facet::_S_initialize_once): Initialize _S_c_locale.
(locale::facet::_S_get_c_locale): Call _S_initialize_once through
__gthread_once before returning _S_c_locale.
* src/localename.cc (locale::_Impl::_Impl(facet**, size_t, bool)):
Drop unused parameters, add throw() specifier, don't initialize
locale::facet::_S_c_locale and _S_c_name.
* config/locale/generic/messages_members.h:
Replace _S_c_locale with _S_get_c_locale().
* config/locale/gnu/c_locale.cc: Same.
* config/locale/gnu/messages_members.h: Same.
* config/locale/gnu/numeric_members.cc: Same.
* config/locale/gnu/time_members.cc: Same.
* config/os/gnu-linux/ctype_noninline.h: Same.
* include/bits/locale_facets.h: Same.
* include/bits/locale_facets.tcc: Same.
* src/codecvt.cc: Same.
* src/ctype.cc: Same.
From-SVN: r72040
2003-10-02 18:56:39 +02:00
|
|
|
_Impl(size_t) throw();
|
2003-01-22 17:51:52 +01:00
|
|
|
|
|
|
|
~_Impl() throw();
|
|
|
|
|
|
|
|
_Impl(const _Impl&); // Not defined.
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
void
|
2003-01-22 17:51:52 +01:00
|
|
|
operator=(const _Impl&); // Not defined.
|
|
|
|
|
2007-04-25 11:25:05 +02:00
|
|
|
bool
|
2003-01-22 17:51:52 +01:00
|
|
|
_M_check_same_name()
|
|
|
|
{
|
|
|
|
bool __ret = true;
|
Optimize locale::_M_impl->_M_names for the most common cases...
2004-05-03 Paolo Carlini <pcarlini@suse.de>
Optimize locale::_M_impl->_M_names for the most common cases:
!_M_names[0] means unnamed; !_M_names[1] means all the categories
the same name (_M_names[0] && _M_names[1] means that the full set
of _M_names must be processed, the general case).
* include/bits/locale_classes.h (locale::_Impl::_M_check_same_name):
Tweak, saving work when !_M_names[1].
(locale::locale(const locale&, _Facet*): Simplify: now just setting
_M_names[0] = 0 means unnamed.
* src/locale.cc (locale::operator==): Deal first with the common,
easy cases, otherwise fall back to locale::name().
(locale::name()): Tweak, if !_M_names[0] just return "*".
(locale::_Impl::_Impl(const _Impl&, size_t): Tweak, early stop
copying __imp._M_names if !__imp._M_names[0] or !__imp._M_names[1].
* src/locale_init.cc (locale::_Impl::_Impl(size_t)): Tweak.
* src/localename.cc (locale::_Impl::_Impl(const char*, size_t):
Simplify when !std::strchr, just updating _M_names[0]; clean up.
(locale::_Impl::_M_replace_categories): When !_M_names[1] prepare
for the general case (full set of names), then do the usual work;
clean up.
* src/locale.cc (locale::name()): Reserve space in __ret.
* src/locale_init.cc (locale::global(const locale&)): Save
the name in a temporary.
* src/localename.cc (locale::locale(const char*)): Reserve space
in __str.
From-SVN: r81430
2004-05-03 14:14:07 +02:00
|
|
|
if (_M_names[1])
|
|
|
|
// We must actually compare all the _M_names: can be all equal!
|
|
|
|
for (size_t __i = 0; __ret && __i < _S_categories_size - 1; ++__i)
|
2007-05-11 20:58:08 +02:00
|
|
|
__ret = __builtin_strcmp(_M_names[__i], _M_names[__i + 1]) == 0;
|
2003-01-22 17:51:52 +01:00
|
|
|
return __ret;
|
|
|
|
}
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
void
|
2003-01-22 17:51:52 +01:00
|
|
|
_M_replace_categories(const _Impl*, category);
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
void
|
2003-01-22 17:51:52 +01:00
|
|
|
_M_replace_category(const _Impl*, const locale::id* const*);
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
void
|
2003-01-22 17:51:52 +01:00
|
|
|
_M_replace_facet(const _Impl*, const locale::id*);
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
void
|
2003-02-01 17:37:20 +01:00
|
|
|
_M_install_facet(const locale::id*, const facet*);
|
2003-01-22 17:51:52 +01:00
|
|
|
|
|
|
|
template<typename _Facet>
|
2007-04-25 11:25:05 +02:00
|
|
|
void
|
2003-01-22 17:51:52 +01:00
|
|
|
_M_init_facet(_Facet* __facet)
|
2003-06-27 09:25:38 +02:00
|
|
|
{ _M_install_facet(&_Facet::id, __facet); }
|
|
|
|
|
|
|
|
void
|
2005-10-11 08:19:13 +02:00
|
|
|
_M_install_cache(const facet*, size_t);
|
2003-01-22 17:51:52 +01:00
|
|
|
};
|
|
|
|
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Test for the presence of a facet.
|
|
|
|
*
|
|
|
|
* has_facet tests the locale argument for the presence of the facet type
|
|
|
|
* provided as the template parameter. Facets derived from the facet
|
|
|
|
* parameter will also return true.
|
|
|
|
*
|
|
|
|
* @param Facet The facet type to test the presence of.
|
|
|
|
* @param locale The locale to test.
|
|
|
|
* @return true if locale contains a facet of type Facet, else false.
|
|
|
|
*/
|
2003-01-22 17:51:52 +01:00
|
|
|
template<typename _Facet>
|
2008-01-07 12:11:02 +01:00
|
|
|
bool
|
|
|
|
has_facet(const locale& __loc) throw();
|
re PR libstdc++/12352 (Exception safety problems in src/localename.cc)
2003-09-25 Paolo Carlini <pcarlini@unitus.it>
PR libstdc++/12352
* src/localename.cc (locale::_Impl::_Impl(const _Impl&,
size_t)): Don't leak if memory allocations for _M_facets,
_M_caches, and _M_names fail.
(locale::_Impl::_Impl(const char*, size_t)): Ditto.
(locale::_Impl::_M_replace_categories(const _Impl*,
category)): Ditto.
(locale::_Impl::_M_install_facet(const locale::id*,
const facet*)): Ditto.
* include/bits/locale_classes.h (locale::locale(const locale&,
_Facet*)): Don't leak memory.
* testsuite/22_locale/locale/cons/12352.cc: New, from the PR.
* src/localename.cc (locale::_Impl::_Impl(facet**, size_t,
bool)): Qualify with std:: strcpy, tweak.
* include/bits/locale_classes.h
(locale::_Impl::_M_check_same_name): Qualify strcmp.
From-SVN: r71808
2003-09-26 02:22:01 +02:00
|
|
|
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
/**
|
|
|
|
* @brief Return a facet.
|
|
|
|
*
|
|
|
|
* use_facet looks for and returns a reference to a facet of type Facet
|
|
|
|
* where Facet is the template parameter. If has_facet(locale) is true,
|
|
|
|
* there is a suitable facet to return. It throws std::bad_cast if the
|
|
|
|
* locale doesn't contain a facet of type Facet.
|
|
|
|
*
|
|
|
|
* @param Facet The facet type to access.
|
|
|
|
* @param locale The locale to use.
|
|
|
|
* @return Reference to facet of type Facet.
|
|
|
|
* @throw std::bad_cast if locale doesn't contain a facet of type Facet.
|
|
|
|
*/
|
|
|
|
template<typename _Facet>
|
2008-01-07 12:11:02 +01:00
|
|
|
const _Facet&
|
|
|
|
use_facet(const locale& __loc);
|
2005-12-19 01:56:05 +01:00
|
|
|
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Facet for localized string comparison.
|
|
|
|
*
|
|
|
|
* This facet encapsulates the code to compare strings in a localized
|
|
|
|
* manner.
|
|
|
|
*
|
|
|
|
* The collate template uses protected virtual functions to provide
|
|
|
|
* the actual results. The public accessors forward the call to
|
|
|
|
* the virtual functions. These virtual functions are hooks for
|
|
|
|
* developers to implement the behavior they require from the
|
|
|
|
* collate facet.
|
|
|
|
*/
|
|
|
|
template<typename _CharT>
|
|
|
|
class collate : public locale::facet
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Types:
|
|
|
|
//@{
|
|
|
|
/// Public typedefs
|
|
|
|
typedef _CharT char_type;
|
|
|
|
typedef basic_string<_CharT> string_type;
|
|
|
|
//@}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// Underlying "C" library locale information saved from
|
|
|
|
// initialization, needed by collate_byname as well.
|
|
|
|
__c_locale _M_c_locale_collate;
|
|
|
|
|
|
|
|
public:
|
|
|
|
/// Numpunct facet id.
|
|
|
|
static locale::id id;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Constructor performs initialization.
|
|
|
|
*
|
|
|
|
* This is the constructor provided by the standard.
|
|
|
|
*
|
|
|
|
* @param refs Passed to the base facet class.
|
|
|
|
*/
|
|
|
|
explicit
|
|
|
|
collate(size_t __refs = 0)
|
|
|
|
: facet(__refs), _M_c_locale_collate(_S_get_c_locale())
|
|
|
|
{ }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Internal constructor. Not for general use.
|
|
|
|
*
|
|
|
|
* This is a constructor for use by the library itself to set up new
|
|
|
|
* locales.
|
|
|
|
*
|
2010-02-04 19:20:34 +01:00
|
|
|
* @param cloc The C locale.
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
* @param refs Passed to the base facet class.
|
|
|
|
*/
|
|
|
|
explicit
|
|
|
|
collate(__c_locale __cloc, size_t __refs = 0)
|
|
|
|
: facet(__refs), _M_c_locale_collate(_S_clone_c_locale(__cloc))
|
|
|
|
{ }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Compare two strings.
|
|
|
|
*
|
|
|
|
* This function compares two strings and returns the result by calling
|
|
|
|
* collate::do_compare().
|
|
|
|
*
|
|
|
|
* @param lo1 Start of string 1.
|
|
|
|
* @param hi1 End of string 1.
|
|
|
|
* @param lo2 Start of string 2.
|
|
|
|
* @param hi2 End of string 2.
|
|
|
|
* @return 1 if string1 > string2, -1 if string1 < string2, else 0.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
compare(const _CharT* __lo1, const _CharT* __hi1,
|
|
|
|
const _CharT* __lo2, const _CharT* __hi2) const
|
|
|
|
{ return this->do_compare(__lo1, __hi1, __lo2, __hi2); }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Transform string to comparable form.
|
|
|
|
*
|
|
|
|
* This function is a wrapper for strxfrm functionality. It takes the
|
|
|
|
* input string and returns a modified string that can be directly
|
2010-02-04 19:20:34 +01:00
|
|
|
* compared to other transformed strings. In the C locale, this
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
* function just returns a copy of the input string. In some other
|
|
|
|
* locales, it may replace two chars with one, change a char for
|
|
|
|
* another, etc. It does so by returning collate::do_transform().
|
|
|
|
*
|
|
|
|
* @param lo Start of string.
|
|
|
|
* @param hi End of string.
|
|
|
|
* @return Transformed string_type.
|
|
|
|
*/
|
|
|
|
string_type
|
|
|
|
transform(const _CharT* __lo, const _CharT* __hi) const
|
|
|
|
{ return this->do_transform(__lo, __hi); }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Return hash of a string.
|
|
|
|
*
|
|
|
|
* This function computes and returns a hash on the input string. It
|
|
|
|
* does so by returning collate::do_hash().
|
|
|
|
*
|
|
|
|
* @param lo Start of string.
|
|
|
|
* @param hi End of string.
|
|
|
|
* @return Hash value.
|
|
|
|
*/
|
|
|
|
long
|
|
|
|
hash(const _CharT* __lo, const _CharT* __hi) const
|
|
|
|
{ return this->do_hash(__lo, __hi); }
|
|
|
|
|
|
|
|
// Used to abstract out _CharT bits in virtual member functions, below.
|
|
|
|
int
|
2010-02-17 06:43:24 +01:00
|
|
|
_M_compare(const _CharT*, const _CharT*) const throw();
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
|
|
|
|
size_t
|
2010-02-17 06:43:24 +01:00
|
|
|
_M_transform(_CharT*, const _CharT*, size_t) const throw();
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
/// Destructor.
|
|
|
|
virtual
|
|
|
|
~collate()
|
|
|
|
{ _S_destroy_c_locale(_M_c_locale_collate); }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Compare two strings.
|
|
|
|
*
|
|
|
|
* This function is a hook for derived classes to change the value
|
|
|
|
* returned. @see compare().
|
|
|
|
*
|
|
|
|
* @param lo1 Start of string 1.
|
|
|
|
* @param hi1 End of string 1.
|
|
|
|
* @param lo2 Start of string 2.
|
|
|
|
* @param hi2 End of string 2.
|
|
|
|
* @return 1 if string1 > string2, -1 if string1 < string2, else 0.
|
|
|
|
*/
|
|
|
|
virtual int
|
|
|
|
do_compare(const _CharT* __lo1, const _CharT* __hi1,
|
|
|
|
const _CharT* __lo2, const _CharT* __hi2) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Transform string to comparable form.
|
|
|
|
*
|
|
|
|
* This function is a hook for derived classes to change the value
|
|
|
|
* returned.
|
|
|
|
*
|
|
|
|
* @param lo1 Start of string 1.
|
|
|
|
* @param hi1 End of string 1.
|
|
|
|
* @param lo2 Start of string 2.
|
|
|
|
* @param hi2 End of string 2.
|
|
|
|
* @return 1 if string1 > string2, -1 if string1 < string2, else 0.
|
|
|
|
*/
|
|
|
|
virtual string_type
|
|
|
|
do_transform(const _CharT* __lo, const _CharT* __hi) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Return hash of a string.
|
|
|
|
*
|
|
|
|
* This function computes and returns a hash on the input string. This
|
|
|
|
* function is a hook for derived classes to change the value returned.
|
|
|
|
*
|
|
|
|
* @param lo Start of string.
|
|
|
|
* @param hi End of string.
|
|
|
|
* @return Hash value.
|
|
|
|
*/
|
|
|
|
virtual long
|
|
|
|
do_hash(const _CharT* __lo, const _CharT* __hi) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
template<typename _CharT>
|
|
|
|
locale::id collate<_CharT>::id;
|
|
|
|
|
|
|
|
// Specializations.
|
|
|
|
template<>
|
|
|
|
int
|
2010-02-17 06:43:24 +01:00
|
|
|
collate<char>::_M_compare(const char*, const char*) const throw();
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
|
|
|
|
template<>
|
|
|
|
size_t
|
2010-02-17 06:43:24 +01:00
|
|
|
collate<char>::_M_transform(char*, const char*, size_t) const throw();
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
|
|
|
|
#ifdef _GLIBCXX_USE_WCHAR_T
|
|
|
|
template<>
|
|
|
|
int
|
2010-02-17 06:43:24 +01:00
|
|
|
collate<wchar_t>::_M_compare(const wchar_t*, const wchar_t*) const throw();
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
|
|
|
|
template<>
|
|
|
|
size_t
|
2010-02-17 06:43:24 +01:00
|
|
|
collate<wchar_t>::_M_transform(wchar_t*, const wchar_t*, size_t) const throw();
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
#endif
|
|
|
|
|
2008-03-26 07:27:35 +01:00
|
|
|
/// class collate_byname [22.2.4.2].
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
template<typename _CharT>
|
|
|
|
class collate_byname : public collate<_CharT>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
//@{
|
|
|
|
/// Public typedefs
|
|
|
|
typedef _CharT char_type;
|
|
|
|
typedef basic_string<_CharT> string_type;
|
|
|
|
//@}
|
|
|
|
|
|
|
|
explicit
|
|
|
|
collate_byname(const char* __s, size_t __refs = 0)
|
|
|
|
: collate<_CharT>(__refs)
|
|
|
|
{
|
2007-05-11 20:58:08 +02:00
|
|
|
if (__builtin_strcmp(__s, "C") != 0
|
|
|
|
&& __builtin_strcmp(__s, "POSIX") != 0)
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
{
|
|
|
|
this->_S_destroy_c_locale(this->_M_c_locale_collate);
|
|
|
|
this->_S_create_c_locale(this->_M_c_locale_collate, __s);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual
|
|
|
|
~collate_byname() { }
|
|
|
|
};
|
|
|
|
|
PR libstdc++/36104 part four
2011-01-30 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/36104 part four
* include/bits/c++config (_GLIBCXX_STD): Remove.
(_GLIBCXX_STD_D, _GLIBCXX_PR): Now _GLIBCXX_STD_C.
(_GLIBCXX_P): Now _GLIBCXX_STD_A.
(_GLIBCXX_NAMESPACE_DEBUG, _GLIBCXX_NAMESPACE_PARALLEL,
_GLIBCXX_NAMESPACE_PROFILE, _GLIBCXX_NAMESPACE_VERSION): Remove.
(_GLIBCXX_INLINE_DEBUG, _GLIBCXX_INLINE_PARALLEL,
_GLIBCXX_INLINE_PROFILE): Remove.
(_GLIBCXX_BEGIN_NAMESPACE(X)): Remove.
(_GLIBCXX_END_NAMESPACE): Remove.
(_GLIBCXX_BEGIN_NESTED_NAMESPACE(X, Y)): Remove.
(_GLIBCXX_END_NESTED_NAMESPACE): Remove.
(_GLIBCXX_BEGIN_NAMESPACE_ALGO): Add.
(_GLIBCXX_END_NAMESPACE_ALGO): Add.
(_GLIBCXX_BEGIN_NAMESPACE_CONTAINER): Add.
(_GLIBCXX_END_NAMESPACE_CONTAINER): Add.
(_GLIBCXX_BEGIN_NAMESPACE_VERSION): Add.
(_GLIBCXX_END_NAMESPACE_VERSION): Add.
(_GLIBCXX_BEGIN_LDBL_NAMESPACE): To _GLIBCXX_BEGIN_NAMESPACE_LDBL.
(_GLIBCXX_END_LDBL_NAMESPACE): To _GLIBCXX_END_NAMESPACE_LDBL.
(_GLIBCXX_VISIBILITY_ATTR): Revert to _GLIBCXX_VISIBILITY.
* include/*: Use new macros for namespace scope.
* config/*: Same.
* src/*: Same.
* src/Makefile.am (sources): Remove debug_list.cc, add
compatibility-debug_list-2.cc.
(parallel_sources): Remove parallel_list.cc, add
compatibility-parallel_list-2.cc.
(compatibility-parallel_list-2.[o,lo]): New rule.
* src/Makefile.in: Regenerate.
* src/debug_list.cc: Remove.
* src/parallel_list.cc: Remove.
* src/compatibility-list-2.cc: New.
* src/compatibility-debug_list-2.cc: New.
* src/compatibility-parallel_list-2.cc: New.
* doc/doxygen/user.cfg.in: Adjust macros.
* testsuite/20_util/auto_ptr/assign_neg.cc: Adjust line numbers, macros.
* testsuite/20_util/declval/requirements/1_neg.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg1.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg2.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg3.cc: Same.
* testsuite/20_util/forward/c_neg.cc: Same.
* testsuite/20_util/forward/f_neg.cc: Same.
* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Same.
* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Same.
* testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Same.
* testsuite/20_util/ratio/operations/ops_overflow_neg.cc: Same.
* testsuite/20_util/shared_ptr/cons/43820_neg.cc: Same.
* testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc: Same.
* testsuite/23_containers/forward_list/capacity/1.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
assign_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
insert_neg.cc: Same.
* testsuite/23_containers/list/capacity/29134.cc: Same.
* testsuite/23_containers/list/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/insert_neg.cc: Same.
* testsuite/23_containers/vector/bool/capacity/29134.cc: Same.
* testsuite/23_containers/vector/bool/modifiers/insert/31370.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc: Same.
* testsuite/25_algorithms/sort/35588.cc: Same.
* testsuite/27_io/ios_base/cons/assign_neg.cc: Same.
* testsuite/27_io/ios_base/cons/copy_neg.cc: Same.
* testsuite/ext/profile/mutex_extensions_neg.cc: Same.
* testsuite/ext/profile/profiler_algos.cc: Same.
* testsuite/ext/type_traits/add_unsigned_floating_neg.cc: Same.
* testsuite/ext/type_traits/add_unsigned_integer_neg.cc: Same.
* testsuite/ext/type_traits/remove_unsigned_floating_neg.cc: Same.
* testsuite/ext/type_traits/remove_unsigned_integer_neg.cc: Same.
* testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc: Same.
From-SVN: r169421
2011-01-30 23:39:36 +01:00
|
|
|
_GLIBCXX_END_NAMESPACE_VERSION
|
|
|
|
} // namespace
|
2003-01-22 17:51:52 +01:00
|
|
|
|
locale_facets.h (class collate, [...]): Move...
2007-04-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class collate, class collate_byname):
Move...
* include/bits/locale_classes.h: ... here.
* include/bits/locale_facets.tcc (locale::combine, locale::operator(),
has_facet, use_facet, collate::_M_compare, collate::_M_transform,
collate::do_compare, collate::do_transform, collate::do_hash): Move...
* include/bits/locale_classes.tcc: ... here, new.
* include/Makefile.am: Add.
* testsuite/util/testsuite_abi.h: Include <locale>.
* include/std/locale: Tweak.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/bits/codecvt.h: Likewise.
* include/Makefile.in: Regenerate.
* include/bits/codecvt.h: Adjust extern template declarations.
* include/bits/ostream_insert.h: Likewise.
* include/bits/ostream.tcc: Likewise.
* include/bits/locale_facets.h: Do not include <bits/codecvt.h>.
* include/std/fstream: Do it here.
* include/bits/locale_facets_nonio.h: Likewise.
From-SVN: r124114
2007-04-24 20:57:12 +02:00
|
|
|
# include <bits/locale_classes.tcc>
|
|
|
|
|
2003-01-22 17:51:52 +01:00
|
|
|
#endif
|