2000-10-05 13:27:02 +02:00
|
|
|
// Locale support -*- C++ -*-
|
|
|
|
|
PR libstdc++/28080 (partial)
2007-02-26 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/28080 (partial)
* include/std/bitset: Do not include <istream> and <ostream>,
<ios> is enough.
* include/std/iomanip: Do not include the whole <istream>,
<ios> is enough; do not include <functional>; reformat.
* include/std/functional: Do not include <cstddef>.
* include/std/list: Do not include <bits/stl_uninitialized.h>.
* include/std/numeric: Do not include the whole <iterator> and
<bits/stl_function.h>.
* include/std/valarray: Do not include <numeric>.
* include/bits/stl_numeric.h: Include <bits/concept_check.h>.
* src/iostream-inst.cc: Include <istream>.
* include/ext/functional: Include <cstddef>.
* testsuite/util/testsuite_hooks.h: Do not include <locale>,
<ctime> is enough; qualify tm.
* testsuite/util/testsuite_hooks.cc: Qualify tm.
2007-02-26 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class ctype_byname<char>,
class ctype_byname<wchar_t>): Declare.
* src/ctype.cc (ctype_byname<wchar_t>::ctype_byname(const char*,
size_t), ctype_byname<wchar_t>::~ctype_byname): Define.
* config/locale/generic/ctype_members.cc (ctype_byname<char>::
ctype_byname(const char*, size_t), ctype_byname<char>::~ctype_byname):
Likewise.
* config/locale/gnu/ctype_members.cc (ctype_byname<char>::
ctype_byname(const char*, size_t), ctype_byname<char>::~ctype_byname):
Likewise.
* config/locale/darwin/ctype_members.cc (ctype_byname<char>::
ctype_byname(const char*, size_t), ctype_byname<char>::~ctype_byname):
Likewise.
* testsuite/22_locale/headers/locale/synopsis.cc: Remove xfail.
From-SVN: r122329
2007-02-26 10:36:39 +01:00
|
|
|
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
|
|
|
// 2006, 2007
|
2002-01-23 00:09:04 +01:00
|
|
|
// Free Software Foundation, Inc.
|
2000-10-05 13:27:02 +02:00
|
|
|
//
|
|
|
|
// 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
|
|
|
|
// Free Software Foundation; either version 2, or (at your option)
|
|
|
|
// 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.
|
|
|
|
|
|
|
|
// You should have received a copy of the GNU General Public License along
|
|
|
|
// with this library; see the file COPYING. If not, write to the Free
|
2005-08-17 04:28:44 +02:00
|
|
|
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
2000-10-05 13:27:02 +02:00
|
|
|
// USA.
|
|
|
|
|
|
|
|
// As a special exception, you may use this file as part of a free software
|
|
|
|
// library without restriction. Specifically, if other files instantiate
|
|
|
|
// templates or use macros or inline functions from this file, or you compile
|
|
|
|
// this file and link it with other files to produce an executable, this
|
|
|
|
// file does not by itself cause the resulting executable to be covered by
|
|
|
|
// the GNU General Public License. This exception does not however
|
|
|
|
// invalidate any other reasons why the executable file might be covered by
|
|
|
|
// the GNU General Public License.
|
|
|
|
|
c_io_stdio.h: Correct grammar in comments.
2001-11-02 Phil Edwards <pme@gcc.gnu.org>
* config/io/c_io_stdio.h: Correct grammar in comments.
* docs/doxygen/Intro.3: Expand "top-level" man page.
* docs/doxygen/doxygroups.cc: New module definitions (comments).
* docs/doxygen/mainpage.doxy: Tweaks.
* docs/doxygen/run_doxygen: Update Doxygen version, massage man pages.
Add @file hooks so that headers are considered to be documented.
* include/bits/basic_ios.h, include/bits/basic_file.h,
include/bits/basic_string.h, include/bits/boost_concept_check.h,
include/bits/char_traits.h, include/bits/codecvt.h,
include/bits/concept_check.h, include/bits/cpp_type_traits.h,
include/bits/fpos.h, include/bits/gslice.h, include/bits/gslice_array.h,
include/bits/indirect_array.h, include/bits/ios_base.h,
include/bits/locale_facets.h, include/bits/localefwd.h,
include/bits/mask_array.h, include/bits/pthread_allocimpl.h,
include/bits/slice.h, include/bits/slice_array.h,
include/bits/std_algorithm.h, include/bits/std_bitset.h,
include/bits/std_complex.h, include/bits/std_deque.h,
include/bits/std_fstream.h, include/bits/std_functional.h,
include/bits/std_iomanip.h, include/bits/std_ios.h,
include/bits/std_iosfwd.h, include/bits/std_iostream.h,
include/bits/std_istream.h, include/bits/std_iterator.h,
include/bits/std_limits.h, include/bits/std_list.h,
include/bits/std_locale.h, include/bits/std_map.h,
include/bits/std_memory.h, include/bits/std_numeric.h,
include/bits/std_ostream.h, include/bits/std_queue.h,
include/bits/std_set.h, include/bits/std_sstream.h,
include/bits/std_stack.h, include/bits/std_streambuf.h,
include/bits/std_string.h, include/bits/std_utility.h,
include/bits/std_valarray.h, include/bits/std_vector.h,
include/bits/stl_algo.h, include/bits/stl_alloc.h,
include/bits/stl_bvector.h, include/bits/stl_construct.h,
include/bits/stl_deque.h, include/bits/stl_heap.h,
include/bits/stl_iterator.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_iterator_base_types.h, include/bits/stl_list.h,
include/bits/stl_map.h, include/bits/stl_multimap.h,
include/bits/stl_multiset.h, include/bits/stl_numeric.h,
include/bits/stl_pair.h, include/bits/stl_pthread_alloc.h,
include/bits/stl_queue.h, include/bits/stl_raw_storage_iter.h,
include/bits/stl_relops.h, include/bits/stl_set.h,
include/bits/stl_stack.h, include/bits/stl_tempbuf.h,
include/bits/stl_threads.h, include/bits/stl_tree.h,
include/bits/stl_uninitialized.h, include/bits/stl_vector.h,
include/bits/stream_iterator.h, include/bits/streambuf_iterator.h,
include/bits/stringfwd.h, include/bits/type_traits.h,
include/bits/valarray_array.h, include/bits/valarray_meta.h:
Add hooks, tweak comments only.
* include/bits/stl_algobase.h (swap, min, iter_swap): Also
document these functions.
* include/bits/stl_function.h: Tweak link comments.
From-SVN: r46717
2001-11-02 18:38:11 +01:00
|
|
|
/** @file locale_facets.h
|
|
|
|
* This is an internal header file, included by other library headers.
|
|
|
|
* You should not attempt to use it directly.
|
|
|
|
*/
|
2000-10-05 13:27:02 +02: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_FACETS_H
|
|
|
|
#define _LOCALE_FACETS_H 1
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2001-02-19 19:52:25 +01:00
|
|
|
#pragma GCC system_header
|
|
|
|
|
2002-04-16 02:45:36 +02:00
|
|
|
#include <cwctype> // For wctype_t
|
2007-02-27 18:48:09 +01:00
|
|
|
#include <cctype>
|
2006-11-29 21:59:22 +01:00
|
|
|
#include <bits/ctype_base.h>
|
2003-01-22 17:51:52 +01:00
|
|
|
#include <iosfwd>
|
|
|
|
#include <bits/ios_base.h> // For ios_base, ios_base::iostate
|
|
|
|
#include <streambuf>
|
2006-04-29 20:16:47 +02:00
|
|
|
#include <bits/cpp_type_traits.h>
|
locale_facets.h (class time_base, [...]): Move...
2007-04-23 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class time_base,
struct __timepunct_cache, class __timepunct, class time_get,
class time_get_byname, class time_put, class time_put_byname,
class money_base, struct __moneypunct_cache, class moneypunct,
class moneypunct_byname, class money_get, class money_put,
struct messages_base, class messages, class messages_byname): Move...
* include/bits/locale_facets_nonio.h: ... here.
* include/bits/locale_facets.tcc
(struct __use_cache<__moneypunct_cache<> >,
__moneypunct_cache<>::_M_cache, money_get<>::_M_extract,
money_get<>::__do_get, money_get<>::do_get, money_put<>::_M_insert,
money_put<>::__do_put, money_put<>::do_put, time_get<>::do_date_order,
time_get<>::_M_extract_via_format, time_get<>::_M_extract_num,
time_get<>::_M_extract_name, time_get<>::do_get_time,
time_get<>::do_get_date, time_get<>::do_get_weekday,
time_get<>::do_get_monthname, time_get<>::do_get_year, time_put<>::put,
time_put<>::do_put): Move...
* include/bits/locale_facets_nonio.tcc: ... here.
* include/Makefile.am: Add.
* include/std/locale: Adjust includes.
* include/std/fstream: Likewise.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/Makefile.in: Regenerate.
From-SVN: r124080
2007-04-23 22:26:30 +02:00
|
|
|
#include <ext/type_traits.h>
|
|
|
|
#include <ext/numeric_traits.h>
|
|
|
|
#include <bits/streambuf_iterator.h>
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2005-12-19 01:56:05 +01:00
|
|
|
_GLIBCXX_BEGIN_NAMESPACE(std)
|
|
|
|
|
2002-04-16 02:45:36 +02:00
|
|
|
// NB: Don't instantiate required wchar_t facets if no wchar_t support.
|
2003-07-05 06:05:45 +02:00
|
|
|
#ifdef _GLIBCXX_USE_WCHAR_T
|
|
|
|
# define _GLIBCXX_NUM_FACETS 28
|
2002-04-16 02:45:36 +02:00
|
|
|
#else
|
2003-07-05 06:05:45 +02:00
|
|
|
# define _GLIBCXX_NUM_FACETS 14
|
2002-04-16 02:45:36 +02:00
|
|
|
#endif
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
// Convert string to numeric value of type _Tv and store results.
|
2003-01-22 17:51:52 +01:00
|
|
|
// NB: This is specialized for all required types, there is no
|
|
|
|
// generic definition.
|
|
|
|
template<typename _Tv>
|
|
|
|
void
|
2004-02-08 05:46:42 +01:00
|
|
|
__convert_to_v(const char* __in, _Tv& __out, ios_base::iostate& __err,
|
c_locale.cc (__convert_to_v(long&), [...]): Remove.
2003-12-08 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/c_locale.cc (__convert_to_v(long&),
__convert_to_v(unsigned long&), __convert_to_v(long long&),
__convert_to_v(unsigned long long&): Remove.
(__convert_to_v(float&), __convert_to_v(double&),
__convert_to_v(long double&)): Remove last unused parameter.
* config/locale/gnu/c_locale.cc: Likewise.
* include/bits/locale_facets.h: Likewise.
(num_get::_M_extract_int): Update declaration.
(class __num_base): Tweak _S_ie and _S_iE according to the
_S_atoms_in changes.
* include/bits/locale_facets.tcc (num_get::_M_extract_int):
Provide directly the final _ValueT, not a string: accumulate
the result checking for overflow at each digit.
(num_get::do_get(bool&), num_get::do_get(long&),
num_get::do_get(unsigned short&), num_get::do_get(unsigned int&),
num_get::do_get(unsigned long&), num_get::do_get(long long&),
num_get::do_get(unsigned long long&), num_get::do_get(void*&)):
Use the new _M_extract_int, simplify.
* src/locale-inst.cc (num_get::_M_extract_int(long&),
num_get::_M_extract_int(unsigned short&),
num_get::_M_extract_int(unsigned int&),
num_get::_M_extract_int(unsigned long&),
num_get::_M_extract_int(long long&),
num_get::_M_extract_int(unsigned long long&): Instantiate.
* src/locale_facets.cc (__num_base::_S_atoms_in): Reorder
the chars in the natural order: abcdefABCDEF.
From-SVN: r74423
2003-12-08 16:37:03 +01:00
|
|
|
const __c_locale& __cloc);
|
2003-01-22 17:51:52 +01:00
|
|
|
|
|
|
|
// Explicit specializations for required types.
|
|
|
|
template<>
|
|
|
|
void
|
2004-02-08 05:46:42 +01:00
|
|
|
__convert_to_v(const char*, float&, ios_base::iostate&,
|
c_locale.cc (__convert_to_v(long&), [...]): Remove.
2003-12-08 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/c_locale.cc (__convert_to_v(long&),
__convert_to_v(unsigned long&), __convert_to_v(long long&),
__convert_to_v(unsigned long long&): Remove.
(__convert_to_v(float&), __convert_to_v(double&),
__convert_to_v(long double&)): Remove last unused parameter.
* config/locale/gnu/c_locale.cc: Likewise.
* include/bits/locale_facets.h: Likewise.
(num_get::_M_extract_int): Update declaration.
(class __num_base): Tweak _S_ie and _S_iE according to the
_S_atoms_in changes.
* include/bits/locale_facets.tcc (num_get::_M_extract_int):
Provide directly the final _ValueT, not a string: accumulate
the result checking for overflow at each digit.
(num_get::do_get(bool&), num_get::do_get(long&),
num_get::do_get(unsigned short&), num_get::do_get(unsigned int&),
num_get::do_get(unsigned long&), num_get::do_get(long long&),
num_get::do_get(unsigned long long&), num_get::do_get(void*&)):
Use the new _M_extract_int, simplify.
* src/locale-inst.cc (num_get::_M_extract_int(long&),
num_get::_M_extract_int(unsigned short&),
num_get::_M_extract_int(unsigned int&),
num_get::_M_extract_int(unsigned long&),
num_get::_M_extract_int(long long&),
num_get::_M_extract_int(unsigned long long&): Instantiate.
* src/locale_facets.cc (__num_base::_S_atoms_in): Reorder
the chars in the natural order: abcdefABCDEF.
From-SVN: r74423
2003-12-08 16:37:03 +01:00
|
|
|
const __c_locale&);
|
2003-01-22 17:51:52 +01:00
|
|
|
|
|
|
|
template<>
|
|
|
|
void
|
2004-02-08 05:46:42 +01:00
|
|
|
__convert_to_v(const char*, double&, ios_base::iostate&,
|
c_locale.cc (__convert_to_v(long&), [...]): Remove.
2003-12-08 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/c_locale.cc (__convert_to_v(long&),
__convert_to_v(unsigned long&), __convert_to_v(long long&),
__convert_to_v(unsigned long long&): Remove.
(__convert_to_v(float&), __convert_to_v(double&),
__convert_to_v(long double&)): Remove last unused parameter.
* config/locale/gnu/c_locale.cc: Likewise.
* include/bits/locale_facets.h: Likewise.
(num_get::_M_extract_int): Update declaration.
(class __num_base): Tweak _S_ie and _S_iE according to the
_S_atoms_in changes.
* include/bits/locale_facets.tcc (num_get::_M_extract_int):
Provide directly the final _ValueT, not a string: accumulate
the result checking for overflow at each digit.
(num_get::do_get(bool&), num_get::do_get(long&),
num_get::do_get(unsigned short&), num_get::do_get(unsigned int&),
num_get::do_get(unsigned long&), num_get::do_get(long long&),
num_get::do_get(unsigned long long&), num_get::do_get(void*&)):
Use the new _M_extract_int, simplify.
* src/locale-inst.cc (num_get::_M_extract_int(long&),
num_get::_M_extract_int(unsigned short&),
num_get::_M_extract_int(unsigned int&),
num_get::_M_extract_int(unsigned long&),
num_get::_M_extract_int(long long&),
num_get::_M_extract_int(unsigned long long&): Instantiate.
* src/locale_facets.cc (__num_base::_S_atoms_in): Reorder
the chars in the natural order: abcdefABCDEF.
From-SVN: r74423
2003-12-08 16:37:03 +01:00
|
|
|
const __c_locale&);
|
2003-01-22 17:51:52 +01:00
|
|
|
|
c_locale.cc (__convert_to_v(long&), [...]): Remove.
2003-12-08 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/c_locale.cc (__convert_to_v(long&),
__convert_to_v(unsigned long&), __convert_to_v(long long&),
__convert_to_v(unsigned long long&): Remove.
(__convert_to_v(float&), __convert_to_v(double&),
__convert_to_v(long double&)): Remove last unused parameter.
* config/locale/gnu/c_locale.cc: Likewise.
* include/bits/locale_facets.h: Likewise.
(num_get::_M_extract_int): Update declaration.
(class __num_base): Tweak _S_ie and _S_iE according to the
_S_atoms_in changes.
* include/bits/locale_facets.tcc (num_get::_M_extract_int):
Provide directly the final _ValueT, not a string: accumulate
the result checking for overflow at each digit.
(num_get::do_get(bool&), num_get::do_get(long&),
num_get::do_get(unsigned short&), num_get::do_get(unsigned int&),
num_get::do_get(unsigned long&), num_get::do_get(long long&),
num_get::do_get(unsigned long long&), num_get::do_get(void*&)):
Use the new _M_extract_int, simplify.
* src/locale-inst.cc (num_get::_M_extract_int(long&),
num_get::_M_extract_int(unsigned short&),
num_get::_M_extract_int(unsigned int&),
num_get::_M_extract_int(unsigned long&),
num_get::_M_extract_int(long long&),
num_get::_M_extract_int(unsigned long long&): Instantiate.
* src/locale_facets.cc (__num_base::_S_atoms_in): Reorder
the chars in the natural order: abcdefABCDEF.
From-SVN: r74423
2003-12-08 16:37:03 +01:00
|
|
|
template<>
|
2003-01-22 17:51:52 +01:00
|
|
|
void
|
2004-02-08 05:46:42 +01:00
|
|
|
__convert_to_v(const char*, long double&, ios_base::iostate&,
|
c_locale.cc (__convert_to_v(long&), [...]): Remove.
2003-12-08 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/c_locale.cc (__convert_to_v(long&),
__convert_to_v(unsigned long&), __convert_to_v(long long&),
__convert_to_v(unsigned long long&): Remove.
(__convert_to_v(float&), __convert_to_v(double&),
__convert_to_v(long double&)): Remove last unused parameter.
* config/locale/gnu/c_locale.cc: Likewise.
* include/bits/locale_facets.h: Likewise.
(num_get::_M_extract_int): Update declaration.
(class __num_base): Tweak _S_ie and _S_iE according to the
_S_atoms_in changes.
* include/bits/locale_facets.tcc (num_get::_M_extract_int):
Provide directly the final _ValueT, not a string: accumulate
the result checking for overflow at each digit.
(num_get::do_get(bool&), num_get::do_get(long&),
num_get::do_get(unsigned short&), num_get::do_get(unsigned int&),
num_get::do_get(unsigned long&), num_get::do_get(long long&),
num_get::do_get(unsigned long long&), num_get::do_get(void*&)):
Use the new _M_extract_int, simplify.
* src/locale-inst.cc (num_get::_M_extract_int(long&),
num_get::_M_extract_int(unsigned short&),
num_get::_M_extract_int(unsigned int&),
num_get::_M_extract_int(unsigned long&),
num_get::_M_extract_int(long long&),
num_get::_M_extract_int(unsigned long long&): Instantiate.
* src/locale_facets.cc (__num_base::_S_atoms_in): Reorder
the chars in the natural order: abcdefABCDEF.
From-SVN: r74423
2003-12-08 16:37:03 +01:00
|
|
|
const __c_locale&);
|
2003-01-22 17:51:52 +01:00
|
|
|
|
2003-02-06 06:58:10 +01:00
|
|
|
// NB: __pad is a struct, rather than a function, so it can be
|
|
|
|
// partially-specialized.
|
2002-07-31 04:47:36 +02:00
|
|
|
template<typename _CharT, typename _Traits>
|
2003-01-22 17:51:52 +01:00
|
|
|
struct __pad
|
|
|
|
{
|
|
|
|
static void
|
2004-02-08 05:46:42 +01:00
|
|
|
_S_pad(ios_base& __io, _CharT __fill, _CharT* __news,
|
|
|
|
const _CharT* __olds, const streamsize __newlen,
|
PR libstdc++/28277 (partial: vstring bits)
2007-04-10 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/28277 (partial: vstring bits)
* include/bits/ostream_insert.h: New.
* include/Makefile.am: Add.
* include/ext/vstring.h (operator<<(basic_ostream<>&,
const __versa_string<>&): Forward to __ostream_insert.
* include/bits/basic_string.h (operator<<(basic_ostream<>&,
const string<>&)): Likewise.
* include/std/ostream (operator<<(basic_ostream<>&, _CharT),
operator<<(basic_ostream<char,>&, char), operator<<(basic_ostream<>&,
const _CharT*), operator<<(basic_ostream<char,>&, const char*)):
Likewise.
* include/ext/vstring.tcc (operator<<(basic_ostream<>&,
const __versa_string<>&)): Remove.
(class basic_ostream): Remove friend declarations.
(basic_ostream<>::_M_write(char_type, streamsize),
_M_insert(const char_type*, streamsize)): Remove.
* include/bits/ostream.tcc (_M_insert(const char_type*, streamsize)):
Remove definition.
(operator<<(basic_ostream<>&, const char*)): Use __ostream_insert.
* config/abi/pre/gnu.ver: Adjust.
* src/ostream-inst.cc: Add __ostream_insert instantiations.
* include/bits/locale_facets.h (__pad<>::_S_pad): Remove __num
parameter.
* include/bits/locale_facets.tcc (__pad<>::_S_pad): Adjust.
(num_put<>::_M_pad(_CharT, streamsize, ios_base&, _CharT*,
const _CharT*, int&)): Likewise.
* include/Makefile.in: Rebuild.
* testsuite/ext/vstring/inserters_extractors/char/28277.cc: New.
* testsuite/ext/vstring/inserters_extractors/wchar_t/28277.cc: New.
* include/ext/vstring_util.h: Do not include the whole <locale>.
* include/ext/vstring.tcc (operator>>(basic_istream<>&,
__versa_string<>&, getline(basic_istream<>&, __versa_string<>&,
_CharT)): Tweak to refer to ios_base as a base of istream; do not
refer to non-standard types of istream.
* include/bits/istream.tcc (operator>>(basic_istream<>&, _CharT*),
ws(basic_istream<>&)): Do not refer to non-standard types of istream.
* include/std/bitset (operator>>(std::basic_istream<>&, bitset<>&)):
Avoid using basic_streambuf<>*.
* include/bits/istream.tcc (operator>>(basic_istream<>&,
basic_string<>&), getline(basic_istream<>&, basic_string<>&, _CharT)):
Move...
* include/bits/basic_string.tcc: ... here; tweak to refer to ios_base
as a base of istream; do not refer to non-standard types of istream.
* include/std/string: Tweak includes.
* include/ext/type_traits.h (__is_null_pointer): Add.
* include/ext/rc_string_base.h: Use it.
* include/ext/sso_string_base.h: Likewise.
* include/bits/basic_string.tcc (__is_null_pointer): Remove, use
the above.
* include/ext/vstring_util.h (__vstring_utility<>::_S_is_null_pointer):
Remove.
From-SVN: r123692
2007-04-10 12:38:50 +02:00
|
|
|
const streamsize __oldlen);
|
2003-01-22 17:51:52 +01:00
|
|
|
};
|
|
|
|
|
2003-02-06 06:58:10 +01:00
|
|
|
// Used by both numeric and monetary facets.
|
|
|
|
// Inserts "group separator" characters into an array of characters.
|
|
|
|
// It's recursive, one iteration per group. It moves the characters
|
|
|
|
// in the buffer this way: "xxxx12345" -> "12,345xxx". Call this
|
locale_facets.h (class time_base, [...]): Move...
2007-04-23 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class time_base,
struct __timepunct_cache, class __timepunct, class time_get,
class time_get_byname, class time_put, class time_put_byname,
class money_base, struct __moneypunct_cache, class moneypunct,
class moneypunct_byname, class money_get, class money_put,
struct messages_base, class messages, class messages_byname): Move...
* include/bits/locale_facets_nonio.h: ... here.
* include/bits/locale_facets.tcc
(struct __use_cache<__moneypunct_cache<> >,
__moneypunct_cache<>::_M_cache, money_get<>::_M_extract,
money_get<>::__do_get, money_get<>::do_get, money_put<>::_M_insert,
money_put<>::__do_put, money_put<>::do_put, time_get<>::do_date_order,
time_get<>::_M_extract_via_format, time_get<>::_M_extract_num,
time_get<>::_M_extract_name, time_get<>::do_get_time,
time_get<>::do_get_date, time_get<>::do_get_weekday,
time_get<>::do_get_monthname, time_get<>::do_get_year, time_put<>::put,
time_put<>::do_put): Move...
* include/bits/locale_facets_nonio.tcc: ... here.
* include/Makefile.am: Add.
* include/std/locale: Adjust includes.
* include/std/fstream: Likewise.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/Makefile.in: Regenerate.
From-SVN: r124080
2007-04-23 22:26:30 +02:00
|
|
|
// only with __gsize != 0.
|
2003-01-22 17:51:52 +01:00
|
|
|
template<typename _CharT>
|
|
|
|
_CharT*
|
2004-02-08 05:46:42 +01:00
|
|
|
__add_grouping(_CharT* __s, _CharT __sep,
|
|
|
|
const char* __gbeg, size_t __gsize,
|
2003-01-22 17:51:52 +01:00
|
|
|
const _CharT* __first, const _CharT* __last);
|
2002-07-31 04:47:36 +02:00
|
|
|
|
2003-02-06 06:58:10 +01:00
|
|
|
// This template permits specializing facet output code for
|
|
|
|
// ostreambuf_iterator. For ostreambuf_iterator, sputn is
|
|
|
|
// significantly more efficient than incrementing iterators.
|
|
|
|
template<typename _CharT>
|
|
|
|
inline
|
|
|
|
ostreambuf_iterator<_CharT>
|
|
|
|
__write(ostreambuf_iterator<_CharT> __s, const _CharT* __ws, int __len)
|
|
|
|
{
|
|
|
|
__s._M_put(__ws, __len);
|
|
|
|
return __s;
|
|
|
|
}
|
|
|
|
|
|
|
|
// This is the unspecialized form of the template.
|
|
|
|
template<typename _CharT, typename _OutIter>
|
|
|
|
inline
|
|
|
|
_OutIter
|
|
|
|
__write(_OutIter __s, const _CharT* __ws, int __len)
|
|
|
|
{
|
|
|
|
for (int __j = 0; __j < __len; __j++, ++__s)
|
|
|
|
*__s = __ws[__j];
|
|
|
|
return __s;
|
|
|
|
}
|
|
|
|
|
2003-02-18 06:45:07 +01:00
|
|
|
|
2000-12-22 12:03:33 +01:00
|
|
|
// 22.2.1.1 Template class ctype
|
2001-08-08 04:49:01 +02:00
|
|
|
// Include host and configuration specific ctype enums for ctype_base.
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
// Common base for ctype<_CharT>.
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Common base for ctype facet
|
|
|
|
*
|
|
|
|
* This template class provides implementations of the public functions
|
|
|
|
* that forward to the protected virtual functions.
|
|
|
|
*
|
|
|
|
* This template also provides abtract stubs for the protected virtual
|
|
|
|
* functions.
|
|
|
|
*/
|
2000-10-05 13:27:02 +02:00
|
|
|
template<typename _CharT>
|
2000-12-07 07:44:49 +01:00
|
|
|
class __ctype_abstract_base : public locale::facet, public ctype_base
|
2000-10-05 13:27:02 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Types:
|
2003-12-19 21:44:18 +01:00
|
|
|
/// Typedef for the template parameter
|
2000-10-05 13:27:02 +02:00
|
|
|
typedef _CharT char_type;
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Test char_type classification.
|
|
|
|
*
|
|
|
|
* This function finds a mask M for @a c and compares it to mask @a m.
|
|
|
|
* It does so by returning the value of ctype<char_type>::do_is().
|
|
|
|
*
|
|
|
|
* @param c The char_type to compare the mask of.
|
|
|
|
* @param m The mask to compare against.
|
|
|
|
* @return (M & m) != 0.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
bool
|
2000-12-07 07:44:49 +01:00
|
|
|
is(mask __m, char_type __c) const
|
|
|
|
{ return this->do_is(__m, __c); }
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Return a mask array.
|
|
|
|
*
|
|
|
|
* This function finds the mask for each char_type in the range [lo,hi)
|
|
|
|
* and successively writes it to vec. vec must have as many elements
|
|
|
|
* as the char array. It does so by returning the value of
|
|
|
|
* ctype<char_type>::do_is().
|
|
|
|
*
|
|
|
|
* @param lo Pointer to start of range.
|
|
|
|
* @param hi Pointer to end of range.
|
|
|
|
* @param vec Pointer to an array of mask storage.
|
|
|
|
* @return @a hi.
|
|
|
|
*/
|
2000-12-07 07:44:49 +01:00
|
|
|
const char_type*
|
2004-02-08 05:46:42 +01:00
|
|
|
is(const char_type *__lo, const char_type *__hi, mask *__vec) const
|
2000-12-07 07:44:49 +01:00
|
|
|
{ return this->do_is(__lo, __hi, __vec); }
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Find char_type matching a mask
|
|
|
|
*
|
|
|
|
* This function searches for and returns the first char_type c in
|
|
|
|
* [lo,hi) for which is(m,c) is true. It does so by returning
|
|
|
|
* ctype<char_type>::do_scan_is().
|
|
|
|
*
|
|
|
|
* @param m The mask to compare against.
|
|
|
|
* @param lo Pointer to start of range.
|
|
|
|
* @param hi Pointer to end of range.
|
|
|
|
* @return Pointer to matching char_type if found, else @a hi.
|
|
|
|
*/
|
2000-12-07 07:44:49 +01:00
|
|
|
const char_type*
|
|
|
|
scan_is(mask __m, const char_type* __lo, const char_type* __hi) const
|
|
|
|
{ return this->do_scan_is(__m, __lo, __hi); }
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Find char_type not matching a mask
|
|
|
|
*
|
|
|
|
* This function searches for and returns the first char_type c in
|
|
|
|
* [lo,hi) for which is(m,c) is false. It does so by returning
|
|
|
|
* ctype<char_type>::do_scan_not().
|
|
|
|
*
|
|
|
|
* @param m The mask to compare against.
|
|
|
|
* @param lo Pointer to first char in range.
|
|
|
|
* @param hi Pointer to end of range.
|
|
|
|
* @return Pointer to non-matching char if found, else @a hi.
|
|
|
|
*/
|
2000-12-07 07:44:49 +01:00
|
|
|
const char_type*
|
|
|
|
scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
|
|
|
|
{ return this->do_scan_not(__m, __lo, __hi); }
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Convert to uppercase.
|
|
|
|
*
|
|
|
|
* This function converts the argument to uppercase if possible.
|
|
|
|
* If not possible (for example, '2'), returns the argument. It does
|
|
|
|
* so by returning ctype<char_type>::do_toupper().
|
|
|
|
*
|
|
|
|
* @param c The char_type to convert.
|
|
|
|
* @return The uppercase char_type if convertible, else @a c.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
char_type
|
2000-10-05 13:27:02 +02:00
|
|
|
toupper(char_type __c) const
|
|
|
|
{ return this->do_toupper(__c); }
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Convert array to uppercase.
|
|
|
|
*
|
|
|
|
* This function converts each char_type in the range [lo,hi) to
|
|
|
|
* uppercase if possible. Other elements remain untouched. It does so
|
|
|
|
* by returning ctype<char_type>:: do_toupper(lo, hi).
|
|
|
|
*
|
|
|
|
* @param lo Pointer to start of range.
|
|
|
|
* @param hi Pointer to end of range.
|
|
|
|
* @return @a hi.
|
|
|
|
*/
|
2000-10-05 13:27:02 +02:00
|
|
|
const char_type*
|
2001-06-04 21:25:41 +02:00
|
|
|
toupper(char_type *__lo, const char_type* __hi) const
|
|
|
|
{ return this->do_toupper(__lo, __hi); }
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Convert to lowercase.
|
|
|
|
*
|
|
|
|
* This function converts the argument to lowercase if possible. If
|
|
|
|
* not possible (for example, '2'), returns the argument. It does so
|
|
|
|
* by returning ctype<char_type>::do_tolower(c).
|
|
|
|
*
|
|
|
|
* @param c The char_type to convert.
|
|
|
|
* @return The lowercase char_type if convertible, else @a c.
|
|
|
|
*/
|
|
|
|
char_type
|
2000-10-05 13:27:02 +02:00
|
|
|
tolower(char_type __c) const
|
|
|
|
{ return this->do_tolower(__c); }
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Convert array to lowercase.
|
|
|
|
*
|
|
|
|
* This function converts each char_type in the range [lo,hi) to
|
|
|
|
* lowercase if possible. Other elements remain untouched. It does so
|
|
|
|
* by returning ctype<char_type>:: do_tolower(lo, hi).
|
|
|
|
*
|
|
|
|
* @param lo Pointer to start of range.
|
|
|
|
* @param hi Pointer to end of range.
|
|
|
|
* @return @a hi.
|
|
|
|
*/
|
2000-10-05 13:27:02 +02:00
|
|
|
const char_type*
|
2001-06-04 21:25:41 +02:00
|
|
|
tolower(char_type* __lo, const char_type* __hi) const
|
|
|
|
{ return this->do_tolower(__lo, __hi); }
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Widen char to char_type
|
|
|
|
*
|
|
|
|
* This function converts the char argument to char_type using the
|
|
|
|
* simplest reasonable transformation. It does so by returning
|
|
|
|
* ctype<char_type>::do_widen(c).
|
|
|
|
*
|
|
|
|
* Note: this is not what you want for codepage conversions. See
|
|
|
|
* codecvt for that.
|
|
|
|
*
|
|
|
|
* @param c The char to convert.
|
|
|
|
* @return The converted char_type.
|
|
|
|
*/
|
|
|
|
char_type
|
2000-10-05 13:27:02 +02:00
|
|
|
widen(char __c) const
|
|
|
|
{ return this->do_widen(__c); }
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Widen array to char_type
|
|
|
|
*
|
|
|
|
* This function converts each char in the input to char_type using the
|
|
|
|
* simplest reasonable transformation. It does so by returning
|
|
|
|
* ctype<char_type>::do_widen(c).
|
|
|
|
*
|
|
|
|
* Note: this is not what you want for codepage conversions. See
|
|
|
|
* codecvt for that.
|
|
|
|
*
|
|
|
|
* @param lo Pointer to start of range.
|
|
|
|
* @param hi Pointer to end of range.
|
|
|
|
* @param to Pointer to the destination array.
|
|
|
|
* @return @a hi.
|
|
|
|
*/
|
2000-10-05 13:27:02 +02:00
|
|
|
const char*
|
2001-06-04 21:25:41 +02:00
|
|
|
widen(const char* __lo, const char* __hi, char_type* __to) const
|
|
|
|
{ return this->do_widen(__lo, __hi, __to); }
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Narrow char_type to char
|
|
|
|
*
|
|
|
|
* This function converts the char_type to char using the simplest
|
|
|
|
* reasonable transformation. If the conversion fails, dfault is
|
|
|
|
* returned instead. It does so by returning
|
|
|
|
* ctype<char_type>::do_narrow(c).
|
|
|
|
*
|
|
|
|
* Note: this is not what you want for codepage conversions. See
|
|
|
|
* codecvt for that.
|
|
|
|
*
|
|
|
|
* @param c The char_type to convert.
|
|
|
|
* @param dfault Char to return if conversion fails.
|
|
|
|
* @return The converted char.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
char
|
2000-10-05 13:27:02 +02:00
|
|
|
narrow(char_type __c, char __dfault) const
|
|
|
|
{ return this->do_narrow(__c, __dfault); }
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Narrow array to char array
|
|
|
|
*
|
|
|
|
* This function converts each char_type in the input to char using the
|
|
|
|
* simplest reasonable transformation and writes the results to the
|
|
|
|
* destination array. For any char_type in the input that cannot be
|
|
|
|
* converted, @a dfault is used instead. It does so by returning
|
|
|
|
* ctype<char_type>::do_narrow(lo, hi, dfault, to).
|
|
|
|
*
|
|
|
|
* Note: this is not what you want for codepage conversions. See
|
|
|
|
* codecvt for that.
|
|
|
|
*
|
|
|
|
* @param lo Pointer to start of range.
|
|
|
|
* @param hi Pointer to end of range.
|
|
|
|
* @param dfault Char to use if conversion fails.
|
|
|
|
* @param to Pointer to the destination array.
|
|
|
|
* @return @a hi.
|
|
|
|
*/
|
2000-10-05 13:27:02 +02:00
|
|
|
const char_type*
|
2001-06-04 21:25:41 +02:00
|
|
|
narrow(const char_type* __lo, const char_type* __hi,
|
2000-10-05 13:27:02 +02:00
|
|
|
char __dfault, char *__to) const
|
2001-06-04 21:25:41 +02:00
|
|
|
{ return this->do_narrow(__lo, __hi, __dfault, __to); }
|
2000-10-05 13:27:02 +02:00
|
|
|
|
|
|
|
protected:
|
2004-02-08 05:46:42 +01:00
|
|
|
explicit
|
2003-07-18 04:27:16 +02:00
|
|
|
__ctype_abstract_base(size_t __refs = 0): facet(__refs) { }
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual
|
2000-12-07 07:44:49 +01:00
|
|
|
~__ctype_abstract_base() { }
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Test char_type classification.
|
|
|
|
*
|
|
|
|
* This function finds a mask M for @a c and compares it to mask @a m.
|
|
|
|
*
|
|
|
|
* do_is() is a hook for a derived facet to change the behavior of
|
|
|
|
* classifying. do_is() must always return the same result for the
|
|
|
|
* same input.
|
|
|
|
*
|
|
|
|
* @param c The char_type to find the mask of.
|
|
|
|
* @param m The mask to compare against.
|
|
|
|
* @return (M & m) != 0.
|
|
|
|
*/
|
|
|
|
virtual bool
|
2000-12-07 07:44:49 +01:00
|
|
|
do_is(mask __m, char_type __c) const = 0;
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Return a mask array.
|
|
|
|
*
|
|
|
|
* This function finds the mask for each char_type in the range [lo,hi)
|
|
|
|
* and successively writes it to vec. vec must have as many elements
|
|
|
|
* as the input.
|
|
|
|
*
|
|
|
|
* do_is() is a hook for a derived facet to change the behavior of
|
|
|
|
* classifying. do_is() must always return the same result for the
|
|
|
|
* same input.
|
|
|
|
*
|
|
|
|
* @param lo Pointer to start of range.
|
|
|
|
* @param hi Pointer to end of range.
|
|
|
|
* @param vec Pointer to an array of mask storage.
|
|
|
|
* @return @a hi.
|
|
|
|
*/
|
2000-12-07 07:44:49 +01:00
|
|
|
virtual const char_type*
|
2004-02-08 05:46:42 +01:00
|
|
|
do_is(const char_type* __lo, const char_type* __hi,
|
2000-12-07 07:44:49 +01:00
|
|
|
mask* __vec) const = 0;
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Find char_type matching mask
|
|
|
|
*
|
|
|
|
* This function searches for and returns the first char_type c in
|
|
|
|
* [lo,hi) for which is(m,c) is true.
|
|
|
|
*
|
|
|
|
* do_scan_is() is a hook for a derived facet to change the behavior of
|
|
|
|
* match searching. do_is() must always return the same result for the
|
|
|
|
* same input.
|
|
|
|
*
|
|
|
|
* @param m The mask to compare against.
|
|
|
|
* @param lo Pointer to start of range.
|
|
|
|
* @param hi Pointer to end of range.
|
|
|
|
* @return Pointer to a matching char_type if found, else @a hi.
|
|
|
|
*/
|
2000-12-07 07:44:49 +01:00
|
|
|
virtual const char_type*
|
2001-06-04 21:25:41 +02:00
|
|
|
do_scan_is(mask __m, const char_type* __lo,
|
2000-12-07 07:44:49 +01:00
|
|
|
const char_type* __hi) const = 0;
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Find char_type not matching mask
|
|
|
|
*
|
|
|
|
* This function searches for and returns a pointer to the first
|
|
|
|
* char_type c of [lo,hi) for which is(m,c) is false.
|
|
|
|
*
|
|
|
|
* do_scan_is() is a hook for a derived facet to change the behavior of
|
|
|
|
* match searching. do_is() must always return the same result for the
|
|
|
|
* same input.
|
|
|
|
*
|
|
|
|
* @param m The mask to compare against.
|
|
|
|
* @param lo Pointer to start of range.
|
|
|
|
* @param hi Pointer to end of range.
|
|
|
|
* @return Pointer to a non-matching char_type if found, else @a hi.
|
|
|
|
*/
|
2000-12-07 07:44:49 +01:00
|
|
|
virtual const char_type*
|
2004-02-08 05:46:42 +01:00
|
|
|
do_scan_not(mask __m, const char_type* __lo,
|
2000-12-07 07:44:49 +01:00
|
|
|
const char_type* __hi) const = 0;
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Convert to uppercase.
|
|
|
|
*
|
|
|
|
* This virtual function converts the char_type argument to uppercase
|
|
|
|
* if possible. If not possible (for example, '2'), returns the
|
|
|
|
* argument.
|
|
|
|
*
|
|
|
|
* do_toupper() is a hook for a derived facet to change the behavior of
|
|
|
|
* uppercasing. do_toupper() must always return the same result for
|
|
|
|
* the same input.
|
|
|
|
*
|
|
|
|
* @param c The char_type to convert.
|
|
|
|
* @return The uppercase char_type if convertible, else @a c.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual char_type
|
2000-10-05 13:27:02 +02:00
|
|
|
do_toupper(char_type) const = 0;
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Convert array to uppercase.
|
|
|
|
*
|
|
|
|
* This virtual function converts each char_type in the range [lo,hi)
|
|
|
|
* to uppercase if possible. Other elements remain untouched.
|
|
|
|
*
|
|
|
|
* do_toupper() is a hook for a derived facet to change the behavior of
|
|
|
|
* uppercasing. do_toupper() must always return the same result for
|
|
|
|
* the same input.
|
|
|
|
*
|
|
|
|
* @param lo Pointer to start of range.
|
|
|
|
* @param hi Pointer to end of range.
|
|
|
|
* @return @a hi.
|
|
|
|
*/
|
2000-10-05 13:27:02 +02:00
|
|
|
virtual const char_type*
|
2001-06-04 21:25:41 +02:00
|
|
|
do_toupper(char_type* __lo, const char_type* __hi) const = 0;
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Convert to lowercase.
|
|
|
|
*
|
|
|
|
* This virtual function converts the argument to lowercase if
|
|
|
|
* possible. If not possible (for example, '2'), returns the argument.
|
|
|
|
*
|
|
|
|
* do_tolower() is a hook for a derived facet to change the behavior of
|
|
|
|
* lowercasing. do_tolower() must always return the same result for
|
|
|
|
* the same input.
|
|
|
|
*
|
|
|
|
* @param c The char_type to convert.
|
|
|
|
* @return The lowercase char_type if convertible, else @a c.
|
|
|
|
*/
|
|
|
|
virtual char_type
|
2000-10-05 13:27:02 +02:00
|
|
|
do_tolower(char_type) const = 0;
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Convert array to lowercase.
|
|
|
|
*
|
|
|
|
* This virtual function converts each char_type in the range [lo,hi)
|
|
|
|
* to lowercase if possible. Other elements remain untouched.
|
|
|
|
*
|
|
|
|
* do_tolower() is a hook for a derived facet to change the behavior of
|
|
|
|
* lowercasing. do_tolower() must always return the same result for
|
|
|
|
* the same input.
|
|
|
|
*
|
|
|
|
* @param lo Pointer to start of range.
|
|
|
|
* @param hi Pointer to end of range.
|
|
|
|
* @return @a hi.
|
|
|
|
*/
|
2000-10-05 13:27:02 +02:00
|
|
|
virtual const char_type*
|
2001-06-04 21:25:41 +02:00
|
|
|
do_tolower(char_type* __lo, const char_type* __hi) const = 0;
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Widen char
|
|
|
|
*
|
|
|
|
* This virtual function converts the char to char_type using the
|
|
|
|
* simplest reasonable transformation.
|
|
|
|
*
|
|
|
|
* do_widen() is a hook for a derived facet to change the behavior of
|
|
|
|
* widening. do_widen() must always return the same result for the
|
|
|
|
* same input.
|
|
|
|
*
|
|
|
|
* Note: this is not what you want for codepage conversions. See
|
|
|
|
* codecvt for that.
|
|
|
|
*
|
|
|
|
* @param c The char to convert.
|
|
|
|
* @return The converted char_type
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual char_type
|
2000-10-05 13:27:02 +02:00
|
|
|
do_widen(char) const = 0;
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Widen char array
|
|
|
|
*
|
|
|
|
* This function converts each char in the input to char_type using the
|
|
|
|
* simplest reasonable transformation.
|
|
|
|
*
|
|
|
|
* do_widen() is a hook for a derived facet to change the behavior of
|
|
|
|
* widening. do_widen() must always return the same result for the
|
|
|
|
* same input.
|
|
|
|
*
|
|
|
|
* Note: this is not what you want for codepage conversions. See
|
|
|
|
* codecvt for that.
|
|
|
|
*
|
|
|
|
* @param lo Pointer to start range.
|
|
|
|
* @param hi Pointer to end of range.
|
|
|
|
* @param to Pointer to the destination array.
|
|
|
|
* @return @a hi.
|
|
|
|
*/
|
2000-10-05 13:27:02 +02:00
|
|
|
virtual const char*
|
2004-02-08 05:46:42 +01:00
|
|
|
do_widen(const char* __lo, const char* __hi,
|
2000-10-05 13:27:02 +02:00
|
|
|
char_type* __dest) const = 0;
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Narrow char_type to char
|
|
|
|
*
|
|
|
|
* This virtual function converts the argument to char using the
|
|
|
|
* simplest reasonable transformation. If the conversion fails, dfault
|
|
|
|
* is returned instead.
|
|
|
|
*
|
|
|
|
* do_narrow() is a hook for a derived facet to change the behavior of
|
|
|
|
* narrowing. do_narrow() must always return the same result for the
|
|
|
|
* same input.
|
|
|
|
*
|
|
|
|
* Note: this is not what you want for codepage conversions. See
|
|
|
|
* codecvt for that.
|
|
|
|
*
|
|
|
|
* @param c The char_type to convert.
|
|
|
|
* @param dfault Char to return if conversion fails.
|
|
|
|
* @return The converted char.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual char
|
2000-10-05 13:27:02 +02:00
|
|
|
do_narrow(char_type, char __dfault) const = 0;
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Narrow char_type array to char
|
|
|
|
*
|
|
|
|
* This virtual function converts each char_type in the range [lo,hi) to
|
|
|
|
* char using the simplest reasonable transformation and writes the
|
|
|
|
* results to the destination array. For any element in the input that
|
|
|
|
* cannot be converted, @a dfault is used instead.
|
|
|
|
*
|
|
|
|
* do_narrow() is a hook for a derived facet to change the behavior of
|
|
|
|
* narrowing. do_narrow() must always return the same result for the
|
|
|
|
* same input.
|
|
|
|
*
|
|
|
|
* Note: this is not what you want for codepage conversions. See
|
|
|
|
* codecvt for that.
|
|
|
|
*
|
|
|
|
* @param lo Pointer to start of range.
|
|
|
|
* @param hi Pointer to end of range.
|
|
|
|
* @param dfault Char to use if conversion fails.
|
|
|
|
* @param to Pointer to the destination array.
|
|
|
|
* @return @a hi.
|
|
|
|
*/
|
2000-10-05 13:27:02 +02:00
|
|
|
virtual const char_type*
|
2001-06-04 21:25:41 +02:00
|
|
|
do_narrow(const char_type* __lo, const char_type* __hi,
|
2003-12-16 12:00:52 +01:00
|
|
|
char __dfault, char* __dest) const = 0;
|
2000-10-05 13:27:02 +02:00
|
|
|
};
|
|
|
|
|
2000-12-07 07:44:49 +01:00
|
|
|
// NB: Generic, mostly useless implementation.
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Template ctype facet
|
|
|
|
*
|
|
|
|
* This template class defines classification and conversion functions for
|
|
|
|
* character sets. It wraps <cctype> functionality. Ctype gets used by
|
|
|
|
* streams for many I/O operations.
|
|
|
|
*
|
|
|
|
* This template provides the protected virtual functions the developer
|
|
|
|
* will have to replace in a derived class or specialization to make a
|
|
|
|
* working facet. The public functions that access them are defined in
|
|
|
|
* __ctype_abstract_base, to allow for implementation flexibility. See
|
|
|
|
* ctype<wchar_t> for an example. The functions are documented in
|
|
|
|
* __ctype_abstract_base.
|
|
|
|
*
|
|
|
|
* Note: implementations are provided for all the protected virtual
|
|
|
|
* functions, but will likely not be useful.
|
|
|
|
*/
|
2000-10-05 13:27:02 +02:00
|
|
|
template<typename _CharT>
|
2000-12-07 07:44:49 +01:00
|
|
|
class ctype : public __ctype_abstract_base<_CharT>
|
2000-10-05 13:27:02 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Types:
|
2004-02-08 05:46:42 +01:00
|
|
|
typedef _CharT char_type;
|
2004-01-10 02:10:23 +01:00
|
|
|
typedef typename __ctype_abstract_base<_CharT>::mask mask;
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/// The facet id for ctype<char_type>
|
2004-02-08 05:46:42 +01:00
|
|
|
static locale::id id;
|
2002-04-16 02:45:36 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
explicit
|
2000-12-07 07:44:49 +01:00
|
|
|
ctype(size_t __refs = 0) : __ctype_abstract_base<_CharT>(__refs) { }
|
2000-10-05 13:27:02 +02:00
|
|
|
|
|
|
|
protected:
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual
|
2001-12-13 00:16:35 +01:00
|
|
|
~ctype();
|
2001-06-04 21:25:41 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual bool
|
2001-12-13 00:16:35 +01:00
|
|
|
do_is(mask __m, char_type __c) const;
|
2001-06-04 21:25:41 +02:00
|
|
|
|
|
|
|
virtual const char_type*
|
2001-12-13 00:16:35 +01:00
|
|
|
do_is(const char_type* __lo, const char_type* __hi, mask* __vec) const;
|
2001-06-04 21:25:41 +02:00
|
|
|
|
|
|
|
virtual const char_type*
|
2001-12-13 00:16:35 +01:00
|
|
|
do_scan_is(mask __m, const char_type* __lo, const char_type* __hi) const;
|
2001-06-04 21:25:41 +02:00
|
|
|
|
|
|
|
virtual const char_type*
|
|
|
|
do_scan_not(mask __m, const char_type* __lo,
|
2001-12-13 00:16:35 +01:00
|
|
|
const char_type* __hi) const;
|
2001-06-04 21:25:41 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual char_type
|
2001-12-13 00:16:35 +01:00
|
|
|
do_toupper(char_type __c) const;
|
2001-06-04 21:25:41 +02:00
|
|
|
|
|
|
|
virtual const char_type*
|
2001-12-13 00:16:35 +01:00
|
|
|
do_toupper(char_type* __lo, const char_type* __hi) const;
|
2001-06-04 21:25:41 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual char_type
|
2001-12-13 00:16:35 +01:00
|
|
|
do_tolower(char_type __c) const;
|
2001-06-04 21:25:41 +02:00
|
|
|
|
|
|
|
virtual const char_type*
|
2001-12-13 00:16:35 +01:00
|
|
|
do_tolower(char_type* __lo, const char_type* __hi) const;
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual char_type
|
2001-12-13 00:16:35 +01:00
|
|
|
do_widen(char __c) const;
|
2001-06-04 21:25:41 +02:00
|
|
|
|
|
|
|
virtual const char*
|
2001-12-13 00:16:35 +01:00
|
|
|
do_widen(const char* __lo, const char* __hi, char_type* __dest) const;
|
2001-06-04 21:25:41 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual char
|
2001-12-13 00:16:35 +01:00
|
|
|
do_narrow(char_type, char __dfault) const;
|
2001-06-04 21:25:41 +02:00
|
|
|
|
|
|
|
virtual const char_type*
|
|
|
|
do_narrow(const char_type* __lo, const char_type* __hi,
|
2001-12-13 00:16:35 +01:00
|
|
|
char __dfault, char* __dest) const;
|
2000-10-05 13:27:02 +02:00
|
|
|
};
|
|
|
|
|
2000-12-22 12:03:33 +01:00
|
|
|
template<typename _CharT>
|
|
|
|
locale::id ctype<_CharT>::id;
|
|
|
|
|
2001-12-13 00:16:35 +01:00
|
|
|
// 22.2.1.3 ctype<char> specialization.
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief The ctype<char> specialization.
|
|
|
|
*
|
|
|
|
* This class defines classification and conversion functions for
|
|
|
|
* the char type. It gets used by char streams for many I/O
|
|
|
|
* operations. The char specialization provides a number of
|
|
|
|
* optimizations as well.
|
|
|
|
*/
|
2000-10-05 13:27:02 +02:00
|
|
|
template<>
|
2003-10-21 16:22:43 +02:00
|
|
|
class ctype<char> : public locale::facet, public ctype_base
|
2000-10-05 13:27:02 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Types:
|
2003-12-19 21:44:18 +01:00
|
|
|
/// Typedef for the template parameter char.
|
2004-02-08 05:46:42 +01:00
|
|
|
typedef char char_type;
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2001-12-15 08:05:04 +01:00
|
|
|
protected:
|
2000-10-05 13:27:02 +02:00
|
|
|
// Data Members:
|
2001-12-15 08:05:04 +01:00
|
|
|
__c_locale _M_c_locale_ctype;
|
2004-02-08 05:46:42 +01:00
|
|
|
bool _M_del;
|
|
|
|
__to_type _M_toupper;
|
|
|
|
__to_type _M_tolower;
|
|
|
|
const mask* _M_table;
|
ctype_noninline.h, [...] (ctype): Initialize _M_narrow, _M_widen.
2003-12-15 Jerry Quinn <jlquinn@optonline.net>
* config/os/aix/ctype_noninline.h,
config/os/bsd/freebsd/ctype_noninline.h,
config/os/bsd/netbsd/ctype_noninline.h,
config/os/djgpp/ctype_noninline.h,
config/os/generic/ctype_noninline.h,
config/os/gnu-linux/ctype_noninline.h,
config/os/hpux/ctype_noninline.h,
config/os/irix/irix5.2/ctype_noninline.h,
config/os/irix/irix6.5/ctype_noninline.h,
config/os/mingw32/ctype_noninline.h,
config/os/newlib/ctype_noninline.h,
config/os/qnx/qnx6.1/ctype_noninline.h,
config/os/solaris/solaris2.5/ctype_noninline.h,
config/os/solaris/solaris2.6/ctype_noninline.h,
config/os/solaris/solaris2.7/ctype_noninline.h,
config/os/vxworks/ctype_noninline.h,
config/os/windiss/ctype_noninline.h (ctype): Initialize
_M_narrow, _M_widen.
* include/bits/locale_facets.h (_M_widen, _M_widen_ok,
_M_narrow, _M_narrow_ok): New.
(widen, narrow): Use tables to bypass virtual functions.
(_M_widen_init, _M_narrow_init): New.
From-SVN: r74662
2003-12-16 02:57:03 +01:00
|
|
|
mutable char _M_widen_ok;
|
|
|
|
mutable char _M_widen[1 + static_cast<unsigned char>(-1)];
|
|
|
|
mutable char _M_narrow[1 + static_cast<unsigned char>(-1)];
|
|
|
|
mutable char _M_narrow_ok; // 0 uninitialized, 1 init,
|
2005-02-16 00:29:52 +01:00
|
|
|
// 2 memcpy can't be used
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2000-10-05 13:27:02 +02:00
|
|
|
public:
|
2003-12-19 21:44:18 +01:00
|
|
|
/// The facet id for ctype<char>
|
2000-10-05 13:27:02 +02:00
|
|
|
static locale::id id;
|
2003-12-19 21:44:18 +01:00
|
|
|
/// The size of the mask table. It is SCHAR_MAX + 1.
|
2000-10-05 13:27:02 +02:00
|
|
|
static const size_t table_size = 1 + static_cast<unsigned char>(-1);
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Constructor performs initialization.
|
|
|
|
*
|
|
|
|
* This is the constructor provided by the standard.
|
|
|
|
*
|
|
|
|
* @param table If non-zero, table is used as the per-char mask.
|
|
|
|
* Else classic_table() is used.
|
|
|
|
* @param del If true, passes ownership of table to this facet.
|
|
|
|
* @param refs Passed to the base facet class.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
explicit
|
2000-10-05 13:27:02 +02:00
|
|
|
ctype(const mask* __table = 0, bool __del = false, size_t __refs = 0);
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Constructor performs static initialization.
|
|
|
|
*
|
|
|
|
* This constructor is used to construct the initial C locale facet.
|
|
|
|
*
|
|
|
|
* @param cloc Handle to C locale data.
|
|
|
|
* @param table If non-zero, table is used as the per-char mask.
|
|
|
|
* @param del If true, passes ownership of table to this facet.
|
|
|
|
* @param refs Passed to the base facet class.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
explicit
|
|
|
|
ctype(__c_locale __cloc, const mask* __table = 0, bool __del = false,
|
2001-12-13 00:16:35 +01:00
|
|
|
size_t __refs = 0);
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Test char classification.
|
|
|
|
*
|
|
|
|
* This function compares the mask table[c] to @a m.
|
|
|
|
*
|
|
|
|
* @param c The char to compare the mask of.
|
|
|
|
* @param m The mask to compare against.
|
|
|
|
* @return True if m & table[c] is true, false otherwise.
|
|
|
|
*/
|
|
|
|
inline bool
|
2000-12-14 10:07:01 +01:00
|
|
|
is(mask __m, char __c) const;
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Return a mask array.
|
|
|
|
*
|
|
|
|
* This function finds the mask for each char in the range [lo, hi) and
|
|
|
|
* successively writes it to vec. vec must have as many elements as
|
|
|
|
* the char array.
|
|
|
|
*
|
|
|
|
* @param lo Pointer to start of range.
|
|
|
|
* @param hi Pointer to end of range.
|
|
|
|
* @param vec Pointer to an array of mask storage.
|
|
|
|
* @return @a hi.
|
|
|
|
*/
|
2000-10-05 13:27:02 +02:00
|
|
|
inline const char*
|
2001-06-04 21:25:41 +02:00
|
|
|
is(const char* __lo, const char* __hi, mask* __vec) const;
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Find char matching a mask
|
|
|
|
*
|
|
|
|
* This function searches for and returns the first char in [lo,hi) for
|
|
|
|
* which is(m,char) is true.
|
|
|
|
*
|
|
|
|
* @param m The mask to compare against.
|
|
|
|
* @param lo Pointer to start of range.
|
|
|
|
* @param hi Pointer to end of range.
|
|
|
|
* @return Pointer to a matching char if found, else @a hi.
|
|
|
|
*/
|
2000-10-05 13:27:02 +02:00
|
|
|
inline const char*
|
2001-06-04 21:25:41 +02:00
|
|
|
scan_is(mask __m, const char* __lo, const char* __hi) const;
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Find char not matching a mask
|
|
|
|
*
|
|
|
|
* This function searches for and returns a pointer to the first char
|
|
|
|
* in [lo,hi) for which is(m,char) is false.
|
|
|
|
*
|
|
|
|
* @param m The mask to compare against.
|
|
|
|
* @param lo Pointer to start of range.
|
|
|
|
* @param hi Pointer to end of range.
|
|
|
|
* @return Pointer to a non-matching char if found, else @a hi.
|
|
|
|
*/
|
2000-10-05 13:27:02 +02:00
|
|
|
inline const char*
|
2001-06-04 21:25:41 +02:00
|
|
|
scan_not(mask __m, const char* __lo, const char* __hi) const;
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Convert to uppercase.
|
|
|
|
*
|
|
|
|
* This function converts the char argument to uppercase if possible.
|
|
|
|
* If not possible (for example, '2'), returns the argument.
|
|
|
|
*
|
|
|
|
* toupper() acts as if it returns ctype<char>::do_toupper(c).
|
|
|
|
* do_toupper() must always return the same result for the same input.
|
|
|
|
*
|
|
|
|
* @param c The char to convert.
|
|
|
|
* @return The uppercase char if convertible, else @a c.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
char_type
|
2003-10-21 16:22:43 +02:00
|
|
|
toupper(char_type __c) const
|
|
|
|
{ return this->do_toupper(__c); }
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Convert array to uppercase.
|
|
|
|
*
|
|
|
|
* This function converts each char in the range [lo,hi) to uppercase
|
|
|
|
* if possible. Other chars remain untouched.
|
|
|
|
*
|
|
|
|
* toupper() acts as if it returns ctype<char>:: do_toupper(lo, hi).
|
|
|
|
* do_toupper() must always return the same result for the same input.
|
|
|
|
*
|
|
|
|
* @param lo Pointer to first char in range.
|
|
|
|
* @param hi Pointer to end of range.
|
|
|
|
* @return @a hi.
|
|
|
|
*/
|
2003-10-21 16:22:43 +02:00
|
|
|
const char_type*
|
|
|
|
toupper(char_type *__lo, const char_type* __hi) const
|
|
|
|
{ return this->do_toupper(__lo, __hi); }
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Convert to lowercase.
|
|
|
|
*
|
|
|
|
* This function converts the char argument to lowercase if possible.
|
|
|
|
* If not possible (for example, '2'), returns the argument.
|
|
|
|
*
|
|
|
|
* tolower() acts as if it returns ctype<char>::do_tolower(c).
|
|
|
|
* do_tolower() must always return the same result for the same input.
|
|
|
|
*
|
|
|
|
* @param c The char to convert.
|
|
|
|
* @return The lowercase char if convertible, else @a c.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
char_type
|
2003-10-21 16:22:43 +02:00
|
|
|
tolower(char_type __c) const
|
|
|
|
{ return this->do_tolower(__c); }
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Convert array to lowercase.
|
|
|
|
*
|
|
|
|
* This function converts each char in the range [lo,hi) to lowercase
|
|
|
|
* if possible. Other chars remain untouched.
|
|
|
|
*
|
|
|
|
* tolower() acts as if it returns ctype<char>:: do_tolower(lo, hi).
|
|
|
|
* do_tolower() must always return the same result for the same input.
|
|
|
|
*
|
|
|
|
* @param lo Pointer to first char in range.
|
|
|
|
* @param hi Pointer to end of range.
|
|
|
|
* @return @a hi.
|
|
|
|
*/
|
2003-10-21 16:22:43 +02:00
|
|
|
const char_type*
|
|
|
|
tolower(char_type* __lo, const char_type* __hi) const
|
|
|
|
{ return this->do_tolower(__lo, __hi); }
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Widen char
|
|
|
|
*
|
|
|
|
* This function converts the char to char_type using the simplest
|
|
|
|
* reasonable transformation. For an underived ctype<char> facet, the
|
|
|
|
* argument will be returned unchanged.
|
|
|
|
*
|
|
|
|
* This function works as if it returns ctype<char>::do_widen(c).
|
|
|
|
* do_widen() must always return the same result for the same input.
|
|
|
|
*
|
|
|
|
* Note: this is not what you want for codepage conversions. See
|
|
|
|
* codecvt for that.
|
|
|
|
*
|
|
|
|
* @param c The char to convert.
|
|
|
|
* @return The converted character.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
char_type
|
2003-10-21 16:22:43 +02:00
|
|
|
widen(char __c) const
|
2004-02-08 05:46:42 +01:00
|
|
|
{
|
2005-02-16 00:29:52 +01:00
|
|
|
if (_M_widen_ok)
|
|
|
|
return _M_widen[static_cast<unsigned char>(__c)];
|
2003-12-16 06:39:36 +01:00
|
|
|
this->_M_widen_init();
|
ctype_noninline.h, [...] (ctype): Initialize _M_narrow, _M_widen.
2003-12-15 Jerry Quinn <jlquinn@optonline.net>
* config/os/aix/ctype_noninline.h,
config/os/bsd/freebsd/ctype_noninline.h,
config/os/bsd/netbsd/ctype_noninline.h,
config/os/djgpp/ctype_noninline.h,
config/os/generic/ctype_noninline.h,
config/os/gnu-linux/ctype_noninline.h,
config/os/hpux/ctype_noninline.h,
config/os/irix/irix5.2/ctype_noninline.h,
config/os/irix/irix6.5/ctype_noninline.h,
config/os/mingw32/ctype_noninline.h,
config/os/newlib/ctype_noninline.h,
config/os/qnx/qnx6.1/ctype_noninline.h,
config/os/solaris/solaris2.5/ctype_noninline.h,
config/os/solaris/solaris2.6/ctype_noninline.h,
config/os/solaris/solaris2.7/ctype_noninline.h,
config/os/vxworks/ctype_noninline.h,
config/os/windiss/ctype_noninline.h (ctype): Initialize
_M_narrow, _M_widen.
* include/bits/locale_facets.h (_M_widen, _M_widen_ok,
_M_narrow, _M_narrow_ok): New.
(widen, narrow): Use tables to bypass virtual functions.
(_M_widen_init, _M_narrow_init): New.
From-SVN: r74662
2003-12-16 02:57:03 +01:00
|
|
|
return this->do_widen(__c);
|
|
|
|
}
|
2003-10-21 16:22:43 +02:00
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Widen char array
|
|
|
|
*
|
|
|
|
* This function converts each char in the input to char using the
|
|
|
|
* simplest reasonable transformation. For an underived ctype<char>
|
|
|
|
* facet, the argument will be copied unchanged.
|
|
|
|
*
|
|
|
|
* This function works as if it returns ctype<char>::do_widen(c).
|
|
|
|
* do_widen() must always return the same result for the same input.
|
|
|
|
*
|
|
|
|
* Note: this is not what you want for codepage conversions. See
|
|
|
|
* codecvt for that.
|
|
|
|
*
|
|
|
|
* @param lo Pointer to first char in range.
|
|
|
|
* @param hi Pointer to end of range.
|
|
|
|
* @param to Pointer to the destination array.
|
|
|
|
* @return @a hi.
|
|
|
|
*/
|
2003-10-21 16:22:43 +02:00
|
|
|
const char*
|
|
|
|
widen(const char* __lo, const char* __hi, char_type* __to) const
|
ctype_noninline.h, [...] (ctype): Initialize _M_narrow, _M_widen.
2003-12-15 Jerry Quinn <jlquinn@optonline.net>
* config/os/aix/ctype_noninline.h,
config/os/bsd/freebsd/ctype_noninline.h,
config/os/bsd/netbsd/ctype_noninline.h,
config/os/djgpp/ctype_noninline.h,
config/os/generic/ctype_noninline.h,
config/os/gnu-linux/ctype_noninline.h,
config/os/hpux/ctype_noninline.h,
config/os/irix/irix5.2/ctype_noninline.h,
config/os/irix/irix6.5/ctype_noninline.h,
config/os/mingw32/ctype_noninline.h,
config/os/newlib/ctype_noninline.h,
config/os/qnx/qnx6.1/ctype_noninline.h,
config/os/solaris/solaris2.5/ctype_noninline.h,
config/os/solaris/solaris2.6/ctype_noninline.h,
config/os/solaris/solaris2.7/ctype_noninline.h,
config/os/vxworks/ctype_noninline.h,
config/os/windiss/ctype_noninline.h (ctype): Initialize
_M_narrow, _M_widen.
* include/bits/locale_facets.h (_M_widen, _M_widen_ok,
_M_narrow, _M_narrow_ok): New.
(widen, narrow): Use tables to bypass virtual functions.
(_M_widen_init, _M_narrow_init): New.
From-SVN: r74662
2003-12-16 02:57:03 +01:00
|
|
|
{
|
2003-12-16 06:39:36 +01:00
|
|
|
if (_M_widen_ok == 1)
|
|
|
|
{
|
2007-05-11 20:58:08 +02:00
|
|
|
__builtin_memcpy(__to, __lo, __hi - __lo);
|
2003-12-16 06:39:36 +01:00
|
|
|
return __hi;
|
|
|
|
}
|
2005-02-16 00:29:52 +01:00
|
|
|
if (!_M_widen_ok)
|
|
|
|
_M_widen_init();
|
ctype_noninline.h, [...] (ctype): Initialize _M_narrow, _M_widen.
2003-12-15 Jerry Quinn <jlquinn@optonline.net>
* config/os/aix/ctype_noninline.h,
config/os/bsd/freebsd/ctype_noninline.h,
config/os/bsd/netbsd/ctype_noninline.h,
config/os/djgpp/ctype_noninline.h,
config/os/generic/ctype_noninline.h,
config/os/gnu-linux/ctype_noninline.h,
config/os/hpux/ctype_noninline.h,
config/os/irix/irix5.2/ctype_noninline.h,
config/os/irix/irix6.5/ctype_noninline.h,
config/os/mingw32/ctype_noninline.h,
config/os/newlib/ctype_noninline.h,
config/os/qnx/qnx6.1/ctype_noninline.h,
config/os/solaris/solaris2.5/ctype_noninline.h,
config/os/solaris/solaris2.6/ctype_noninline.h,
config/os/solaris/solaris2.7/ctype_noninline.h,
config/os/vxworks/ctype_noninline.h,
config/os/windiss/ctype_noninline.h (ctype): Initialize
_M_narrow, _M_widen.
* include/bits/locale_facets.h (_M_widen, _M_widen_ok,
_M_narrow, _M_narrow_ok): New.
(widen, narrow): Use tables to bypass virtual functions.
(_M_widen_init, _M_narrow_init): New.
From-SVN: r74662
2003-12-16 02:57:03 +01:00
|
|
|
return this->do_widen(__lo, __hi, __to);
|
|
|
|
}
|
2003-10-21 16:22:43 +02:00
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Narrow char
|
|
|
|
*
|
|
|
|
* This function converts the char to char using the simplest
|
|
|
|
* reasonable transformation. If the conversion fails, dfault is
|
|
|
|
* returned instead. For an underived ctype<char> facet, @a c
|
|
|
|
* will be returned unchanged.
|
|
|
|
*
|
|
|
|
* This function works as if it returns ctype<char>::do_narrow(c).
|
|
|
|
* do_narrow() must always return the same result for the same input.
|
|
|
|
*
|
|
|
|
* Note: this is not what you want for codepage conversions. See
|
|
|
|
* codecvt for that.
|
|
|
|
*
|
|
|
|
* @param c The char to convert.
|
|
|
|
* @param dfault Char to return if conversion fails.
|
|
|
|
* @return The converted character.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
char
|
2003-10-21 16:22:43 +02:00
|
|
|
narrow(char_type __c, char __dfault) const
|
ctype_noninline.h, [...] (ctype): Initialize _M_narrow, _M_widen.
2003-12-15 Jerry Quinn <jlquinn@optonline.net>
* config/os/aix/ctype_noninline.h,
config/os/bsd/freebsd/ctype_noninline.h,
config/os/bsd/netbsd/ctype_noninline.h,
config/os/djgpp/ctype_noninline.h,
config/os/generic/ctype_noninline.h,
config/os/gnu-linux/ctype_noninline.h,
config/os/hpux/ctype_noninline.h,
config/os/irix/irix5.2/ctype_noninline.h,
config/os/irix/irix6.5/ctype_noninline.h,
config/os/mingw32/ctype_noninline.h,
config/os/newlib/ctype_noninline.h,
config/os/qnx/qnx6.1/ctype_noninline.h,
config/os/solaris/solaris2.5/ctype_noninline.h,
config/os/solaris/solaris2.6/ctype_noninline.h,
config/os/solaris/solaris2.7/ctype_noninline.h,
config/os/vxworks/ctype_noninline.h,
config/os/windiss/ctype_noninline.h (ctype): Initialize
_M_narrow, _M_widen.
* include/bits/locale_facets.h (_M_widen, _M_widen_ok,
_M_narrow, _M_narrow_ok): New.
(widen, narrow): Use tables to bypass virtual functions.
(_M_widen_init, _M_narrow_init): New.
From-SVN: r74662
2003-12-16 02:57:03 +01:00
|
|
|
{
|
2003-12-30 04:09:17 +01:00
|
|
|
if (_M_narrow[static_cast<unsigned char>(__c)])
|
|
|
|
return _M_narrow[static_cast<unsigned char>(__c)];
|
2003-12-16 12:00:52 +01:00
|
|
|
const char __t = do_narrow(__c, __dfault);
|
2005-02-16 00:29:52 +01:00
|
|
|
if (__t != __dfault)
|
|
|
|
_M_narrow[static_cast<unsigned char>(__c)] = __t;
|
ctype_noninline.h, [...] (ctype): Initialize _M_narrow, _M_widen.
2003-12-15 Jerry Quinn <jlquinn@optonline.net>
* config/os/aix/ctype_noninline.h,
config/os/bsd/freebsd/ctype_noninline.h,
config/os/bsd/netbsd/ctype_noninline.h,
config/os/djgpp/ctype_noninline.h,
config/os/generic/ctype_noninline.h,
config/os/gnu-linux/ctype_noninline.h,
config/os/hpux/ctype_noninline.h,
config/os/irix/irix5.2/ctype_noninline.h,
config/os/irix/irix6.5/ctype_noninline.h,
config/os/mingw32/ctype_noninline.h,
config/os/newlib/ctype_noninline.h,
config/os/qnx/qnx6.1/ctype_noninline.h,
config/os/solaris/solaris2.5/ctype_noninline.h,
config/os/solaris/solaris2.6/ctype_noninline.h,
config/os/solaris/solaris2.7/ctype_noninline.h,
config/os/vxworks/ctype_noninline.h,
config/os/windiss/ctype_noninline.h (ctype): Initialize
_M_narrow, _M_widen.
* include/bits/locale_facets.h (_M_widen, _M_widen_ok,
_M_narrow, _M_narrow_ok): New.
(widen, narrow): Use tables to bypass virtual functions.
(_M_widen_init, _M_narrow_init): New.
From-SVN: r74662
2003-12-16 02:57:03 +01:00
|
|
|
return __t;
|
|
|
|
}
|
2003-10-21 16:22:43 +02:00
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Narrow char array
|
|
|
|
*
|
|
|
|
* This function converts each char in the input to char using the
|
|
|
|
* simplest reasonable transformation and writes the results to the
|
|
|
|
* destination array. For any char in the input that cannot be
|
|
|
|
* converted, @a dfault is used instead. For an underived ctype<char>
|
|
|
|
* facet, the argument will be copied unchanged.
|
|
|
|
*
|
|
|
|
* This function works as if it returns ctype<char>::do_narrow(lo, hi,
|
|
|
|
* dfault, to). do_narrow() must always return the same result for the
|
|
|
|
* same input.
|
|
|
|
*
|
|
|
|
* Note: this is not what you want for codepage conversions. See
|
|
|
|
* codecvt for that.
|
|
|
|
*
|
|
|
|
* @param lo Pointer to start of range.
|
|
|
|
* @param hi Pointer to end of range.
|
|
|
|
* @param dfault Char to use if conversion fails.
|
|
|
|
* @param to Pointer to the destination array.
|
|
|
|
* @return @a hi.
|
|
|
|
*/
|
2003-10-21 16:22:43 +02:00
|
|
|
const char_type*
|
|
|
|
narrow(const char_type* __lo, const char_type* __hi,
|
2003-12-16 12:00:52 +01:00
|
|
|
char __dfault, char *__to) const
|
ctype_noninline.h, [...] (ctype): Initialize _M_narrow, _M_widen.
2003-12-15 Jerry Quinn <jlquinn@optonline.net>
* config/os/aix/ctype_noninline.h,
config/os/bsd/freebsd/ctype_noninline.h,
config/os/bsd/netbsd/ctype_noninline.h,
config/os/djgpp/ctype_noninline.h,
config/os/generic/ctype_noninline.h,
config/os/gnu-linux/ctype_noninline.h,
config/os/hpux/ctype_noninline.h,
config/os/irix/irix5.2/ctype_noninline.h,
config/os/irix/irix6.5/ctype_noninline.h,
config/os/mingw32/ctype_noninline.h,
config/os/newlib/ctype_noninline.h,
config/os/qnx/qnx6.1/ctype_noninline.h,
config/os/solaris/solaris2.5/ctype_noninline.h,
config/os/solaris/solaris2.6/ctype_noninline.h,
config/os/solaris/solaris2.7/ctype_noninline.h,
config/os/vxworks/ctype_noninline.h,
config/os/windiss/ctype_noninline.h (ctype): Initialize
_M_narrow, _M_widen.
* include/bits/locale_facets.h (_M_widen, _M_widen_ok,
_M_narrow, _M_narrow_ok): New.
(widen, narrow): Use tables to bypass virtual functions.
(_M_widen_init, _M_narrow_init): New.
From-SVN: r74662
2003-12-16 02:57:03 +01:00
|
|
|
{
|
2005-02-16 00:29:52 +01:00
|
|
|
if (__builtin_expect(_M_narrow_ok == 1, true))
|
2003-12-16 06:39:36 +01:00
|
|
|
{
|
2007-05-11 20:58:08 +02:00
|
|
|
__builtin_memcpy(__to, __lo, __hi - __lo);
|
2003-12-16 06:39:36 +01:00
|
|
|
return __hi;
|
|
|
|
}
|
|
|
|
if (!_M_narrow_ok)
|
|
|
|
_M_narrow_init();
|
ctype_noninline.h, [...] (ctype): Initialize _M_narrow, _M_widen.
2003-12-15 Jerry Quinn <jlquinn@optonline.net>
* config/os/aix/ctype_noninline.h,
config/os/bsd/freebsd/ctype_noninline.h,
config/os/bsd/netbsd/ctype_noninline.h,
config/os/djgpp/ctype_noninline.h,
config/os/generic/ctype_noninline.h,
config/os/gnu-linux/ctype_noninline.h,
config/os/hpux/ctype_noninline.h,
config/os/irix/irix5.2/ctype_noninline.h,
config/os/irix/irix6.5/ctype_noninline.h,
config/os/mingw32/ctype_noninline.h,
config/os/newlib/ctype_noninline.h,
config/os/qnx/qnx6.1/ctype_noninline.h,
config/os/solaris/solaris2.5/ctype_noninline.h,
config/os/solaris/solaris2.6/ctype_noninline.h,
config/os/solaris/solaris2.7/ctype_noninline.h,
config/os/vxworks/ctype_noninline.h,
config/os/windiss/ctype_noninline.h (ctype): Initialize
_M_narrow, _M_widen.
* include/bits/locale_facets.h (_M_widen, _M_widen_ok,
_M_narrow, _M_narrow_ok): New.
(widen, narrow): Use tables to bypass virtual functions.
(_M_widen_init, _M_narrow_init): New.
From-SVN: r74662
2003-12-16 02:57:03 +01:00
|
|
|
return this->do_narrow(__lo, __hi, __dfault, __to);
|
|
|
|
}
|
2003-10-21 16:22:43 +02:00
|
|
|
|
2000-10-05 13:27:02 +02:00
|
|
|
protected:
|
2003-12-19 21:44:18 +01:00
|
|
|
/// Returns a pointer to the mask table provided to the constructor, or
|
|
|
|
/// the default from classic_table() if none was provided.
|
2004-02-08 05:46:42 +01:00
|
|
|
const mask*
|
2000-10-05 13:27:02 +02:00
|
|
|
table() const throw()
|
|
|
|
{ return _M_table; }
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/// Returns a pointer to the C locale mask table.
|
2004-02-08 05:46:42 +01:00
|
|
|
static const mask*
|
2002-01-21 05:08:54 +01:00
|
|
|
classic_table() throw();
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Destructor.
|
|
|
|
*
|
|
|
|
* This function deletes table() if @a del was true in the
|
|
|
|
* constructor.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual
|
2001-12-15 08:05:04 +01:00
|
|
|
~ctype();
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Convert to uppercase.
|
|
|
|
*
|
|
|
|
* This virtual function converts the char argument to uppercase if
|
|
|
|
* possible. If not possible (for example, '2'), returns the argument.
|
|
|
|
*
|
|
|
|
* do_toupper() is a hook for a derived facet to change the behavior of
|
|
|
|
* uppercasing. do_toupper() must always return the same result for
|
|
|
|
* the same input.
|
|
|
|
*
|
|
|
|
* @param c The char to convert.
|
|
|
|
* @return The uppercase char if convertible, else @a c.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual char_type
|
2000-10-05 13:27:02 +02:00
|
|
|
do_toupper(char_type) const;
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Convert array to uppercase.
|
|
|
|
*
|
|
|
|
* This virtual function converts each char in the range [lo,hi) to
|
|
|
|
* uppercase if possible. Other chars remain untouched.
|
|
|
|
*
|
|
|
|
* do_toupper() is a hook for a derived facet to change the behavior of
|
|
|
|
* uppercasing. do_toupper() must always return the same result for
|
|
|
|
* the same input.
|
|
|
|
*
|
|
|
|
* @param lo Pointer to start of range.
|
|
|
|
* @param hi Pointer to end of range.
|
|
|
|
* @return @a hi.
|
|
|
|
*/
|
2000-10-05 13:27:02 +02:00
|
|
|
virtual const char_type*
|
2001-06-04 21:25:41 +02:00
|
|
|
do_toupper(char_type* __lo, const char_type* __hi) const;
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Convert to lowercase.
|
|
|
|
*
|
|
|
|
* This virtual function converts the char argument to lowercase if
|
|
|
|
* possible. If not possible (for example, '2'), returns the argument.
|
|
|
|
*
|
|
|
|
* do_tolower() is a hook for a derived facet to change the behavior of
|
|
|
|
* lowercasing. do_tolower() must always return the same result for
|
|
|
|
* the same input.
|
|
|
|
*
|
|
|
|
* @param c The char to convert.
|
|
|
|
* @return The lowercase char if convertible, else @a c.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual char_type
|
2000-10-05 13:27:02 +02:00
|
|
|
do_tolower(char_type) const;
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Convert array to lowercase.
|
|
|
|
*
|
|
|
|
* This virtual function converts each char in the range [lo,hi) to
|
|
|
|
* lowercase if possible. Other chars remain untouched.
|
|
|
|
*
|
|
|
|
* do_tolower() is a hook for a derived facet to change the behavior of
|
|
|
|
* lowercasing. do_tolower() must always return the same result for
|
|
|
|
* the same input.
|
|
|
|
*
|
|
|
|
* @param lo Pointer to first char in range.
|
|
|
|
* @param hi Pointer to end of range.
|
|
|
|
* @return @a hi.
|
|
|
|
*/
|
2000-10-05 13:27:02 +02:00
|
|
|
virtual const char_type*
|
2001-06-04 21:25:41 +02:00
|
|
|
do_tolower(char_type* __lo, const char_type* __hi) const;
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Widen char
|
|
|
|
*
|
|
|
|
* This virtual function converts the char to char using the simplest
|
|
|
|
* reasonable transformation. For an underived ctype<char> facet, the
|
|
|
|
* argument will be returned unchanged.
|
|
|
|
*
|
|
|
|
* do_widen() is a hook for a derived facet to change the behavior of
|
|
|
|
* widening. do_widen() must always return the same result for the
|
|
|
|
* same input.
|
|
|
|
*
|
|
|
|
* Note: this is not what you want for codepage conversions. See
|
|
|
|
* codecvt for that.
|
|
|
|
*
|
|
|
|
* @param c The char to convert.
|
|
|
|
* @return The converted character.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual char_type
|
2003-10-21 16:22:43 +02:00
|
|
|
do_widen(char __c) const
|
|
|
|
{ return __c; }
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Widen char array
|
|
|
|
*
|
|
|
|
* This function converts each char in the range [lo,hi) to char using
|
|
|
|
* the simplest reasonable transformation. For an underived
|
|
|
|
* ctype<char> facet, the argument will be copied unchanged.
|
|
|
|
*
|
|
|
|
* do_widen() is a hook for a derived facet to change the behavior of
|
|
|
|
* widening. do_widen() must always return the same result for the
|
|
|
|
* same input.
|
|
|
|
*
|
|
|
|
* Note: this is not what you want for codepage conversions. See
|
|
|
|
* codecvt for that.
|
|
|
|
*
|
|
|
|
* @param lo Pointer to start of range.
|
|
|
|
* @param hi Pointer to end of range.
|
|
|
|
* @param to Pointer to the destination array.
|
|
|
|
* @return @a hi.
|
|
|
|
*/
|
2000-10-05 13:27:02 +02:00
|
|
|
virtual const char*
|
2003-10-21 16:22:43 +02:00
|
|
|
do_widen(const char* __lo, const char* __hi, char_type* __dest) const
|
|
|
|
{
|
2007-05-11 20:58:08 +02:00
|
|
|
__builtin_memcpy(__dest, __lo, __hi - __lo);
|
2003-10-21 16:22:43 +02:00
|
|
|
return __hi;
|
|
|
|
}
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Narrow char
|
|
|
|
*
|
|
|
|
* This virtual function converts the char to char using the simplest
|
|
|
|
* reasonable transformation. If the conversion fails, dfault is
|
|
|
|
* returned instead. For an underived ctype<char> facet, @a c will be
|
|
|
|
* returned unchanged.
|
|
|
|
*
|
|
|
|
* do_narrow() is a hook for a derived facet to change the behavior of
|
|
|
|
* narrowing. do_narrow() must always return the same result for the
|
|
|
|
* same input.
|
|
|
|
*
|
|
|
|
* Note: this is not what you want for codepage conversions. See
|
|
|
|
* codecvt for that.
|
|
|
|
*
|
|
|
|
* @param c The char to convert.
|
|
|
|
* @param dfault Char to return if conversion fails.
|
|
|
|
* @return The converted char.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual char
|
2003-10-21 16:22:43 +02:00
|
|
|
do_narrow(char_type __c, char) const
|
|
|
|
{ return __c; }
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Narrow char array to char array
|
|
|
|
*
|
|
|
|
* This virtual function converts each char in the range [lo,hi) to
|
|
|
|
* char using the simplest reasonable transformation and writes the
|
|
|
|
* results to the destination array. For any char in the input that
|
|
|
|
* cannot be converted, @a dfault is used instead. For an underived
|
|
|
|
* ctype<char> facet, the argument will be copied unchanged.
|
|
|
|
*
|
|
|
|
* do_narrow() is a hook for a derived facet to change the behavior of
|
|
|
|
* narrowing. do_narrow() must always return the same result for the
|
|
|
|
* same input.
|
|
|
|
*
|
|
|
|
* Note: this is not what you want for codepage conversions. See
|
|
|
|
* codecvt for that.
|
|
|
|
*
|
|
|
|
* @param lo Pointer to start of range.
|
|
|
|
* @param hi Pointer to end of range.
|
|
|
|
* @param dfault Char to use if conversion fails.
|
|
|
|
* @param to Pointer to the destination array.
|
|
|
|
* @return @a hi.
|
|
|
|
*/
|
2000-10-05 13:27:02 +02:00
|
|
|
virtual const char_type*
|
2001-06-04 21:25:41 +02:00
|
|
|
do_narrow(const char_type* __lo, const char_type* __hi,
|
2003-10-21 16:22:43 +02:00
|
|
|
char, char* __dest) const
|
|
|
|
{
|
2007-05-11 20:58:08 +02:00
|
|
|
__builtin_memcpy(__dest, __lo, __hi - __lo);
|
2003-10-21 16:22:43 +02:00
|
|
|
return __hi;
|
|
|
|
}
|
ctype_noninline.h, [...] (ctype): Initialize _M_narrow, _M_widen.
2003-12-15 Jerry Quinn <jlquinn@optonline.net>
* config/os/aix/ctype_noninline.h,
config/os/bsd/freebsd/ctype_noninline.h,
config/os/bsd/netbsd/ctype_noninline.h,
config/os/djgpp/ctype_noninline.h,
config/os/generic/ctype_noninline.h,
config/os/gnu-linux/ctype_noninline.h,
config/os/hpux/ctype_noninline.h,
config/os/irix/irix5.2/ctype_noninline.h,
config/os/irix/irix6.5/ctype_noninline.h,
config/os/mingw32/ctype_noninline.h,
config/os/newlib/ctype_noninline.h,
config/os/qnx/qnx6.1/ctype_noninline.h,
config/os/solaris/solaris2.5/ctype_noninline.h,
config/os/solaris/solaris2.6/ctype_noninline.h,
config/os/solaris/solaris2.7/ctype_noninline.h,
config/os/vxworks/ctype_noninline.h,
config/os/windiss/ctype_noninline.h (ctype): Initialize
_M_narrow, _M_widen.
* include/bits/locale_facets.h (_M_widen, _M_widen_ok,
_M_narrow, _M_narrow_ok): New.
(widen, narrow): Use tables to bypass virtual functions.
(_M_widen_init, _M_narrow_init): New.
From-SVN: r74662
2003-12-16 02:57:03 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
void _M_widen_init() const
|
|
|
|
{
|
|
|
|
char __tmp[sizeof(_M_widen)];
|
2003-12-16 12:00:52 +01:00
|
|
|
for (size_t __i = 0; __i < sizeof(_M_widen); ++__i)
|
ctype_noninline.h, [...] (ctype): Initialize _M_narrow, _M_widen.
2003-12-15 Jerry Quinn <jlquinn@optonline.net>
* config/os/aix/ctype_noninline.h,
config/os/bsd/freebsd/ctype_noninline.h,
config/os/bsd/netbsd/ctype_noninline.h,
config/os/djgpp/ctype_noninline.h,
config/os/generic/ctype_noninline.h,
config/os/gnu-linux/ctype_noninline.h,
config/os/hpux/ctype_noninline.h,
config/os/irix/irix5.2/ctype_noninline.h,
config/os/irix/irix6.5/ctype_noninline.h,
config/os/mingw32/ctype_noninline.h,
config/os/newlib/ctype_noninline.h,
config/os/qnx/qnx6.1/ctype_noninline.h,
config/os/solaris/solaris2.5/ctype_noninline.h,
config/os/solaris/solaris2.6/ctype_noninline.h,
config/os/solaris/solaris2.7/ctype_noninline.h,
config/os/vxworks/ctype_noninline.h,
config/os/windiss/ctype_noninline.h (ctype): Initialize
_M_narrow, _M_widen.
* include/bits/locale_facets.h (_M_widen, _M_widen_ok,
_M_narrow, _M_narrow_ok): New.
(widen, narrow): Use tables to bypass virtual functions.
(_M_widen_init, _M_narrow_init): New.
From-SVN: r74662
2003-12-16 02:57:03 +01:00
|
|
|
__tmp[__i] = __i;
|
|
|
|
do_widen(__tmp, __tmp + sizeof(__tmp), _M_widen);
|
2004-02-08 05:46:42 +01:00
|
|
|
|
ctype_noninline.h, [...] (ctype): Initialize _M_narrow, _M_widen.
2003-12-15 Jerry Quinn <jlquinn@optonline.net>
* config/os/aix/ctype_noninline.h,
config/os/bsd/freebsd/ctype_noninline.h,
config/os/bsd/netbsd/ctype_noninline.h,
config/os/djgpp/ctype_noninline.h,
config/os/generic/ctype_noninline.h,
config/os/gnu-linux/ctype_noninline.h,
config/os/hpux/ctype_noninline.h,
config/os/irix/irix5.2/ctype_noninline.h,
config/os/irix/irix6.5/ctype_noninline.h,
config/os/mingw32/ctype_noninline.h,
config/os/newlib/ctype_noninline.h,
config/os/qnx/qnx6.1/ctype_noninline.h,
config/os/solaris/solaris2.5/ctype_noninline.h,
config/os/solaris/solaris2.6/ctype_noninline.h,
config/os/solaris/solaris2.7/ctype_noninline.h,
config/os/vxworks/ctype_noninline.h,
config/os/windiss/ctype_noninline.h (ctype): Initialize
_M_narrow, _M_widen.
* include/bits/locale_facets.h (_M_widen, _M_widen_ok,
_M_narrow, _M_narrow_ok): New.
(widen, narrow): Use tables to bypass virtual functions.
(_M_widen_init, _M_narrow_init): New.
From-SVN: r74662
2003-12-16 02:57:03 +01:00
|
|
|
_M_widen_ok = 1;
|
|
|
|
// Set _M_widen_ok to 2 if memcpy can't be used.
|
2007-05-11 20:58:08 +02:00
|
|
|
if (__builtin_memcmp(__tmp, _M_widen, sizeof(_M_widen)))
|
2005-02-16 00:29:52 +01:00
|
|
|
_M_widen_ok = 2;
|
ctype_noninline.h, [...] (ctype): Initialize _M_narrow, _M_widen.
2003-12-15 Jerry Quinn <jlquinn@optonline.net>
* config/os/aix/ctype_noninline.h,
config/os/bsd/freebsd/ctype_noninline.h,
config/os/bsd/netbsd/ctype_noninline.h,
config/os/djgpp/ctype_noninline.h,
config/os/generic/ctype_noninline.h,
config/os/gnu-linux/ctype_noninline.h,
config/os/hpux/ctype_noninline.h,
config/os/irix/irix5.2/ctype_noninline.h,
config/os/irix/irix6.5/ctype_noninline.h,
config/os/mingw32/ctype_noninline.h,
config/os/newlib/ctype_noninline.h,
config/os/qnx/qnx6.1/ctype_noninline.h,
config/os/solaris/solaris2.5/ctype_noninline.h,
config/os/solaris/solaris2.6/ctype_noninline.h,
config/os/solaris/solaris2.7/ctype_noninline.h,
config/os/vxworks/ctype_noninline.h,
config/os/windiss/ctype_noninline.h (ctype): Initialize
_M_narrow, _M_widen.
* include/bits/locale_facets.h (_M_widen, _M_widen_ok,
_M_narrow, _M_narrow_ok): New.
(widen, narrow): Use tables to bypass virtual functions.
(_M_widen_init, _M_narrow_init): New.
From-SVN: r74662
2003-12-16 02:57:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Fill in the narrowing cache and flag whether all values are
|
2005-02-16 00:29:52 +01:00
|
|
|
// valid or not. _M_narrow_ok is set to 2 if memcpy can't
|
|
|
|
// be used.
|
ctype_noninline.h, [...] (ctype): Initialize _M_narrow, _M_widen.
2003-12-15 Jerry Quinn <jlquinn@optonline.net>
* config/os/aix/ctype_noninline.h,
config/os/bsd/freebsd/ctype_noninline.h,
config/os/bsd/netbsd/ctype_noninline.h,
config/os/djgpp/ctype_noninline.h,
config/os/generic/ctype_noninline.h,
config/os/gnu-linux/ctype_noninline.h,
config/os/hpux/ctype_noninline.h,
config/os/irix/irix5.2/ctype_noninline.h,
config/os/irix/irix6.5/ctype_noninline.h,
config/os/mingw32/ctype_noninline.h,
config/os/newlib/ctype_noninline.h,
config/os/qnx/qnx6.1/ctype_noninline.h,
config/os/solaris/solaris2.5/ctype_noninline.h,
config/os/solaris/solaris2.6/ctype_noninline.h,
config/os/solaris/solaris2.7/ctype_noninline.h,
config/os/vxworks/ctype_noninline.h,
config/os/windiss/ctype_noninline.h (ctype): Initialize
_M_narrow, _M_widen.
* include/bits/locale_facets.h (_M_widen, _M_widen_ok,
_M_narrow, _M_narrow_ok): New.
(widen, narrow): Use tables to bypass virtual functions.
(_M_widen_init, _M_narrow_init): New.
From-SVN: r74662
2003-12-16 02:57:03 +01:00
|
|
|
void _M_narrow_init() const
|
|
|
|
{
|
|
|
|
char __tmp[sizeof(_M_narrow)];
|
2003-12-16 12:00:52 +01:00
|
|
|
for (size_t __i = 0; __i < sizeof(_M_narrow); ++__i)
|
2003-12-16 06:39:36 +01:00
|
|
|
__tmp[__i] = __i;
|
ctype_noninline.h, [...] (ctype): Initialize _M_narrow, _M_widen.
2003-12-15 Jerry Quinn <jlquinn@optonline.net>
* config/os/aix/ctype_noninline.h,
config/os/bsd/freebsd/ctype_noninline.h,
config/os/bsd/netbsd/ctype_noninline.h,
config/os/djgpp/ctype_noninline.h,
config/os/generic/ctype_noninline.h,
config/os/gnu-linux/ctype_noninline.h,
config/os/hpux/ctype_noninline.h,
config/os/irix/irix5.2/ctype_noninline.h,
config/os/irix/irix6.5/ctype_noninline.h,
config/os/mingw32/ctype_noninline.h,
config/os/newlib/ctype_noninline.h,
config/os/qnx/qnx6.1/ctype_noninline.h,
config/os/solaris/solaris2.5/ctype_noninline.h,
config/os/solaris/solaris2.6/ctype_noninline.h,
config/os/solaris/solaris2.7/ctype_noninline.h,
config/os/vxworks/ctype_noninline.h,
config/os/windiss/ctype_noninline.h (ctype): Initialize
_M_narrow, _M_widen.
* include/bits/locale_facets.h (_M_widen, _M_widen_ok,
_M_narrow, _M_narrow_ok): New.
(widen, narrow): Use tables to bypass virtual functions.
(_M_widen_init, _M_narrow_init): New.
From-SVN: r74662
2003-12-16 02:57:03 +01:00
|
|
|
do_narrow(__tmp, __tmp + sizeof(__tmp), 0, _M_narrow);
|
|
|
|
|
2005-02-16 00:29:52 +01:00
|
|
|
_M_narrow_ok = 1;
|
2007-05-11 20:58:08 +02:00
|
|
|
if (__builtin_memcmp(__tmp, _M_narrow, sizeof(_M_narrow)))
|
2005-02-16 00:29:52 +01:00
|
|
|
_M_narrow_ok = 2;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Deal with the special case of zero: renarrow with a
|
|
|
|
// different default and compare.
|
|
|
|
char __c;
|
|
|
|
do_narrow(__tmp, __tmp + 1, 1, &__c);
|
|
|
|
if (__c == 1)
|
|
|
|
_M_narrow_ok = 2;
|
|
|
|
}
|
ctype_noninline.h, [...] (ctype): Initialize _M_narrow, _M_widen.
2003-12-15 Jerry Quinn <jlquinn@optonline.net>
* config/os/aix/ctype_noninline.h,
config/os/bsd/freebsd/ctype_noninline.h,
config/os/bsd/netbsd/ctype_noninline.h,
config/os/djgpp/ctype_noninline.h,
config/os/generic/ctype_noninline.h,
config/os/gnu-linux/ctype_noninline.h,
config/os/hpux/ctype_noninline.h,
config/os/irix/irix5.2/ctype_noninline.h,
config/os/irix/irix6.5/ctype_noninline.h,
config/os/mingw32/ctype_noninline.h,
config/os/newlib/ctype_noninline.h,
config/os/qnx/qnx6.1/ctype_noninline.h,
config/os/solaris/solaris2.5/ctype_noninline.h,
config/os/solaris/solaris2.6/ctype_noninline.h,
config/os/solaris/solaris2.7/ctype_noninline.h,
config/os/vxworks/ctype_noninline.h,
config/os/windiss/ctype_noninline.h (ctype): Initialize
_M_narrow, _M_widen.
* include/bits/locale_facets.h (_M_widen, _M_widen_ok,
_M_narrow, _M_narrow_ok): New.
(widen, narrow): Use tables to bypass virtual functions.
(_M_widen_init, _M_narrow_init): New.
From-SVN: r74662
2003-12-16 02:57:03 +01:00
|
|
|
}
|
2000-10-05 13:27:02 +02:00
|
|
|
};
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2000-10-05 13:27:02 +02:00
|
|
|
template<>
|
|
|
|
const ctype<char>&
|
2000-10-19 01:26:22 +02:00
|
|
|
use_facet<ctype<char> >(const locale& __loc);
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2003-07-05 06:05:45 +02:00
|
|
|
#ifdef _GLIBCXX_USE_WCHAR_T
|
2001-12-13 00:16:35 +01:00
|
|
|
// 22.2.1.3 ctype<wchar_t> specialization
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief The ctype<wchar_t> specialization.
|
|
|
|
*
|
|
|
|
* This class defines classification and conversion functions for the
|
|
|
|
* wchar_t type. It gets used by wchar_t streams for many I/O operations.
|
|
|
|
* The wchar_t specialization provides a number of optimizations as well.
|
|
|
|
*
|
|
|
|
* ctype<wchar_t> inherits its public methods from
|
|
|
|
* __ctype_abstract_base<wchar_t>.
|
|
|
|
*/
|
2000-10-05 13:27:02 +02:00
|
|
|
template<>
|
2000-12-07 07:44:49 +01:00
|
|
|
class ctype<wchar_t> : public __ctype_abstract_base<wchar_t>
|
2000-10-05 13:27:02 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Types:
|
2003-12-19 21:44:18 +01:00
|
|
|
/// Typedef for the template parameter wchar_t.
|
2004-02-08 05:46:42 +01:00
|
|
|
typedef wchar_t char_type;
|
|
|
|
typedef wctype_t __wmask_type;
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2001-12-15 08:05:04 +01:00
|
|
|
protected:
|
|
|
|
__c_locale _M_c_locale_ctype;
|
|
|
|
|
2003-12-15 17:56:42 +01:00
|
|
|
// Pre-computed narrowed and widened chars.
|
|
|
|
bool _M_narrow_ok;
|
2003-12-12 20:44:17 +01:00
|
|
|
char _M_narrow[128];
|
2003-12-15 17:56:42 +01:00
|
|
|
wint_t _M_widen[1 + static_cast<unsigned char>(-1)];
|
2003-12-12 20:44:17 +01:00
|
|
|
|
2003-12-16 12:00:52 +01:00
|
|
|
// Pre-computed elements for do_is.
|
|
|
|
mask _M_bit[16];
|
|
|
|
__wmask_type _M_wmask[16];
|
|
|
|
|
2001-12-15 08:05:04 +01:00
|
|
|
public:
|
2000-10-05 13:27:02 +02:00
|
|
|
// Data Members:
|
2003-12-19 21:44:18 +01:00
|
|
|
/// The facet id for ctype<wchar_t>
|
2004-02-08 05:46:42 +01:00
|
|
|
static locale::id id;
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Constructor performs initialization.
|
|
|
|
*
|
|
|
|
* This is the constructor provided by the standard.
|
|
|
|
*
|
|
|
|
* @param refs Passed to the base facet class.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
explicit
|
2000-10-05 13:27:02 +02:00
|
|
|
ctype(size_t __refs = 0);
|
2001-12-13 00:16:35 +01:00
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Constructor performs static initialization.
|
|
|
|
*
|
|
|
|
* This constructor is used to construct the initial C locale facet.
|
|
|
|
*
|
|
|
|
* @param cloc Handle to C locale data.
|
|
|
|
* @param refs Passed to the base facet class.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
explicit
|
2001-12-13 00:16:35 +01:00
|
|
|
ctype(__c_locale __cloc, size_t __refs = 0);
|
2000-10-05 13:27:02 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
__wmask_type
|
2000-12-07 07:44:49 +01:00
|
|
|
_M_convert_to_wmask(const mask __m) const;
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/// Destructor
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual
|
2000-10-05 13:27:02 +02:00
|
|
|
~ctype();
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Test wchar_t classification.
|
|
|
|
*
|
|
|
|
* This function finds a mask M for @a c and compares it to mask @a m.
|
|
|
|
*
|
|
|
|
* do_is() is a hook for a derived facet to change the behavior of
|
|
|
|
* classifying. do_is() must always return the same result for the
|
|
|
|
* same input.
|
|
|
|
*
|
|
|
|
* @param c The wchar_t to find the mask of.
|
|
|
|
* @param m The mask to compare against.
|
|
|
|
* @return (M & m) != 0.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual bool
|
2000-10-05 13:27:02 +02:00
|
|
|
do_is(mask __m, char_type __c) const;
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Return a mask array.
|
|
|
|
*
|
|
|
|
* This function finds the mask for each wchar_t in the range [lo,hi)
|
|
|
|
* and successively writes it to vec. vec must have as many elements
|
|
|
|
* as the input.
|
|
|
|
*
|
|
|
|
* do_is() is a hook for a derived facet to change the behavior of
|
|
|
|
* classifying. do_is() must always return the same result for the
|
|
|
|
* same input.
|
|
|
|
*
|
|
|
|
* @param lo Pointer to start of range.
|
|
|
|
* @param hi Pointer to end of range.
|
|
|
|
* @param vec Pointer to an array of mask storage.
|
|
|
|
* @return @a hi.
|
|
|
|
*/
|
2000-10-05 13:27:02 +02:00
|
|
|
virtual const char_type*
|
2001-06-04 21:25:41 +02:00
|
|
|
do_is(const char_type* __lo, const char_type* __hi, mask* __vec) const;
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Find wchar_t matching mask
|
|
|
|
*
|
|
|
|
* This function searches for and returns the first wchar_t c in
|
|
|
|
* [lo,hi) for which is(m,c) is true.
|
|
|
|
*
|
|
|
|
* do_scan_is() is a hook for a derived facet to change the behavior of
|
|
|
|
* match searching. do_is() must always return the same result for the
|
|
|
|
* same input.
|
|
|
|
*
|
|
|
|
* @param m The mask to compare against.
|
|
|
|
* @param lo Pointer to start of range.
|
|
|
|
* @param hi Pointer to end of range.
|
|
|
|
* @return Pointer to a matching wchar_t if found, else @a hi.
|
|
|
|
*/
|
2000-10-05 13:27:02 +02:00
|
|
|
virtual const char_type*
|
2001-06-04 21:25:41 +02:00
|
|
|
do_scan_is(mask __m, const char_type* __lo, const char_type* __hi) const;
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Find wchar_t not matching mask
|
|
|
|
*
|
|
|
|
* This function searches for and returns a pointer to the first
|
|
|
|
* wchar_t c of [lo,hi) for which is(m,c) is false.
|
|
|
|
*
|
|
|
|
* do_scan_is() is a hook for a derived facet to change the behavior of
|
|
|
|
* match searching. do_is() must always return the same result for the
|
|
|
|
* same input.
|
|
|
|
*
|
|
|
|
* @param m The mask to compare against.
|
|
|
|
* @param lo Pointer to start of range.
|
|
|
|
* @param hi Pointer to end of range.
|
|
|
|
* @return Pointer to a non-matching wchar_t if found, else @a hi.
|
|
|
|
*/
|
2000-10-05 13:27:02 +02:00
|
|
|
virtual const char_type*
|
2004-02-08 05:46:42 +01:00
|
|
|
do_scan_not(mask __m, const char_type* __lo,
|
2000-10-05 13:27:02 +02:00
|
|
|
const char_type* __hi) const;
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Convert to uppercase.
|
|
|
|
*
|
|
|
|
* This virtual function converts the wchar_t argument to uppercase if
|
|
|
|
* possible. If not possible (for example, '2'), returns the argument.
|
|
|
|
*
|
|
|
|
* do_toupper() is a hook for a derived facet to change the behavior of
|
|
|
|
* uppercasing. do_toupper() must always return the same result for
|
|
|
|
* the same input.
|
|
|
|
*
|
|
|
|
* @param c The wchar_t to convert.
|
|
|
|
* @return The uppercase wchar_t if convertible, else @a c.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual char_type
|
2000-10-05 13:27:02 +02:00
|
|
|
do_toupper(char_type) const;
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Convert array to uppercase.
|
|
|
|
*
|
|
|
|
* This virtual function converts each wchar_t in the range [lo,hi) to
|
|
|
|
* uppercase if possible. Other elements remain untouched.
|
|
|
|
*
|
|
|
|
* do_toupper() is a hook for a derived facet to change the behavior of
|
|
|
|
* uppercasing. do_toupper() must always return the same result for
|
|
|
|
* the same input.
|
|
|
|
*
|
|
|
|
* @param lo Pointer to start of range.
|
|
|
|
* @param hi Pointer to end of range.
|
|
|
|
* @return @a hi.
|
|
|
|
*/
|
2000-10-05 13:27:02 +02:00
|
|
|
virtual const char_type*
|
2001-06-04 21:25:41 +02:00
|
|
|
do_toupper(char_type* __lo, const char_type* __hi) const;
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Convert to lowercase.
|
|
|
|
*
|
|
|
|
* This virtual function converts the argument to lowercase if
|
|
|
|
* possible. If not possible (for example, '2'), returns the argument.
|
|
|
|
*
|
|
|
|
* do_tolower() is a hook for a derived facet to change the behavior of
|
|
|
|
* lowercasing. do_tolower() must always return the same result for
|
|
|
|
* the same input.
|
|
|
|
*
|
|
|
|
* @param c The wchar_t to convert.
|
|
|
|
* @return The lowercase wchar_t if convertible, else @a c.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual char_type
|
2000-10-05 13:27:02 +02:00
|
|
|
do_tolower(char_type) const;
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Convert array to lowercase.
|
|
|
|
*
|
|
|
|
* This virtual function converts each wchar_t in the range [lo,hi) to
|
|
|
|
* lowercase if possible. Other elements remain untouched.
|
|
|
|
*
|
|
|
|
* do_tolower() is a hook for a derived facet to change the behavior of
|
|
|
|
* lowercasing. do_tolower() must always return the same result for
|
|
|
|
* the same input.
|
|
|
|
*
|
|
|
|
* @param lo Pointer to start of range.
|
|
|
|
* @param hi Pointer to end of range.
|
|
|
|
* @return @a hi.
|
|
|
|
*/
|
2000-10-05 13:27:02 +02:00
|
|
|
virtual const char_type*
|
2001-06-04 21:25:41 +02:00
|
|
|
do_tolower(char_type* __lo, const char_type* __hi) const;
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Widen char to wchar_t
|
|
|
|
*
|
|
|
|
* This virtual function converts the char to wchar_t using the
|
|
|
|
* simplest reasonable transformation. For an underived ctype<wchar_t>
|
|
|
|
* facet, the argument will be cast to wchar_t.
|
|
|
|
*
|
|
|
|
* do_widen() is a hook for a derived facet to change the behavior of
|
|
|
|
* widening. do_widen() must always return the same result for the
|
|
|
|
* same input.
|
|
|
|
*
|
|
|
|
* Note: this is not what you want for codepage conversions. See
|
|
|
|
* codecvt for that.
|
|
|
|
*
|
|
|
|
* @param c The char to convert.
|
|
|
|
* @return The converted wchar_t.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual char_type
|
2000-10-05 13:27:02 +02:00
|
|
|
do_widen(char) const;
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Widen char array to wchar_t array
|
|
|
|
*
|
|
|
|
* This function converts each char in the input to wchar_t using the
|
|
|
|
* simplest reasonable transformation. For an underived ctype<wchar_t>
|
|
|
|
* facet, the argument will be copied, casting each element to wchar_t.
|
|
|
|
*
|
|
|
|
* do_widen() is a hook for a derived facet to change the behavior of
|
|
|
|
* widening. do_widen() must always return the same result for the
|
|
|
|
* same input.
|
|
|
|
*
|
|
|
|
* Note: this is not what you want for codepage conversions. See
|
|
|
|
* codecvt for that.
|
|
|
|
*
|
|
|
|
* @param lo Pointer to start range.
|
|
|
|
* @param hi Pointer to end of range.
|
|
|
|
* @param to Pointer to the destination array.
|
|
|
|
* @return @a hi.
|
|
|
|
*/
|
2000-10-05 13:27:02 +02:00
|
|
|
virtual const char*
|
2001-06-04 21:25:41 +02:00
|
|
|
do_widen(const char* __lo, const char* __hi, char_type* __dest) const;
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Narrow wchar_t to char
|
|
|
|
*
|
2004-03-24 07:41:07 +01:00
|
|
|
* This virtual function converts the argument to char using
|
|
|
|
* the simplest reasonable transformation. If the conversion
|
|
|
|
* fails, dfault is returned instead. For an underived
|
|
|
|
* ctype<wchar_t> facet, @a c will be cast to char and
|
|
|
|
* returned.
|
2003-12-19 21:44:18 +01:00
|
|
|
*
|
2004-03-24 07:41:07 +01:00
|
|
|
* do_narrow() is a hook for a derived facet to change the
|
|
|
|
* behavior of narrowing. do_narrow() must always return the
|
|
|
|
* same result for the same input.
|
2003-12-19 21:44:18 +01:00
|
|
|
*
|
|
|
|
* Note: this is not what you want for codepage conversions. See
|
|
|
|
* codecvt for that.
|
|
|
|
*
|
|
|
|
* @param c The wchar_t to convert.
|
|
|
|
* @param dfault Char to return if conversion fails.
|
|
|
|
* @return The converted char.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual char
|
2000-10-05 13:27:02 +02:00
|
|
|
do_narrow(char_type, char __dfault) const;
|
|
|
|
|
2003-12-19 21:44:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Narrow wchar_t array to char array
|
|
|
|
*
|
|
|
|
* This virtual function converts each wchar_t in the range [lo,hi) to
|
|
|
|
* char using the simplest reasonable transformation and writes the
|
|
|
|
* results to the destination array. For any wchar_t in the input that
|
|
|
|
* cannot be converted, @a dfault is used instead. For an underived
|
|
|
|
* ctype<wchar_t> facet, the argument will be copied, casting each
|
|
|
|
* element to char.
|
|
|
|
*
|
|
|
|
* do_narrow() is a hook for a derived facet to change the behavior of
|
|
|
|
* narrowing. do_narrow() must always return the same result for the
|
|
|
|
* same input.
|
|
|
|
*
|
|
|
|
* Note: this is not what you want for codepage conversions. See
|
|
|
|
* codecvt for that.
|
|
|
|
*
|
|
|
|
* @param lo Pointer to start of range.
|
|
|
|
* @param hi Pointer to end of range.
|
|
|
|
* @param dfault Char to use if conversion fails.
|
|
|
|
* @param to Pointer to the destination array.
|
|
|
|
* @return @a hi.
|
|
|
|
*/
|
2000-10-05 13:27:02 +02:00
|
|
|
virtual const char_type*
|
2001-06-04 21:25:41 +02:00
|
|
|
do_narrow(const char_type* __lo, const char_type* __hi,
|
2001-12-15 08:05:04 +01:00
|
|
|
char __dfault, char* __dest) const;
|
2003-12-12 20:44:17 +01:00
|
|
|
|
|
|
|
// For use at construction time only.
|
2004-02-08 05:46:42 +01:00
|
|
|
void
|
2003-12-12 20:44:17 +01:00
|
|
|
_M_initialize_ctype();
|
2000-10-05 13:27:02 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
template<>
|
|
|
|
const ctype<wchar_t>&
|
2000-10-19 01:26:22 +02:00
|
|
|
use_facet<ctype<wchar_t> >(const locale& __loc);
|
2003-07-05 06:05:45 +02:00
|
|
|
#endif //_GLIBCXX_USE_WCHAR_T
|
2000-10-05 13:27:02 +02:00
|
|
|
|
locale_facets.h (isspace, [...]): Add doxygen markup.
2004-11-22 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/locale_facets.h (isspace, isprint, isupper,
islower, isalpha, isdigit, ispunct, isxdigit, isalnum, isgraph,
toupper, tolower): Add doxygen markup.
(codecvt_byname, ctype_byname, numpunct_byname, collate_byname,
time_get_byname, time_put_byname, moneypunct_byname,
messages_byname): Same.
* include/std/std_fstream.h: Remove superfluous markup.
* include/std/std_sstream.h: Same.
* include/std/std_streambuf.h: Same.
* include/ext/enc_filebuf.h: Adjust markup.
* include/ext/stdio_filebuf.h: Same.
* include/ext/stdio_sync_filebuf.h: Same.
* include/bits/codecvt.h: Same.
* config/os/gnu-linux/ctype_base.h: Same.
* config/locale/ieee_1003.1-2001/codecvt_specializations.h: Same.
* include/tr1/array: Add markup.
* include/tr1/tuple: Same.
* docs/doxygen/run_doxygen: Print arguments.
* docs/doxygen/user.cfg.in: Tweaks.
From-SVN: r91080
2004-11-23 10:18:41 +01:00
|
|
|
/// @brief class ctype_byname [22.2.1.2].
|
2000-10-05 13:27:02 +02:00
|
|
|
template<typename _CharT>
|
|
|
|
class ctype_byname : public ctype<_CharT>
|
|
|
|
{
|
|
|
|
public:
|
PR libstdc++/28080 (partial)
2007-02-26 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/28080 (partial)
* include/std/bitset: Do not include <istream> and <ostream>,
<ios> is enough.
* include/std/iomanip: Do not include the whole <istream>,
<ios> is enough; do not include <functional>; reformat.
* include/std/functional: Do not include <cstddef>.
* include/std/list: Do not include <bits/stl_uninitialized.h>.
* include/std/numeric: Do not include the whole <iterator> and
<bits/stl_function.h>.
* include/std/valarray: Do not include <numeric>.
* include/bits/stl_numeric.h: Include <bits/concept_check.h>.
* src/iostream-inst.cc: Include <istream>.
* include/ext/functional: Include <cstddef>.
* testsuite/util/testsuite_hooks.h: Do not include <locale>,
<ctime> is enough; qualify tm.
* testsuite/util/testsuite_hooks.cc: Qualify tm.
2007-02-26 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class ctype_byname<char>,
class ctype_byname<wchar_t>): Declare.
* src/ctype.cc (ctype_byname<wchar_t>::ctype_byname(const char*,
size_t), ctype_byname<wchar_t>::~ctype_byname): Define.
* config/locale/generic/ctype_members.cc (ctype_byname<char>::
ctype_byname(const char*, size_t), ctype_byname<char>::~ctype_byname):
Likewise.
* config/locale/gnu/ctype_members.cc (ctype_byname<char>::
ctype_byname(const char*, size_t), ctype_byname<char>::~ctype_byname):
Likewise.
* config/locale/darwin/ctype_members.cc (ctype_byname<char>::
ctype_byname(const char*, size_t), ctype_byname<char>::~ctype_byname):
Likewise.
* testsuite/22_locale/headers/locale/synopsis.cc: Remove xfail.
From-SVN: r122329
2007-02-26 10:36:39 +01:00
|
|
|
typedef typename ctype<_CharT>::mask mask;
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
explicit
|
2001-12-15 08:05:04 +01:00
|
|
|
ctype_byname(const char* __s, size_t __refs = 0);
|
2000-10-05 13:27:02 +02:00
|
|
|
|
|
|
|
protected:
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual
|
2001-12-15 08:05:04 +01:00
|
|
|
~ctype_byname() { };
|
2000-10-05 13:27:02 +02:00
|
|
|
};
|
|
|
|
|
locale_facets.h (isspace, [...]): Add doxygen markup.
2004-11-22 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/locale_facets.h (isspace, isprint, isupper,
islower, isalpha, isdigit, ispunct, isxdigit, isalnum, isgraph,
toupper, tolower): Add doxygen markup.
(codecvt_byname, ctype_byname, numpunct_byname, collate_byname,
time_get_byname, time_put_byname, moneypunct_byname,
messages_byname): Same.
* include/std/std_fstream.h: Remove superfluous markup.
* include/std/std_sstream.h: Same.
* include/std/std_streambuf.h: Same.
* include/ext/enc_filebuf.h: Adjust markup.
* include/ext/stdio_filebuf.h: Same.
* include/ext/stdio_sync_filebuf.h: Same.
* include/bits/codecvt.h: Same.
* config/os/gnu-linux/ctype_base.h: Same.
* config/locale/ieee_1003.1-2001/codecvt_specializations.h: Same.
* include/tr1/array: Add markup.
* include/tr1/tuple: Same.
* docs/doxygen/run_doxygen: Print arguments.
* docs/doxygen/user.cfg.in: Tweaks.
From-SVN: r91080
2004-11-23 10:18:41 +01:00
|
|
|
/// 22.2.1.4 Class ctype_byname specializations.
|
2000-10-05 13:27:02 +02:00
|
|
|
template<>
|
PR libstdc++/28080 (partial)
2007-02-26 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/28080 (partial)
* include/std/bitset: Do not include <istream> and <ostream>,
<ios> is enough.
* include/std/iomanip: Do not include the whole <istream>,
<ios> is enough; do not include <functional>; reformat.
* include/std/functional: Do not include <cstddef>.
* include/std/list: Do not include <bits/stl_uninitialized.h>.
* include/std/numeric: Do not include the whole <iterator> and
<bits/stl_function.h>.
* include/std/valarray: Do not include <numeric>.
* include/bits/stl_numeric.h: Include <bits/concept_check.h>.
* src/iostream-inst.cc: Include <istream>.
* include/ext/functional: Include <cstddef>.
* testsuite/util/testsuite_hooks.h: Do not include <locale>,
<ctime> is enough; qualify tm.
* testsuite/util/testsuite_hooks.cc: Qualify tm.
2007-02-26 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class ctype_byname<char>,
class ctype_byname<wchar_t>): Declare.
* src/ctype.cc (ctype_byname<wchar_t>::ctype_byname(const char*,
size_t), ctype_byname<wchar_t>::~ctype_byname): Define.
* config/locale/generic/ctype_members.cc (ctype_byname<char>::
ctype_byname(const char*, size_t), ctype_byname<char>::~ctype_byname):
Likewise.
* config/locale/gnu/ctype_members.cc (ctype_byname<char>::
ctype_byname(const char*, size_t), ctype_byname<char>::~ctype_byname):
Likewise.
* config/locale/darwin/ctype_members.cc (ctype_byname<char>::
ctype_byname(const char*, size_t), ctype_byname<char>::~ctype_byname):
Likewise.
* testsuite/22_locale/headers/locale/synopsis.cc: Remove xfail.
From-SVN: r122329
2007-02-26 10:36:39 +01:00
|
|
|
class ctype_byname<char> : public ctype<char>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit
|
|
|
|
ctype_byname(const char* __s, size_t __refs = 0);
|
2000-10-05 13:27:02 +02:00
|
|
|
|
PR libstdc++/28080 (partial)
2007-02-26 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/28080 (partial)
* include/std/bitset: Do not include <istream> and <ostream>,
<ios> is enough.
* include/std/iomanip: Do not include the whole <istream>,
<ios> is enough; do not include <functional>; reformat.
* include/std/functional: Do not include <cstddef>.
* include/std/list: Do not include <bits/stl_uninitialized.h>.
* include/std/numeric: Do not include the whole <iterator> and
<bits/stl_function.h>.
* include/std/valarray: Do not include <numeric>.
* include/bits/stl_numeric.h: Include <bits/concept_check.h>.
* src/iostream-inst.cc: Include <istream>.
* include/ext/functional: Include <cstddef>.
* testsuite/util/testsuite_hooks.h: Do not include <locale>,
<ctime> is enough; qualify tm.
* testsuite/util/testsuite_hooks.cc: Qualify tm.
2007-02-26 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class ctype_byname<char>,
class ctype_byname<wchar_t>): Declare.
* src/ctype.cc (ctype_byname<wchar_t>::ctype_byname(const char*,
size_t), ctype_byname<wchar_t>::~ctype_byname): Define.
* config/locale/generic/ctype_members.cc (ctype_byname<char>::
ctype_byname(const char*, size_t), ctype_byname<char>::~ctype_byname):
Likewise.
* config/locale/gnu/ctype_members.cc (ctype_byname<char>::
ctype_byname(const char*, size_t), ctype_byname<char>::~ctype_byname):
Likewise.
* config/locale/darwin/ctype_members.cc (ctype_byname<char>::
ctype_byname(const char*, size_t), ctype_byname<char>::~ctype_byname):
Likewise.
* testsuite/22_locale/headers/locale/synopsis.cc: Remove xfail.
From-SVN: r122329
2007-02-26 10:36:39 +01:00
|
|
|
protected:
|
|
|
|
virtual
|
|
|
|
~ctype_byname();
|
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef _GLIBCXX_USE_WCHAR_T
|
2001-12-15 08:05:04 +01:00
|
|
|
template<>
|
PR libstdc++/28080 (partial)
2007-02-26 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/28080 (partial)
* include/std/bitset: Do not include <istream> and <ostream>,
<ios> is enough.
* include/std/iomanip: Do not include the whole <istream>,
<ios> is enough; do not include <functional>; reformat.
* include/std/functional: Do not include <cstddef>.
* include/std/list: Do not include <bits/stl_uninitialized.h>.
* include/std/numeric: Do not include the whole <iterator> and
<bits/stl_function.h>.
* include/std/valarray: Do not include <numeric>.
* include/bits/stl_numeric.h: Include <bits/concept_check.h>.
* src/iostream-inst.cc: Include <istream>.
* include/ext/functional: Include <cstddef>.
* testsuite/util/testsuite_hooks.h: Do not include <locale>,
<ctime> is enough; qualify tm.
* testsuite/util/testsuite_hooks.cc: Qualify tm.
2007-02-26 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class ctype_byname<char>,
class ctype_byname<wchar_t>): Declare.
* src/ctype.cc (ctype_byname<wchar_t>::ctype_byname(const char*,
size_t), ctype_byname<wchar_t>::~ctype_byname): Define.
* config/locale/generic/ctype_members.cc (ctype_byname<char>::
ctype_byname(const char*, size_t), ctype_byname<char>::~ctype_byname):
Likewise.
* config/locale/gnu/ctype_members.cc (ctype_byname<char>::
ctype_byname(const char*, size_t), ctype_byname<char>::~ctype_byname):
Likewise.
* config/locale/darwin/ctype_members.cc (ctype_byname<char>::
ctype_byname(const char*, size_t), ctype_byname<char>::~ctype_byname):
Likewise.
* testsuite/22_locale/headers/locale/synopsis.cc: Remove xfail.
From-SVN: r122329
2007-02-26 10:36:39 +01:00
|
|
|
class ctype_byname<wchar_t> : public ctype<wchar_t>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit
|
|
|
|
ctype_byname(const char* __s, size_t __refs = 0);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual
|
|
|
|
~ctype_byname();
|
|
|
|
};
|
|
|
|
#endif
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2006-11-29 21:59:22 +01:00
|
|
|
_GLIBCXX_END_NAMESPACE
|
|
|
|
|
2006-12-06 00:24:07 +01:00
|
|
|
// Include host and configuration specific ctype inlines.
|
|
|
|
#include <bits/ctype_inline.h>
|
|
|
|
|
2006-11-29 21:59:22 +01:00
|
|
|
_GLIBCXX_BEGIN_NAMESPACE(std)
|
2000-12-22 12:03:33 +01:00
|
|
|
|
2001-12-15 08:05:04 +01:00
|
|
|
// 22.2.2 The numeric category.
|
2004-02-08 05:46:42 +01:00
|
|
|
class __num_base
|
2001-11-28 05:07:11 +01:00
|
|
|
{
|
2003-02-11 22:55:49 +01:00
|
|
|
public:
|
2003-02-18 06:45:07 +01:00
|
|
|
// NB: Code depends on the order of _S_atoms_out elements.
|
|
|
|
// Below are the indices into _S_atoms_out.
|
2004-02-08 05:46:42 +01:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
_S_ominus,
|
|
|
|
_S_oplus,
|
|
|
|
_S_ox,
|
|
|
|
_S_oX,
|
2003-05-07 07:01:59 +02:00
|
|
|
_S_odigits,
|
|
|
|
_S_odigits_end = _S_odigits + 16,
|
2004-02-08 05:46:42 +01:00
|
|
|
_S_oudigits = _S_odigits_end,
|
2003-05-07 07:01:59 +02:00
|
|
|
_S_oudigits_end = _S_oudigits + 16,
|
|
|
|
_S_oe = _S_odigits + 14, // For scientific notation, 'e'
|
|
|
|
_S_oE = _S_oudigits + 14, // For scientific notation, 'E'
|
|
|
|
_S_oend = _S_oudigits_end
|
2003-02-11 22:55:49 +01:00
|
|
|
};
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2003-02-18 06:45:07 +01:00
|
|
|
// A list of valid numeric literals for output. This array
|
|
|
|
// contains chars that will be passed through the current locale's
|
|
|
|
// ctype<_CharT>.widen() and then used to render numbers.
|
|
|
|
// For the standard "C" locale, this is
|
2003-02-11 22:55:49 +01:00
|
|
|
// "-+xX0123456789abcdef0123456789ABCDEF".
|
|
|
|
static const char* _S_atoms_out;
|
|
|
|
|
2001-11-28 05:07:11 +01:00
|
|
|
// String literal of acceptable (narrow) input, for num_get.
|
c_locale.cc (__convert_to_v(long&), [...]): Remove.
2003-12-08 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/c_locale.cc (__convert_to_v(long&),
__convert_to_v(unsigned long&), __convert_to_v(long long&),
__convert_to_v(unsigned long long&): Remove.
(__convert_to_v(float&), __convert_to_v(double&),
__convert_to_v(long double&)): Remove last unused parameter.
* config/locale/gnu/c_locale.cc: Likewise.
* include/bits/locale_facets.h: Likewise.
(num_get::_M_extract_int): Update declaration.
(class __num_base): Tweak _S_ie and _S_iE according to the
_S_atoms_in changes.
* include/bits/locale_facets.tcc (num_get::_M_extract_int):
Provide directly the final _ValueT, not a string: accumulate
the result checking for overflow at each digit.
(num_get::do_get(bool&), num_get::do_get(long&),
num_get::do_get(unsigned short&), num_get::do_get(unsigned int&),
num_get::do_get(unsigned long&), num_get::do_get(long long&),
num_get::do_get(unsigned long long&), num_get::do_get(void*&)):
Use the new _M_extract_int, simplify.
* src/locale-inst.cc (num_get::_M_extract_int(long&),
num_get::_M_extract_int(unsigned short&),
num_get::_M_extract_int(unsigned int&),
num_get::_M_extract_int(unsigned long&),
num_get::_M_extract_int(long long&),
num_get::_M_extract_int(unsigned long long&): Instantiate.
* src/locale_facets.cc (__num_base::_S_atoms_in): Reorder
the chars in the natural order: abcdefABCDEF.
From-SVN: r74423
2003-12-08 16:37:03 +01:00
|
|
|
// "-+xX0123456789abcdefABCDEF"
|
2003-02-11 22:55:49 +01:00
|
|
|
static const char* _S_atoms_in;
|
2001-11-28 05:07:11 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
_S_iminus,
|
|
|
|
_S_iplus,
|
|
|
|
_S_ix,
|
|
|
|
_S_iX,
|
2003-05-07 07:01:59 +02:00
|
|
|
_S_izero,
|
c_locale.cc (__convert_to_v(long&), [...]): Remove.
2003-12-08 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/c_locale.cc (__convert_to_v(long&),
__convert_to_v(unsigned long&), __convert_to_v(long long&),
__convert_to_v(unsigned long long&): Remove.
(__convert_to_v(float&), __convert_to_v(double&),
__convert_to_v(long double&)): Remove last unused parameter.
* config/locale/gnu/c_locale.cc: Likewise.
* include/bits/locale_facets.h: Likewise.
(num_get::_M_extract_int): Update declaration.
(class __num_base): Tweak _S_ie and _S_iE according to the
_S_atoms_in changes.
* include/bits/locale_facets.tcc (num_get::_M_extract_int):
Provide directly the final _ValueT, not a string: accumulate
the result checking for overflow at each digit.
(num_get::do_get(bool&), num_get::do_get(long&),
num_get::do_get(unsigned short&), num_get::do_get(unsigned int&),
num_get::do_get(unsigned long&), num_get::do_get(long long&),
num_get::do_get(unsigned long long&), num_get::do_get(void*&)):
Use the new _M_extract_int, simplify.
* src/locale-inst.cc (num_get::_M_extract_int(long&),
num_get::_M_extract_int(unsigned short&),
num_get::_M_extract_int(unsigned int&),
num_get::_M_extract_int(unsigned long&),
num_get::_M_extract_int(long long&),
num_get::_M_extract_int(unsigned long long&): Instantiate.
* src/locale_facets.cc (__num_base::_S_atoms_in): Reorder
the chars in the natural order: abcdefABCDEF.
From-SVN: r74423
2003-12-08 16:37:03 +01:00
|
|
|
_S_ie = _S_izero + 14,
|
|
|
|
_S_iE = _S_izero + 20,
|
2003-07-17 03:54:44 +02:00
|
|
|
_S_iend = 26
|
2001-11-28 05:07:11 +01:00
|
|
|
};
|
|
|
|
|
2002-01-23 00:09:04 +01:00
|
|
|
// num_put
|
2001-11-28 05:07:11 +01:00
|
|
|
// Construct and return valid scanf format for floating point types.
|
2003-02-06 19:08:51 +01:00
|
|
|
static void
|
|
|
|
_S_format_float(const ios_base& __io, char* __fptr, char __mod);
|
2001-11-28 05:07:11 +01:00
|
|
|
};
|
|
|
|
|
2003-06-27 09:25:38 +02:00
|
|
|
template<typename _CharT>
|
|
|
|
struct __numpunct_cache : public locale::facet
|
|
|
|
{
|
2004-02-08 05:46:42 +01:00
|
|
|
const char* _M_grouping;
|
locale_facets.h (struct __numpunct_cache): Add member _M_grouping_size, caching the length of _M_grouping.
2004-01-14 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (struct __numpunct_cache):
Add member _M_grouping_size, caching the length of _M_grouping.
(__numpunct_cache<>::_M_cache): Assign the latter.
(__verify_grouping): Move declaration...
* include/bits/locale_facets.tcc (__verify_grouping):
... here, change signature to take a const char* and a size_t
for the grouping; not a template anymore.
(__add_grouping, num_put::_M_group_int, num_put::_M_group_float):
Likewise change signature and tweak consistently.
(num_get::_M_extract_float, num_get::_M_extract_int,
num_put::_M_insert_int, num_put::_M_insert_float,
money_get::do_get(string_type&), money_get::do_put(string_type)):
Update callers.
* config/locale/generic/numeric_members.cc
(numpunct<>::_M_initialize_numpunct): Assign the new member.
* config/locale/gnu/numeric_members.cc
(numpunct<>::_M_initialize_numpunct): Likewise.
* src/locale-inst.cc (__add_grouping): Tweak signature.
(__verify_grouping): Don't instantiate, not a template anymore.
* include/bits/locale_facets.h: Rename _M_truename_len ->
_M_truename_size, _M_falsename_len -> _M_falsename_size.
* include/bits/locale_facets.tcc: Likewise.
* config/locale/generic/numeric_members.cc: Likewise.
* config/locale/gnu/numeric_members.cc: Likewise.
From-SVN: r75876
2004-01-14 20:14:39 +01:00
|
|
|
size_t _M_grouping_size;
|
2003-06-27 09:25:38 +02:00
|
|
|
bool _M_use_grouping;
|
2004-02-08 05:46:42 +01:00
|
|
|
const _CharT* _M_truename;
|
locale_facets.h (struct __numpunct_cache): Add member _M_grouping_size, caching the length of _M_grouping.
2004-01-14 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (struct __numpunct_cache):
Add member _M_grouping_size, caching the length of _M_grouping.
(__numpunct_cache<>::_M_cache): Assign the latter.
(__verify_grouping): Move declaration...
* include/bits/locale_facets.tcc (__verify_grouping):
... here, change signature to take a const char* and a size_t
for the grouping; not a template anymore.
(__add_grouping, num_put::_M_group_int, num_put::_M_group_float):
Likewise change signature and tweak consistently.
(num_get::_M_extract_float, num_get::_M_extract_int,
num_put::_M_insert_int, num_put::_M_insert_float,
money_get::do_get(string_type&), money_get::do_put(string_type)):
Update callers.
* config/locale/generic/numeric_members.cc
(numpunct<>::_M_initialize_numpunct): Assign the new member.
* config/locale/gnu/numeric_members.cc
(numpunct<>::_M_initialize_numpunct): Likewise.
* src/locale-inst.cc (__add_grouping): Tweak signature.
(__verify_grouping): Don't instantiate, not a template anymore.
* include/bits/locale_facets.h: Rename _M_truename_len ->
_M_truename_size, _M_falsename_len -> _M_falsename_size.
* include/bits/locale_facets.tcc: Likewise.
* config/locale/generic/numeric_members.cc: Likewise.
* config/locale/gnu/numeric_members.cc: Likewise.
From-SVN: r75876
2004-01-14 20:14:39 +01:00
|
|
|
size_t _M_truename_size;
|
2003-07-10 08:21:13 +02:00
|
|
|
const _CharT* _M_falsename;
|
2004-02-08 05:46:42 +01:00
|
|
|
size_t _M_falsename_size;
|
|
|
|
_CharT _M_decimal_point;
|
|
|
|
_CharT _M_thousands_sep;
|
|
|
|
|
2003-06-27 09:25:38 +02:00
|
|
|
// A list of valid numeric literals for output: in the standard
|
|
|
|
// "C" locale, this is "-+xX0123456789abcdef0123456789ABCDEF".
|
|
|
|
// This array contains the chars after having been passed
|
|
|
|
// through the current locale's ctype<_CharT>.widen().
|
2004-02-08 05:46:42 +01:00
|
|
|
_CharT _M_atoms_out[__num_base::_S_oend];
|
2003-06-27 09:25:38 +02:00
|
|
|
|
2003-07-17 03:54:44 +02:00
|
|
|
// A list of valid numeric literals for input: in the standard
|
c_locale.cc (__convert_to_v(long&), [...]): Remove.
2003-12-08 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/c_locale.cc (__convert_to_v(long&),
__convert_to_v(unsigned long&), __convert_to_v(long long&),
__convert_to_v(unsigned long long&): Remove.
(__convert_to_v(float&), __convert_to_v(double&),
__convert_to_v(long double&)): Remove last unused parameter.
* config/locale/gnu/c_locale.cc: Likewise.
* include/bits/locale_facets.h: Likewise.
(num_get::_M_extract_int): Update declaration.
(class __num_base): Tweak _S_ie and _S_iE according to the
_S_atoms_in changes.
* include/bits/locale_facets.tcc (num_get::_M_extract_int):
Provide directly the final _ValueT, not a string: accumulate
the result checking for overflow at each digit.
(num_get::do_get(bool&), num_get::do_get(long&),
num_get::do_get(unsigned short&), num_get::do_get(unsigned int&),
num_get::do_get(unsigned long&), num_get::do_get(long long&),
num_get::do_get(unsigned long long&), num_get::do_get(void*&)):
Use the new _M_extract_int, simplify.
* src/locale-inst.cc (num_get::_M_extract_int(long&),
num_get::_M_extract_int(unsigned short&),
num_get::_M_extract_int(unsigned int&),
num_get::_M_extract_int(unsigned long&),
num_get::_M_extract_int(long long&),
num_get::_M_extract_int(unsigned long long&): Instantiate.
* src/locale_facets.cc (__num_base::_S_atoms_in): Reorder
the chars in the natural order: abcdefABCDEF.
From-SVN: r74423
2003-12-08 16:37:03 +01:00
|
|
|
// "C" locale, this is "-+xX0123456789abcdefABCDEF"
|
2003-06-27 09:25:38 +02:00
|
|
|
// This array contains the chars after having been passed
|
|
|
|
// through the current locale's ctype<_CharT>.widen().
|
2004-02-08 05:46:42 +01:00
|
|
|
_CharT _M_atoms_in[__num_base::_S_iend];
|
2003-06-27 09:25:38 +02:00
|
|
|
|
|
|
|
bool _M_allocated;
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
__numpunct_cache(size_t __refs = 0) : facet(__refs),
|
locale_facets.h (struct __numpunct_cache): Add member _M_grouping_size, caching the length of _M_grouping.
2004-01-14 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (struct __numpunct_cache):
Add member _M_grouping_size, caching the length of _M_grouping.
(__numpunct_cache<>::_M_cache): Assign the latter.
(__verify_grouping): Move declaration...
* include/bits/locale_facets.tcc (__verify_grouping):
... here, change signature to take a const char* and a size_t
for the grouping; not a template anymore.
(__add_grouping, num_put::_M_group_int, num_put::_M_group_float):
Likewise change signature and tweak consistently.
(num_get::_M_extract_float, num_get::_M_extract_int,
num_put::_M_insert_int, num_put::_M_insert_float,
money_get::do_get(string_type&), money_get::do_put(string_type)):
Update callers.
* config/locale/generic/numeric_members.cc
(numpunct<>::_M_initialize_numpunct): Assign the new member.
* config/locale/gnu/numeric_members.cc
(numpunct<>::_M_initialize_numpunct): Likewise.
* src/locale-inst.cc (__add_grouping): Tweak signature.
(__verify_grouping): Don't instantiate, not a template anymore.
* include/bits/locale_facets.h: Rename _M_truename_len ->
_M_truename_size, _M_falsename_len -> _M_falsename_size.
* include/bits/locale_facets.tcc: Likewise.
* config/locale/generic/numeric_members.cc: Likewise.
* config/locale/gnu/numeric_members.cc: Likewise.
From-SVN: r75876
2004-01-14 20:14:39 +01:00
|
|
|
_M_grouping(NULL), _M_grouping_size(0), _M_use_grouping(false),
|
|
|
|
_M_truename(NULL), _M_truename_size(0), _M_falsename(NULL),
|
|
|
|
_M_falsename_size(0), _M_decimal_point(_CharT()),
|
|
|
|
_M_thousands_sep(_CharT()), _M_allocated(false)
|
2004-02-08 05:46:42 +01:00
|
|
|
{ }
|
2003-06-27 09:25:38 +02:00
|
|
|
|
|
|
|
~__numpunct_cache();
|
|
|
|
|
|
|
|
void
|
|
|
|
_M_cache(const locale& __loc);
|
2004-05-23 01:46:34 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
__numpunct_cache&
|
|
|
|
operator=(const __numpunct_cache&);
|
|
|
|
|
|
|
|
explicit
|
|
|
|
__numpunct_cache(const __numpunct_cache&);
|
2003-06-27 09:25:38 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
template<typename _CharT>
|
|
|
|
__numpunct_cache<_CharT>::~__numpunct_cache()
|
|
|
|
{
|
|
|
|
if (_M_allocated)
|
|
|
|
{
|
|
|
|
delete [] _M_grouping;
|
|
|
|
delete [] _M_truename;
|
|
|
|
delete [] _M_falsename;
|
|
|
|
}
|
|
|
|
}
|
2002-01-23 00:09:04 +01:00
|
|
|
|
2004-01-07 06:22:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Numpunct facet.
|
|
|
|
*
|
|
|
|
* This facet stores several pieces of information related to printing and
|
|
|
|
* scanning numbers, such as the decimal point character. It takes a
|
|
|
|
* template parameter specifying the char type. The numpunct facet is
|
|
|
|
* used by streams for many I/O operations involving numbers.
|
|
|
|
*
|
|
|
|
* The numpunct 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 a numpunct facet.
|
|
|
|
*/
|
2000-10-05 13:27:02 +02:00
|
|
|
template<typename _CharT>
|
2001-11-28 05:07:11 +01:00
|
|
|
class numpunct : public locale::facet
|
2000-10-05 13:27:02 +02:00
|
|
|
{
|
2001-11-28 05:07:11 +01:00
|
|
|
public:
|
2000-10-05 13:27:02 +02:00
|
|
|
// Types:
|
2004-01-07 06:22:37 +01:00
|
|
|
//@{
|
|
|
|
/// Public typedefs
|
2004-02-08 05:46:42 +01:00
|
|
|
typedef _CharT char_type;
|
|
|
|
typedef basic_string<_CharT> string_type;
|
2004-01-07 06:22:37 +01:00
|
|
|
//@}
|
2003-06-27 09:25:38 +02:00
|
|
|
typedef __numpunct_cache<_CharT> __cache_type;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
__cache_type* _M_data;
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2003-06-27 09:25:38 +02:00
|
|
|
public:
|
2004-01-07 06:22:37 +01:00
|
|
|
/// Numpunct facet id.
|
2004-02-08 05:46:42 +01:00
|
|
|
static locale::id id;
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-01-07 06:22:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Numpunct constructor.
|
|
|
|
*
|
|
|
|
* @param refs Refcount to pass to the base class.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
explicit
|
2003-06-27 09:25:38 +02:00
|
|
|
numpunct(size_t __refs = 0) : facet(__refs), _M_data(NULL)
|
|
|
|
{ _M_initialize_numpunct(); }
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-01-07 06:22:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Internal constructor. Not for general use.
|
|
|
|
*
|
|
|
|
* This is a constructor for use by the library itself to set up the
|
|
|
|
* predefined locale facets.
|
|
|
|
*
|
|
|
|
* @param cache __numpunct_cache object.
|
|
|
|
* @param refs Refcount to pass to the base class.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
explicit
|
|
|
|
numpunct(__cache_type* __cache, size_t __refs = 0)
|
2003-06-27 09:25:38 +02:00
|
|
|
: facet(__refs), _M_data(__cache)
|
2001-11-28 05:07:11 +01:00
|
|
|
{ _M_initialize_numpunct(); }
|
|
|
|
|
2004-01-07 06:22:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Internal constructor. Not for general use.
|
|
|
|
*
|
|
|
|
* This is a constructor for use by the library itself to set up new
|
|
|
|
* locales.
|
|
|
|
*
|
|
|
|
* @param cloc The "C" locale.
|
|
|
|
* @param refs Refcount to pass to the base class.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
explicit
|
|
|
|
numpunct(__c_locale __cloc, size_t __refs = 0)
|
2003-07-18 04:27:16 +02:00
|
|
|
: facet(__refs), _M_data(NULL)
|
2001-11-28 05:07:11 +01:00
|
|
|
{ _M_initialize_numpunct(__cloc); }
|
|
|
|
|
2004-01-07 06:22:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Return decimal point character.
|
|
|
|
*
|
|
|
|
* This function returns a char_type to use as a decimal point. It
|
|
|
|
* does so by returning returning
|
|
|
|
* numpunct<char_type>::do_decimal_point().
|
|
|
|
*
|
|
|
|
* @return @a char_type representing a decimal point.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
char_type
|
2001-11-28 05:07:11 +01:00
|
|
|
decimal_point() const
|
|
|
|
{ return this->do_decimal_point(); }
|
|
|
|
|
2004-01-07 06:22:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Return thousands separator character.
|
|
|
|
*
|
2004-03-24 07:41:07 +01:00
|
|
|
* This function returns a char_type to use as a thousands
|
|
|
|
* separator. It does so by returning returning
|
2004-01-07 06:22:37 +01:00
|
|
|
* numpunct<char_type>::do_thousands_sep().
|
|
|
|
*
|
|
|
|
* @return char_type representing a thousands separator.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
char_type
|
2001-11-28 05:07:11 +01:00
|
|
|
thousands_sep() const
|
|
|
|
{ return this->do_thousands_sep(); }
|
|
|
|
|
2004-01-07 06:22:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Return grouping specification.
|
|
|
|
*
|
|
|
|
* This function returns a string representing groupings for the
|
|
|
|
* integer part of a number. Groupings indicate where thousands
|
|
|
|
* separators should be inserted in the integer part of a number.
|
|
|
|
*
|
2004-03-24 07:41:07 +01:00
|
|
|
* Each char in the return string is interpret as an integer
|
|
|
|
* rather than a character. These numbers represent the number
|
|
|
|
* of digits in a group. The first char in the string
|
|
|
|
* represents the number of digits in the least significant
|
|
|
|
* group. If a char is negative, it indicates an unlimited
|
|
|
|
* number of digits for the group. If more chars from the
|
2004-01-07 06:22:37 +01:00
|
|
|
* string are required to group a number, the last char is used
|
|
|
|
* repeatedly.
|
|
|
|
*
|
2004-03-24 07:41:07 +01:00
|
|
|
* For example, if the grouping() returns "\003\002" and is
|
|
|
|
* applied to the number 123456789, this corresponds to
|
|
|
|
* 12,34,56,789. Note that if the string was "32", this would
|
|
|
|
* put more than 50 digits into the least significant group if
|
|
|
|
* the character set is ASCII.
|
2004-01-07 06:22:37 +01:00
|
|
|
*
|
|
|
|
* The string is returned by calling
|
|
|
|
* numpunct<char_type>::do_grouping().
|
|
|
|
*
|
|
|
|
* @return string representing grouping specification.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
string
|
2001-11-28 05:07:11 +01:00
|
|
|
grouping() const
|
|
|
|
{ return this->do_grouping(); }
|
|
|
|
|
2004-01-07 06:22:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Return string representation of bool true.
|
|
|
|
*
|
|
|
|
* This function returns a string_type containing the text
|
|
|
|
* representation for true bool variables. It does so by calling
|
|
|
|
* numpunct<char_type>::do_truename().
|
|
|
|
*
|
|
|
|
* @return string_type representing printed form of true.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
string_type
|
2001-11-28 05:07:11 +01:00
|
|
|
truename() const
|
|
|
|
{ return this->do_truename(); }
|
|
|
|
|
2004-01-07 06:22:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Return string representation of bool false.
|
|
|
|
*
|
|
|
|
* This function returns a string_type containing the text
|
|
|
|
* representation for false bool variables. It does so by calling
|
|
|
|
* numpunct<char_type>::do_falsename().
|
|
|
|
*
|
|
|
|
* @return string_type representing printed form of false.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
string_type
|
2001-11-28 05:07:11 +01:00
|
|
|
falsename() const
|
|
|
|
{ return this->do_falsename(); }
|
|
|
|
|
|
|
|
protected:
|
2004-01-07 06:22:37 +01:00
|
|
|
/// Destructor.
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual
|
2002-04-16 02:45:36 +02:00
|
|
|
~numpunct();
|
2001-11-28 05:07:11 +01:00
|
|
|
|
2004-01-07 06:22:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Return decimal point character.
|
|
|
|
*
|
|
|
|
* Returns a char_type to use as a decimal point. This function is a
|
|
|
|
* hook for derived classes to change the value returned.
|
|
|
|
*
|
|
|
|
* @return @a char_type representing a decimal point.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual char_type
|
2001-11-28 05:07:11 +01:00
|
|
|
do_decimal_point() const
|
2003-06-27 09:25:38 +02:00
|
|
|
{ return _M_data->_M_decimal_point; }
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-01-07 06:22:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Return thousands separator character.
|
|
|
|
*
|
|
|
|
* Returns a char_type to use as a thousands separator. This function
|
|
|
|
* is a hook for derived classes to change the value returned.
|
|
|
|
*
|
|
|
|
* @return @a char_type representing a thousands separator.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual char_type
|
2001-11-28 05:07:11 +01:00
|
|
|
do_thousands_sep() const
|
2003-06-27 09:25:38 +02:00
|
|
|
{ return _M_data->_M_thousands_sep; }
|
2001-11-28 05:07:11 +01:00
|
|
|
|
2004-01-07 06:22:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Return grouping specification.
|
|
|
|
*
|
|
|
|
* Returns a string representing groupings for the integer part of a
|
|
|
|
* number. This function is a hook for derived classes to change the
|
|
|
|
* value returned. @see grouping() for details.
|
|
|
|
*
|
|
|
|
* @return String representing grouping specification.
|
|
|
|
*/
|
2001-11-28 05:07:11 +01:00
|
|
|
virtual string
|
|
|
|
do_grouping() const
|
2003-06-27 09:25:38 +02:00
|
|
|
{ return _M_data->_M_grouping; }
|
2001-11-28 05:07:11 +01:00
|
|
|
|
2004-01-07 06:22:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Return string representation of bool true.
|
|
|
|
*
|
|
|
|
* Returns a string_type containing the text representation for true
|
|
|
|
* bool variables. This function is a hook for derived classes to
|
|
|
|
* change the value returned.
|
|
|
|
*
|
|
|
|
* @return string_type representing printed form of true.
|
|
|
|
*/
|
|
|
|
virtual string_type
|
2001-11-28 05:07:11 +01:00
|
|
|
do_truename() const
|
2003-06-27 09:25:38 +02:00
|
|
|
{ return _M_data->_M_truename; }
|
2001-11-28 05:07:11 +01:00
|
|
|
|
2004-01-07 06:22:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Return string representation of bool false.
|
|
|
|
*
|
|
|
|
* Returns a string_type containing the text representation for false
|
|
|
|
* bool variables. This function is a hook for derived classes to
|
|
|
|
* change the value returned.
|
|
|
|
*
|
|
|
|
* @return string_type representing printed form of false.
|
|
|
|
*/
|
|
|
|
virtual string_type
|
2001-11-28 05:07:11 +01:00
|
|
|
do_falsename() const
|
2003-06-27 09:25:38 +02:00
|
|
|
{ return _M_data->_M_falsename; }
|
2001-11-28 05:07:11 +01:00
|
|
|
|
|
|
|
// For use at construction time only.
|
2004-02-08 05:46:42 +01:00
|
|
|
void
|
localefwd.h (class locale): Add static member _S_num_extra_categories...
2002-10-08 Paolo Carlini <pcarlini@unitus.it>
Benjamin Kosnik <bkoz@redhat.com>
* include/bits/localefwd.h (class locale): Add static member
_S_num_extra_categories, encoding the number of additional
categories.
Change _S_num_categories to _S_categories_size.
(class locale::_Impl): Add _M_c_cats.
(class locale::_Impl::_M_names): Change to array of chars.
(class locale::_Impl::_M_check_same_name): Use
_S_extra_categories_size, tweak.
(locale::locale(const locale&, _Facet*)): Ditto.
* src/locale.cc (locale::locale(const char* )): Rewrite to deal
with the environment in a POSIX-compliant way while being thread
safe.
(locale::name()): Update to output POSIX environment strings.
* src/localename.cc
(locale::_Impl::_Impl(const _Impl&, size_t): Use
_S_categories_size_*, tweak.
(locale::_Impl::_Impl(facet**, size_t, bool)): Ditto.
(locale::_Impl::_Impl(const char*, size_t)): Name each category
individually.
(locale::_Impl::_M_replace_categories): Use strcpy.
* include/bits/locale_facets.h (numpunct::_M_initialize_numpunct):
Change default argument to NULL from _S_c_locale.
(timepunct::_M_initialize_timepunct): Same.
_S_c_locale cleanups.
* src/codecvt.c: _S_c_locale simplification.
* src/ctype.c: Same.
* src/globals.cc: Add fake_name.
* src/locale-inst.cc: Remove extra includes.
* src/locale.cc: Remove extra includes.
Add _S_extra_categories_size definition.
Correct "C" initialization.
(locale::facet::facet): Don't initialize _S_c_locale.
(locale::facet::_M_remove_reference): Adjust.
* src/localename: Use facet_vec, facet_name.
(locale::_Impl::_Impl(facet** __f, size_t __refs, bool)): Set
facet ref counts to one. Initialize _S_c_locale.
(locale::_Impl::_M_install_facet(id*, facet*)): Adjust facet ref
counts when installing unilaterally.
* config/locale/generic/c_locale.cc: Add _S_categories definition.
* config/locale/generic/c_locale.h: Add _GLIBCPP_NUM_CATEGORIES macro.
* config/locale/generic/time_members.cc: _S_c_locale cleanup.
* config/locale/gnu/c_locale.cc: Add _S_categories definition.
(_S_destroy_c_locale): Move checks against _S_c_locale here.
* config/locale/gnu/c_locale.h: Add _GLIBCPP_NUM_CATEGORIES macro.
* config/locale/gnu/ctype_members.cc: Simplify _S_destroy_c_locale
calls, _S_c_locale usage.
* config/locale/gnu/monetary_members.cc: Same, tweaks.
* config/locale/gnu/monetary_members.cc: Same.
* config/locale/gnu/time_members.cc: Same.
* config/os/gnu-linux/ctype_noninline.h: Use locale::classic().
* docs/html/22_locale/locale.html: Add bits about global locales
and "C" setlocale.
* testsuite/22_locale/facet.cc (test02): Add.
* testsuite/22_locale/static_members.cc (test02): Add.
* testsuite/22_locale/ctor_copy_dtor.cc (test04): Add.
Co-Authored-By: Benjamin Kosnik <bkoz@redhat.com>
From-SVN: r57964
2002-10-09 01:32:23 +02:00
|
|
|
_M_initialize_numpunct(__c_locale __cloc = NULL);
|
2000-10-05 13:27:02 +02:00
|
|
|
};
|
|
|
|
|
2000-12-22 12:03:33 +01:00
|
|
|
template<typename _CharT>
|
2001-11-28 05:07:11 +01:00
|
|
|
locale::id numpunct<_CharT>::id;
|
2000-12-22 12:03:33 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
template<>
|
2002-04-16 02:45:36 +02:00
|
|
|
numpunct<char>::~numpunct();
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
template<>
|
2001-11-28 05:07:11 +01:00
|
|
|
void
|
|
|
|
numpunct<char>::_M_initialize_numpunct(__c_locale __cloc);
|
2001-08-18 04:53:13 +02:00
|
|
|
|
2003-07-05 06:05:45 +02:00
|
|
|
#ifdef _GLIBCXX_USE_WCHAR_T
|
2004-02-08 05:46:42 +01:00
|
|
|
template<>
|
2002-04-16 02:45:36 +02:00
|
|
|
numpunct<wchar_t>::~numpunct();
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
template<>
|
2001-11-28 05:07:11 +01:00
|
|
|
void
|
|
|
|
numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc);
|
2000-10-05 13:27:02 +02:00
|
|
|
#endif
|
|
|
|
|
locale_facets.h (isspace, [...]): Add doxygen markup.
2004-11-22 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/locale_facets.h (isspace, isprint, isupper,
islower, isalpha, isdigit, ispunct, isxdigit, isalnum, isgraph,
toupper, tolower): Add doxygen markup.
(codecvt_byname, ctype_byname, numpunct_byname, collate_byname,
time_get_byname, time_put_byname, moneypunct_byname,
messages_byname): Same.
* include/std/std_fstream.h: Remove superfluous markup.
* include/std/std_sstream.h: Same.
* include/std/std_streambuf.h: Same.
* include/ext/enc_filebuf.h: Adjust markup.
* include/ext/stdio_filebuf.h: Same.
* include/ext/stdio_sync_filebuf.h: Same.
* include/bits/codecvt.h: Same.
* config/os/gnu-linux/ctype_base.h: Same.
* config/locale/ieee_1003.1-2001/codecvt_specializations.h: Same.
* include/tr1/array: Add markup.
* include/tr1/tuple: Same.
* docs/doxygen/run_doxygen: Print arguments.
* docs/doxygen/user.cfg.in: Tweaks.
From-SVN: r91080
2004-11-23 10:18:41 +01:00
|
|
|
/// @brief class numpunct_byname [22.2.3.2].
|
2001-11-28 05:07:11 +01:00
|
|
|
template<typename _CharT>
|
|
|
|
class numpunct_byname : public numpunct<_CharT>
|
2000-10-05 13:27:02 +02:00
|
|
|
{
|
|
|
|
public:
|
2004-02-08 05:46:42 +01:00
|
|
|
typedef _CharT char_type;
|
|
|
|
typedef basic_string<_CharT> string_type;
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
explicit
|
2001-11-28 05:07:11 +01:00
|
|
|
numpunct_byname(const char* __s, size_t __refs = 0)
|
|
|
|
: numpunct<_CharT>(__refs)
|
|
|
|
{
|
2007-05-11 20:58:08 +02:00
|
|
|
if (__builtin_strcmp(__s, "C") != 0
|
|
|
|
&& __builtin_strcmp(__s, "POSIX") != 0)
|
2003-10-22 20:58:35 +02:00
|
|
|
{
|
|
|
|
__c_locale __tmp;
|
|
|
|
this->_S_create_c_locale(__tmp, __s);
|
2004-02-08 05:46:42 +01:00
|
|
|
this->_M_initialize_numpunct(__tmp);
|
|
|
|
this->_S_destroy_c_locale(__tmp);
|
2003-10-22 20:58:35 +02:00
|
|
|
}
|
2001-11-28 05:07:11 +01:00
|
|
|
}
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2001-11-28 05:07:11 +01:00
|
|
|
protected:
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual
|
|
|
|
~numpunct_byname() { }
|
2000-10-05 13:27:02 +02:00
|
|
|
};
|
|
|
|
|
configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
2006-02-07 Jakub Jelinek <jakub@redhat.com>
Benjamin Kosnik <bkoz@redhat.com>
* configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
If true, set also port_specific_symbol_files and create
as_symver_specs.
(GLIBCXX_LDBL_COMPAT): New GLIBCXX_CONDITIONAL.
* configure: Rebuilt.
* config.h.in: Rebuilt.
* config/os/gnu-linux/ldbl-extra.ver: New file.
* config/abi/pre/gnu.ver: Make sure no __float128 symbols are
exported.
* include/bits/c++config (_GLIBCXX_LONG_DOUBLE_COMPAT,
_GLIBCXX_LDBL_NAMESPACE, _GLIBCXX_BEGIN_LDBL_NAMESPACE,
_GLIBCXX_END_LDBL_NAMESPACE): Define.
* include/bits/localefwd.h: Use them to conditionally scope facets.
* include/bits/locale_facets.h: Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_get): Add __do_get method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_put): Add __do_put method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_get): Add __do_get method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_put): Add __do_put method.
* include/bits/locale_facets.tcc: Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
(std::money_get::__do_get, std::money_put::__do_put,
std::num_get::__do_get, std::num_put::__do_put): New
specializations.
* include/Makefile.am: Conditionally define
_GLIBCXX_LONG_DOUBLE_COMPAT in c++config.
* include/Makefile.in: Regenerate.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT] (_GLIBCXX_LOC_ID,
_GLIBCXX_SYNC_ID): Define, use them.
* src/compatibility-ldbl.cc: New file.
* src/complex_io.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Add compatibility
symbols.
* src/limits.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale-misc-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/istream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/ostream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/wlocale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/compatibility.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* config/locale/generic/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
Likewise.
* config/locale/gnu/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
Likewise.
* src/Makefile.am (libstdc++-symbol.ver): Append instead of
insert in the middle if port specific symbol file requests it.
(ldbl_compat_sources): New variable.
(sources): Use it.
(compatibility-ldbl.lo, compatibility-ldbl.o): New rules.
* src/Makefile.in: Rebuilt.
* testsuite/testsuite_abi.cc: Recognize GLIBCXX_LDBL_3.4,
GLIBCXX_LDBL_3.4.7, CXXABI_LDBL_1.3.
Co-Authored-By: Benjamin Kosnik <bkoz@redhat.com>
From-SVN: r110725
2006-02-07 23:23:58 +01:00
|
|
|
_GLIBCXX_BEGIN_LDBL_NAMESPACE
|
locale_facets.h (class time_base, [...]): Move...
2007-04-23 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class time_base,
struct __timepunct_cache, class __timepunct, class time_get,
class time_get_byname, class time_put, class time_put_byname,
class money_base, struct __moneypunct_cache, class moneypunct,
class moneypunct_byname, class money_get, class money_put,
struct messages_base, class messages, class messages_byname): Move...
* include/bits/locale_facets_nonio.h: ... here.
* include/bits/locale_facets.tcc
(struct __use_cache<__moneypunct_cache<> >,
__moneypunct_cache<>::_M_cache, money_get<>::_M_extract,
money_get<>::__do_get, money_get<>::do_get, money_put<>::_M_insert,
money_put<>::__do_put, money_put<>::do_put, time_get<>::do_date_order,
time_get<>::_M_extract_via_format, time_get<>::_M_extract_num,
time_get<>::_M_extract_name, time_get<>::do_get_time,
time_get<>::do_get_date, time_get<>::do_get_weekday,
time_get<>::do_get_monthname, time_get<>::do_get_year, time_put<>::put,
time_put<>::do_put): Move...
* include/bits/locale_facets_nonio.tcc: ... here.
* include/Makefile.am: Add.
* include/std/locale: Adjust includes.
* include/std/fstream: Likewise.
* include/std/istream: Likewise.
* include/std/ostream: Likewise.
* include/Makefile.in: Regenerate.
From-SVN: r124080
2007-04-23 22:26:30 +02:00
|
|
|
|
2004-01-07 06:22:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Facet for parsing number strings.
|
|
|
|
*
|
|
|
|
* This facet encapsulates the code to parse and return a number
|
|
|
|
* from a string. It is used by the istream numeric extraction
|
|
|
|
* operators.
|
|
|
|
*
|
|
|
|
* The num_get 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 num_get facet.
|
|
|
|
*/
|
2000-10-05 13:27:02 +02:00
|
|
|
template<typename _CharT, typename _InIter>
|
2004-03-24 07:41:07 +01:00
|
|
|
class num_get : public locale::facet
|
2000-10-05 13:27:02 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Types:
|
2004-01-07 06:22:37 +01:00
|
|
|
//@{
|
|
|
|
/// Public typedefs
|
2004-02-08 05:46:42 +01:00
|
|
|
typedef _CharT char_type;
|
|
|
|
typedef _InIter iter_type;
|
2004-01-07 06:22:37 +01:00
|
|
|
//@}
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-01-07 06:22:37 +01:00
|
|
|
/// Numpunct facet id.
|
2004-02-08 05:46:42 +01:00
|
|
|
static locale::id id;
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-01-07 06:22:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Constructor performs initialization.
|
|
|
|
*
|
|
|
|
* This is the constructor provided by the standard.
|
|
|
|
*
|
|
|
|
* @param refs Passed to the base facet class.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
explicit
|
2003-07-18 04:27:16 +02:00
|
|
|
num_get(size_t __refs = 0) : facet(__refs) { }
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-01-07 06:22:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Numeric parsing.
|
|
|
|
*
|
|
|
|
* Parses the input stream into the bool @a v. It does so by calling
|
2005-06-29 14:18:08 +02:00
|
|
|
* num_get::do_get().
|
2004-01-07 06:22:37 +01:00
|
|
|
*
|
2004-03-24 07:41:07 +01:00
|
|
|
* If ios_base::boolalpha is set, attempts to read
|
|
|
|
* ctype<CharT>::truename() or ctype<CharT>::falsename(). Sets
|
|
|
|
* @a v to true or false if successful. Sets err to
|
|
|
|
* ios_base::failbit if reading the string fails. Sets err to
|
|
|
|
* ios_base::eofbit if the stream is emptied.
|
2004-01-07 06:22:37 +01:00
|
|
|
*
|
|
|
|
* If ios_base::boolalpha is not set, proceeds as with reading a long,
|
|
|
|
* except if the value is 1, sets @a v to true, if the value is 0, sets
|
|
|
|
* @a v to false, and otherwise set err to ios_base::failbit.
|
|
|
|
*
|
|
|
|
* @param in Start of input stream.
|
|
|
|
* @param end End of input stream.
|
|
|
|
* @param io Source of locale and flags.
|
|
|
|
* @param err Error flags to set.
|
|
|
|
* @param v Value to format and insert.
|
|
|
|
* @return Iterator after reading.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
iter_type
|
2000-10-05 13:27:02 +02:00
|
|
|
get(iter_type __in, iter_type __end, ios_base& __io,
|
|
|
|
ios_base::iostate& __err, bool& __v) const
|
2001-11-28 05:07:11 +01:00
|
|
|
{ return this->do_get(__in, __end, __io, __err, __v); }
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-01-07 06:22:37 +01:00
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
* @brief Numeric parsing.
|
|
|
|
*
|
|
|
|
* Parses the input stream into the integral variable @a v. It does so
|
2005-06-29 14:18:08 +02:00
|
|
|
* by calling num_get::do_get().
|
2004-01-07 06:22:37 +01:00
|
|
|
*
|
|
|
|
* Parsing is affected by the flag settings in @a io.
|
|
|
|
*
|
|
|
|
* The basic parse is affected by the value of io.flags() &
|
|
|
|
* ios_base::basefield. If equal to ios_base::oct, parses like the
|
|
|
|
* scanf %o specifier. Else if equal to ios_base::hex, parses like %X
|
|
|
|
* specifier. Else if basefield equal to 0, parses like the %i
|
|
|
|
* specifier. Otherwise, parses like %d for signed and %u for unsigned
|
|
|
|
* types. The matching type length modifier is also used.
|
|
|
|
*
|
|
|
|
* Digit grouping is intrepreted according to numpunct::grouping() and
|
|
|
|
* numpunct::thousands_sep(). If the pattern of digit groups isn't
|
|
|
|
* consistent, sets err to ios_base::failbit.
|
|
|
|
*
|
|
|
|
* If parsing the string yields a valid value for @a v, @a v is set.
|
|
|
|
* Otherwise, sets err to ios_base::failbit and leaves @a v unaltered.
|
|
|
|
* Sets err to ios_base::eofbit if the stream is emptied.
|
|
|
|
*
|
|
|
|
* @param in Start of input stream.
|
|
|
|
* @param end End of input stream.
|
|
|
|
* @param io Source of locale and flags.
|
|
|
|
* @param err Error flags to set.
|
|
|
|
* @param v Value to format and insert.
|
|
|
|
* @return Iterator after reading.
|
|
|
|
*/
|
2000-10-05 13:27:02 +02:00
|
|
|
iter_type
|
2004-02-08 05:46:42 +01:00
|
|
|
get(iter_type __in, iter_type __end, ios_base& __io,
|
2000-10-05 13:27:02 +02:00
|
|
|
ios_base::iostate& __err, long& __v) const
|
2001-11-28 05:07:11 +01:00
|
|
|
{ return this->do_get(__in, __end, __io, __err, __v); }
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
iter_type
|
2000-10-05 13:27:02 +02:00
|
|
|
get(iter_type __in, iter_type __end, ios_base& __io,
|
|
|
|
ios_base::iostate& __err, unsigned short& __v) const
|
2001-11-28 05:07:11 +01:00
|
|
|
{ return this->do_get(__in, __end, __io, __err, __v); }
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
iter_type
|
2000-10-05 13:27:02 +02:00
|
|
|
get(iter_type __in, iter_type __end, ios_base& __io,
|
|
|
|
ios_base::iostate& __err, unsigned int& __v) const
|
2001-11-28 05:07:11 +01:00
|
|
|
{ return this->do_get(__in, __end, __io, __err, __v); }
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
iter_type
|
2000-10-05 13:27:02 +02:00
|
|
|
get(iter_type __in, iter_type __end, ios_base& __io,
|
|
|
|
ios_base::iostate& __err, unsigned long& __v) const
|
2001-11-28 05:07:11 +01:00
|
|
|
{ return this->do_get(__in, __end, __io, __err, __v); }
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2003-07-05 06:05:45 +02:00
|
|
|
#ifdef _GLIBCXX_USE_LONG_LONG
|
2004-02-08 05:46:42 +01:00
|
|
|
iter_type
|
2001-11-28 05:07:11 +01:00
|
|
|
get(iter_type __in, iter_type __end, ios_base& __io,
|
|
|
|
ios_base::iostate& __err, long long& __v) const
|
|
|
|
{ return this->do_get(__in, __end, __io, __err, __v); }
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
iter_type
|
2000-10-05 13:27:02 +02:00
|
|
|
get(iter_type __in, iter_type __end, ios_base& __io,
|
|
|
|
ios_base::iostate& __err, unsigned long long& __v) const
|
2001-11-28 05:07:11 +01:00
|
|
|
{ return this->do_get(__in, __end, __io, __err, __v); }
|
2000-10-05 13:27:02 +02:00
|
|
|
#endif
|
2004-01-07 06:22:37 +01:00
|
|
|
//@}
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-01-07 06:22:37 +01:00
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
* @brief Numeric parsing.
|
|
|
|
*
|
|
|
|
* Parses the input stream into the integral variable @a v. It does so
|
2005-06-29 14:18:08 +02:00
|
|
|
* by calling num_get::do_get().
|
2004-01-07 06:22:37 +01:00
|
|
|
*
|
|
|
|
* The input characters are parsed like the scanf %g specifier. The
|
|
|
|
* matching type length modifier is also used.
|
|
|
|
*
|
|
|
|
* The decimal point character used is numpunct::decimal_point().
|
|
|
|
* Digit grouping is intrepreted according to numpunct::grouping() and
|
|
|
|
* numpunct::thousands_sep(). If the pattern of digit groups isn't
|
|
|
|
* consistent, sets err to ios_base::failbit.
|
|
|
|
*
|
|
|
|
* If parsing the string yields a valid value for @a v, @a v is set.
|
|
|
|
* Otherwise, sets err to ios_base::failbit and leaves @a v unaltered.
|
|
|
|
* Sets err to ios_base::eofbit if the stream is emptied.
|
|
|
|
*
|
|
|
|
* @param in Start of input stream.
|
|
|
|
* @param end End of input stream.
|
|
|
|
* @param io Source of locale and flags.
|
|
|
|
* @param err Error flags to set.
|
|
|
|
* @param v Value to format and insert.
|
|
|
|
* @return Iterator after reading.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
iter_type
|
2000-10-05 13:27:02 +02:00
|
|
|
get(iter_type __in, iter_type __end, ios_base& __io,
|
|
|
|
ios_base::iostate& __err, float& __v) const
|
2001-11-28 05:07:11 +01:00
|
|
|
{ return this->do_get(__in, __end, __io, __err, __v); }
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
iter_type
|
2000-10-05 13:27:02 +02:00
|
|
|
get(iter_type __in, iter_type __end, ios_base& __io,
|
|
|
|
ios_base::iostate& __err, double& __v) const
|
2001-11-28 05:07:11 +01:00
|
|
|
{ return this->do_get(__in, __end, __io, __err, __v); }
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
iter_type
|
2000-10-05 13:27:02 +02:00
|
|
|
get(iter_type __in, iter_type __end, ios_base& __io,
|
|
|
|
ios_base::iostate& __err, long double& __v) const
|
2001-11-28 05:07:11 +01:00
|
|
|
{ return this->do_get(__in, __end, __io, __err, __v); }
|
2004-01-07 06:22:37 +01:00
|
|
|
//@}
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-01-07 06:22:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Numeric parsing.
|
|
|
|
*
|
|
|
|
* Parses the input stream into the pointer variable @a v. It does so
|
2005-06-29 14:18:08 +02:00
|
|
|
* by calling num_get::do_get().
|
2004-01-07 06:22:37 +01:00
|
|
|
*
|
|
|
|
* The input characters are parsed like the scanf %p specifier.
|
|
|
|
*
|
|
|
|
* Digit grouping is intrepreted according to numpunct::grouping() and
|
|
|
|
* numpunct::thousands_sep(). If the pattern of digit groups isn't
|
|
|
|
* consistent, sets err to ios_base::failbit.
|
|
|
|
*
|
|
|
|
* Note that the digit grouping effect for pointers is a bit ambiguous
|
|
|
|
* in the standard and shouldn't be relied on. See DR 344.
|
|
|
|
*
|
|
|
|
* If parsing the string yields a valid value for @a v, @a v is set.
|
|
|
|
* Otherwise, sets err to ios_base::failbit and leaves @a v unaltered.
|
|
|
|
* Sets err to ios_base::eofbit if the stream is emptied.
|
|
|
|
*
|
|
|
|
* @param in Start of input stream.
|
|
|
|
* @param end End of input stream.
|
|
|
|
* @param io Source of locale and flags.
|
|
|
|
* @param err Error flags to set.
|
|
|
|
* @param v Value to format and insert.
|
|
|
|
* @return Iterator after reading.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
iter_type
|
2000-10-05 13:27:02 +02:00
|
|
|
get(iter_type __in, iter_type __end, ios_base& __io,
|
|
|
|
ios_base::iostate& __err, void*& __v) const
|
2004-02-08 05:46:42 +01:00
|
|
|
{ return this->do_get(__in, __end, __io, __err, __v); }
|
2000-10-05 13:27:02 +02:00
|
|
|
|
|
|
|
protected:
|
2004-01-07 06:22:37 +01:00
|
|
|
/// Destructor.
|
2000-10-05 13:27:02 +02:00
|
|
|
virtual ~num_get() { }
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
iter_type
|
|
|
|
_M_extract_float(iter_type, iter_type, ios_base&, ios_base::iostate&,
|
2001-12-07 03:58:36 +01:00
|
|
|
string& __xtrc) const;
|
2001-11-28 05:07:11 +01:00
|
|
|
|
c_locale.cc (__convert_to_v(long&), [...]): Remove.
2003-12-08 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/c_locale.cc (__convert_to_v(long&),
__convert_to_v(unsigned long&), __convert_to_v(long long&),
__convert_to_v(unsigned long long&): Remove.
(__convert_to_v(float&), __convert_to_v(double&),
__convert_to_v(long double&)): Remove last unused parameter.
* config/locale/gnu/c_locale.cc: Likewise.
* include/bits/locale_facets.h: Likewise.
(num_get::_M_extract_int): Update declaration.
(class __num_base): Tweak _S_ie and _S_iE according to the
_S_atoms_in changes.
* include/bits/locale_facets.tcc (num_get::_M_extract_int):
Provide directly the final _ValueT, not a string: accumulate
the result checking for overflow at each digit.
(num_get::do_get(bool&), num_get::do_get(long&),
num_get::do_get(unsigned short&), num_get::do_get(unsigned int&),
num_get::do_get(unsigned long&), num_get::do_get(long long&),
num_get::do_get(unsigned long long&), num_get::do_get(void*&)):
Use the new _M_extract_int, simplify.
* src/locale-inst.cc (num_get::_M_extract_int(long&),
num_get::_M_extract_int(unsigned short&),
num_get::_M_extract_int(unsigned int&),
num_get::_M_extract_int(unsigned long&),
num_get::_M_extract_int(long long&),
num_get::_M_extract_int(unsigned long long&): Instantiate.
* src/locale_facets.cc (__num_base::_S_atoms_in): Reorder
the chars in the natural order: abcdefABCDEF.
From-SVN: r74423
2003-12-08 16:37:03 +01:00
|
|
|
template<typename _ValueT>
|
2004-02-08 05:46:42 +01:00
|
|
|
iter_type
|
|
|
|
_M_extract_int(iter_type, iter_type, ios_base&, ios_base::iostate&,
|
c_locale.cc (__convert_to_v(long&), [...]): Remove.
2003-12-08 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/c_locale.cc (__convert_to_v(long&),
__convert_to_v(unsigned long&), __convert_to_v(long long&),
__convert_to_v(unsigned long long&): Remove.
(__convert_to_v(float&), __convert_to_v(double&),
__convert_to_v(long double&)): Remove last unused parameter.
* config/locale/gnu/c_locale.cc: Likewise.
* include/bits/locale_facets.h: Likewise.
(num_get::_M_extract_int): Update declaration.
(class __num_base): Tweak _S_ie and _S_iE according to the
_S_atoms_in changes.
* include/bits/locale_facets.tcc (num_get::_M_extract_int):
Provide directly the final _ValueT, not a string: accumulate
the result checking for overflow at each digit.
(num_get::do_get(bool&), num_get::do_get(long&),
num_get::do_get(unsigned short&), num_get::do_get(unsigned int&),
num_get::do_get(unsigned long&), num_get::do_get(long long&),
num_get::do_get(unsigned long long&), num_get::do_get(void*&)):
Use the new _M_extract_int, simplify.
* src/locale-inst.cc (num_get::_M_extract_int(long&),
num_get::_M_extract_int(unsigned short&),
num_get::_M_extract_int(unsigned int&),
num_get::_M_extract_int(unsigned long&),
num_get::_M_extract_int(long long&),
num_get::_M_extract_int(unsigned long long&): Instantiate.
* src/locale_facets.cc (__num_base::_S_atoms_in): Reorder
the chars in the natural order: abcdefABCDEF.
From-SVN: r74423
2003-12-08 16:37:03 +01:00
|
|
|
_ValueT& __v) const;
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2006-04-29 20:16:47 +02:00
|
|
|
template<typename _CharT2>
|
2006-09-18 15:30:56 +02:00
|
|
|
typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, int>::__type
|
2006-04-29 20:16:47 +02:00
|
|
|
_M_find(const _CharT2*, size_t __len, _CharT2 __c) const
|
|
|
|
{
|
|
|
|
int __ret = -1;
|
|
|
|
if (__len <= 10)
|
|
|
|
{
|
|
|
|
if (__c >= _CharT2('0') && __c < _CharT2(_CharT2('0') + __len))
|
|
|
|
__ret = __c - _CharT2('0');
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (__c >= _CharT2('0') && __c <= _CharT2('9'))
|
|
|
|
__ret = __c - _CharT2('0');
|
|
|
|
else if (__c >= _CharT2('a') && __c <= _CharT2('f'))
|
|
|
|
__ret = 10 + (__c - _CharT2('a'));
|
|
|
|
else if (__c >= _CharT2('A') && __c <= _CharT2('F'))
|
|
|
|
__ret = 10 + (__c - _CharT2('A'));
|
|
|
|
}
|
|
|
|
return __ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _CharT2>
|
2006-09-18 15:30:56 +02:00
|
|
|
typename __gnu_cxx::__enable_if<!__is_char<_CharT2>::__value,
|
|
|
|
int>::__type
|
2006-04-29 20:16:47 +02:00
|
|
|
_M_find(const _CharT2* __zero, size_t __len, _CharT2 __c) const
|
|
|
|
{
|
|
|
|
int __ret = -1;
|
|
|
|
const char_type* __q = char_traits<_CharT2>::find(__zero, __len, __c);
|
|
|
|
if (__q)
|
|
|
|
{
|
|
|
|
__ret = __q - __zero;
|
|
|
|
if (__ret > 15)
|
|
|
|
__ret -= 6;
|
|
|
|
}
|
|
|
|
return __ret;
|
|
|
|
}
|
|
|
|
|
2004-01-07 06:22:37 +01:00
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
* @brief Numeric parsing.
|
|
|
|
*
|
|
|
|
* Parses the input stream into the variable @a v. This function is a
|
|
|
|
* hook for derived classes to change the value returned. @see get()
|
|
|
|
* for more details.
|
|
|
|
*
|
|
|
|
* @param in Start of input stream.
|
|
|
|
* @param end End of input stream.
|
|
|
|
* @param io Source of locale and flags.
|
|
|
|
* @param err Error flags to set.
|
|
|
|
* @param v Value to format and insert.
|
|
|
|
* @return Iterator after reading.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual iter_type
|
2000-10-05 13:27:02 +02:00
|
|
|
do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, bool&) const;
|
|
|
|
|
2002-07-31 04:47:36 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual iter_type
|
2001-11-28 05:07:11 +01:00
|
|
|
do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, long&) const;
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual iter_type
|
|
|
|
do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
|
2001-11-28 05:07:11 +01:00
|
|
|
unsigned short&) const;
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual iter_type
|
|
|
|
do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
|
2001-11-28 05:07:11 +01:00
|
|
|
unsigned int&) const;
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual iter_type
|
|
|
|
do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
|
2001-11-28 05:07:11 +01:00
|
|
|
unsigned long&) const;
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
#ifdef _GLIBCXX_USE_LONG_LONG
|
|
|
|
virtual iter_type
|
|
|
|
do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
|
2000-10-05 13:27:02 +02:00
|
|
|
long long&) const;
|
2001-11-28 05:07:11 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual iter_type
|
|
|
|
do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
|
2001-11-28 05:07:11 +01:00
|
|
|
unsigned long long&) const;
|
2000-10-05 13:27:02 +02:00
|
|
|
#endif
|
2001-11-28 05:07:11 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual iter_type
|
|
|
|
do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
|
2000-10-05 13:27:02 +02:00
|
|
|
float&) const;
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual iter_type
|
|
|
|
do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
|
2000-10-05 13:27:02 +02:00
|
|
|
double&) const;
|
|
|
|
|
configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
2006-02-07 Jakub Jelinek <jakub@redhat.com>
Benjamin Kosnik <bkoz@redhat.com>
* configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
If true, set also port_specific_symbol_files and create
as_symver_specs.
(GLIBCXX_LDBL_COMPAT): New GLIBCXX_CONDITIONAL.
* configure: Rebuilt.
* config.h.in: Rebuilt.
* config/os/gnu-linux/ldbl-extra.ver: New file.
* config/abi/pre/gnu.ver: Make sure no __float128 symbols are
exported.
* include/bits/c++config (_GLIBCXX_LONG_DOUBLE_COMPAT,
_GLIBCXX_LDBL_NAMESPACE, _GLIBCXX_BEGIN_LDBL_NAMESPACE,
_GLIBCXX_END_LDBL_NAMESPACE): Define.
* include/bits/localefwd.h: Use them to conditionally scope facets.
* include/bits/locale_facets.h: Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_get): Add __do_get method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_put): Add __do_put method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_get): Add __do_get method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_put): Add __do_put method.
* include/bits/locale_facets.tcc: Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
(std::money_get::__do_get, std::money_put::__do_put,
std::num_get::__do_get, std::num_put::__do_put): New
specializations.
* include/Makefile.am: Conditionally define
_GLIBCXX_LONG_DOUBLE_COMPAT in c++config.
* include/Makefile.in: Regenerate.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT] (_GLIBCXX_LOC_ID,
_GLIBCXX_SYNC_ID): Define, use them.
* src/compatibility-ldbl.cc: New file.
* src/complex_io.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Add compatibility
symbols.
* src/limits.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale-misc-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/istream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/ostream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/wlocale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/compatibility.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* config/locale/generic/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
Likewise.
* config/locale/gnu/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
Likewise.
* src/Makefile.am (libstdc++-symbol.ver): Append instead of
insert in the middle if port specific symbol file requests it.
(ldbl_compat_sources): New variable.
(sources): Use it.
(compatibility-ldbl.lo, compatibility-ldbl.o): New rules.
* src/Makefile.in: Rebuilt.
* testsuite/testsuite_abi.cc: Recognize GLIBCXX_LDBL_3.4,
GLIBCXX_LDBL_3.4.7, CXXABI_LDBL_1.3.
Co-Authored-By: Benjamin Kosnik <bkoz@redhat.com>
From-SVN: r110725
2006-02-07 23:23:58 +01:00
|
|
|
// XXX GLIBCXX_ABI Deprecated
|
|
|
|
#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
|
|
|
|
virtual iter_type
|
|
|
|
__do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
|
|
|
|
double&) const;
|
|
|
|
#else
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual iter_type
|
|
|
|
do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
|
2001-11-28 05:07:11 +01:00
|
|
|
long double&) const;
|
configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
2006-02-07 Jakub Jelinek <jakub@redhat.com>
Benjamin Kosnik <bkoz@redhat.com>
* configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
If true, set also port_specific_symbol_files and create
as_symver_specs.
(GLIBCXX_LDBL_COMPAT): New GLIBCXX_CONDITIONAL.
* configure: Rebuilt.
* config.h.in: Rebuilt.
* config/os/gnu-linux/ldbl-extra.ver: New file.
* config/abi/pre/gnu.ver: Make sure no __float128 symbols are
exported.
* include/bits/c++config (_GLIBCXX_LONG_DOUBLE_COMPAT,
_GLIBCXX_LDBL_NAMESPACE, _GLIBCXX_BEGIN_LDBL_NAMESPACE,
_GLIBCXX_END_LDBL_NAMESPACE): Define.
* include/bits/localefwd.h: Use them to conditionally scope facets.
* include/bits/locale_facets.h: Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_get): Add __do_get method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_put): Add __do_put method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_get): Add __do_get method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_put): Add __do_put method.
* include/bits/locale_facets.tcc: Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
(std::money_get::__do_get, std::money_put::__do_put,
std::num_get::__do_get, std::num_put::__do_put): New
specializations.
* include/Makefile.am: Conditionally define
_GLIBCXX_LONG_DOUBLE_COMPAT in c++config.
* include/Makefile.in: Regenerate.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT] (_GLIBCXX_LOC_ID,
_GLIBCXX_SYNC_ID): Define, use them.
* src/compatibility-ldbl.cc: New file.
* src/complex_io.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Add compatibility
symbols.
* src/limits.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale-misc-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/istream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/ostream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/wlocale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/compatibility.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* config/locale/generic/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
Likewise.
* config/locale/gnu/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
Likewise.
* src/Makefile.am (libstdc++-symbol.ver): Append instead of
insert in the middle if port specific symbol file requests it.
(ldbl_compat_sources): New variable.
(sources): Use it.
(compatibility-ldbl.lo, compatibility-ldbl.o): New rules.
* src/Makefile.in: Rebuilt.
* testsuite/testsuite_abi.cc: Recognize GLIBCXX_LDBL_3.4,
GLIBCXX_LDBL_3.4.7, CXXABI_LDBL_1.3.
Co-Authored-By: Benjamin Kosnik <bkoz@redhat.com>
From-SVN: r110725
2006-02-07 23:23:58 +01:00
|
|
|
#endif
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual iter_type
|
|
|
|
do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
|
2000-10-05 13:27:02 +02:00
|
|
|
void*&) const;
|
configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
2006-02-07 Jakub Jelinek <jakub@redhat.com>
Benjamin Kosnik <bkoz@redhat.com>
* configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
If true, set also port_specific_symbol_files and create
as_symver_specs.
(GLIBCXX_LDBL_COMPAT): New GLIBCXX_CONDITIONAL.
* configure: Rebuilt.
* config.h.in: Rebuilt.
* config/os/gnu-linux/ldbl-extra.ver: New file.
* config/abi/pre/gnu.ver: Make sure no __float128 symbols are
exported.
* include/bits/c++config (_GLIBCXX_LONG_DOUBLE_COMPAT,
_GLIBCXX_LDBL_NAMESPACE, _GLIBCXX_BEGIN_LDBL_NAMESPACE,
_GLIBCXX_END_LDBL_NAMESPACE): Define.
* include/bits/localefwd.h: Use them to conditionally scope facets.
* include/bits/locale_facets.h: Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_get): Add __do_get method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_put): Add __do_put method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_get): Add __do_get method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_put): Add __do_put method.
* include/bits/locale_facets.tcc: Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
(std::money_get::__do_get, std::money_put::__do_put,
std::num_get::__do_get, std::num_put::__do_put): New
specializations.
* include/Makefile.am: Conditionally define
_GLIBCXX_LONG_DOUBLE_COMPAT in c++config.
* include/Makefile.in: Regenerate.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT] (_GLIBCXX_LOC_ID,
_GLIBCXX_SYNC_ID): Define, use them.
* src/compatibility-ldbl.cc: New file.
* src/complex_io.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Add compatibility
symbols.
* src/limits.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale-misc-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/istream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/ostream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/wlocale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/compatibility.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* config/locale/generic/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
Likewise.
* config/locale/gnu/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
Likewise.
* src/Makefile.am (libstdc++-symbol.ver): Append instead of
insert in the middle if port specific symbol file requests it.
(ldbl_compat_sources): New variable.
(sources): Use it.
(compatibility-ldbl.lo, compatibility-ldbl.o): New rules.
* src/Makefile.in: Rebuilt.
* testsuite/testsuite_abi.cc: Recognize GLIBCXX_LDBL_3.4,
GLIBCXX_LDBL_3.4.7, CXXABI_LDBL_1.3.
Co-Authored-By: Benjamin Kosnik <bkoz@redhat.com>
From-SVN: r110725
2006-02-07 23:23:58 +01:00
|
|
|
|
|
|
|
// XXX GLIBCXX_ABI Deprecated
|
|
|
|
#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
|
|
|
|
virtual iter_type
|
|
|
|
do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
|
|
|
|
long double&) const;
|
|
|
|
#endif
|
2004-01-07 06:22:37 +01:00
|
|
|
//@}
|
2000-10-05 13:27:02 +02:00
|
|
|
};
|
|
|
|
|
2000-12-22 12:03:33 +01:00
|
|
|
template<typename _CharT, typename _InIter>
|
|
|
|
locale::id num_get<_CharT, _InIter>::id;
|
|
|
|
|
2002-07-31 04:47:36 +02:00
|
|
|
|
2004-01-07 06:22:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Facet for converting numbers to strings.
|
|
|
|
*
|
|
|
|
* This facet encapsulates the code to convert a number to a string. It is
|
|
|
|
* used by the ostream numeric insertion operators.
|
|
|
|
*
|
|
|
|
* The num_put 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 num_put facet.
|
|
|
|
*/
|
2000-10-05 13:27:02 +02:00
|
|
|
template<typename _CharT, typename _OutIter>
|
2004-03-24 07:41:07 +01:00
|
|
|
class num_put : public locale::facet
|
2000-10-05 13:27:02 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Types:
|
2004-01-07 06:22:37 +01:00
|
|
|
//@{
|
|
|
|
/// Public typedefs
|
2004-02-08 05:46:42 +01:00
|
|
|
typedef _CharT char_type;
|
|
|
|
typedef _OutIter iter_type;
|
2004-01-07 06:22:37 +01:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/// Numpunct facet id.
|
2001-09-29 01:44:48 +02:00
|
|
|
static locale::id id;
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-01-07 06:22:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Constructor performs initialization.
|
|
|
|
*
|
|
|
|
* This is the constructor provided by the standard.
|
|
|
|
*
|
|
|
|
* @param refs Passed to the base facet class.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
explicit
|
2003-07-18 04:27:16 +02:00
|
|
|
num_put(size_t __refs = 0) : facet(__refs) { }
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-01-07 06:22:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Numeric formatting.
|
|
|
|
*
|
|
|
|
* Formats the boolean @a v and inserts it into a stream. It does so
|
|
|
|
* by calling num_put::do_put().
|
|
|
|
*
|
|
|
|
* If ios_base::boolalpha is set, writes ctype<CharT>::truename() or
|
|
|
|
* ctype<CharT>::falsename(). Otherwise formats @a v as an int.
|
|
|
|
*
|
|
|
|
* @param s Stream to write to.
|
|
|
|
* @param io Source of locale and flags.
|
|
|
|
* @param fill Char_type to use for filling.
|
|
|
|
* @param v Value to format and insert.
|
|
|
|
* @return Iterator after writing.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
iter_type
|
2000-10-05 13:27:02 +02:00
|
|
|
put(iter_type __s, ios_base& __f, char_type __fill, bool __v) const
|
2001-11-28 05:07:11 +01:00
|
|
|
{ return this->do_put(__s, __f, __fill, __v); }
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-01-07 06:22:37 +01:00
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
* @brief Numeric formatting.
|
|
|
|
*
|
2004-03-24 07:41:07 +01:00
|
|
|
* Formats the integral value @a v and inserts it into a
|
|
|
|
* stream. It does so by calling num_put::do_put().
|
2004-01-07 06:22:37 +01:00
|
|
|
*
|
|
|
|
* Formatting is affected by the flag settings in @a io.
|
|
|
|
*
|
|
|
|
* The basic format is affected by the value of io.flags() &
|
|
|
|
* ios_base::basefield. If equal to ios_base::oct, formats like the
|
|
|
|
* printf %o specifier. Else if equal to ios_base::hex, formats like
|
|
|
|
* %x or %X with ios_base::uppercase unset or set respectively.
|
|
|
|
* Otherwise, formats like %d, %ld, %lld for signed and %u, %lu, %llu
|
|
|
|
* for unsigned values. Note that if both oct and hex are set, neither
|
|
|
|
* will take effect.
|
|
|
|
*
|
|
|
|
* If ios_base::showpos is set, '+' is output before positive values.
|
|
|
|
* If ios_base::showbase is set, '0' precedes octal values (except 0)
|
|
|
|
* and '0[xX]' precedes hex values.
|
|
|
|
*
|
|
|
|
* Thousands separators are inserted according to numpunct::grouping()
|
|
|
|
* and numpunct::thousands_sep(). The decimal point character used is
|
|
|
|
* numpunct::decimal_point().
|
|
|
|
*
|
|
|
|
* If io.width() is non-zero, enough @a fill characters are inserted to
|
|
|
|
* make the result at least that wide. If
|
|
|
|
* (io.flags() & ios_base::adjustfield) == ios_base::left, result is
|
|
|
|
* padded at the end. If ios_base::internal, then padding occurs
|
|
|
|
* immediately after either a '+' or '-' or after '0x' or '0X'.
|
|
|
|
* Otherwise, padding occurs at the beginning.
|
|
|
|
*
|
|
|
|
* @param s Stream to write to.
|
|
|
|
* @param io Source of locale and flags.
|
|
|
|
* @param fill Char_type to use for filling.
|
|
|
|
* @param v Value to format and insert.
|
|
|
|
* @return Iterator after writing.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
iter_type
|
2000-10-05 13:27:02 +02:00
|
|
|
put(iter_type __s, ios_base& __f, char_type __fill, long __v) const
|
2001-11-28 05:07:11 +01:00
|
|
|
{ return this->do_put(__s, __f, __fill, __v); }
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
iter_type
|
|
|
|
put(iter_type __s, ios_base& __f, char_type __fill,
|
2000-10-05 13:27:02 +02:00
|
|
|
unsigned long __v) const
|
2001-11-28 05:07:11 +01:00
|
|
|
{ return this->do_put(__s, __f, __fill, __v); }
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
#ifdef _GLIBCXX_USE_LONG_LONG
|
|
|
|
iter_type
|
2000-10-05 13:27:02 +02:00
|
|
|
put(iter_type __s, ios_base& __f, char_type __fill, long long __v) const
|
2001-11-28 05:07:11 +01:00
|
|
|
{ return this->do_put(__s, __f, __fill, __v); }
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
iter_type
|
|
|
|
put(iter_type __s, ios_base& __f, char_type __fill,
|
2000-10-05 13:27:02 +02:00
|
|
|
unsigned long long __v) const
|
2001-11-28 05:07:11 +01:00
|
|
|
{ return this->do_put(__s, __f, __fill, __v); }
|
2000-10-05 13:27:02 +02:00
|
|
|
#endif
|
2004-01-07 06:22:37 +01:00
|
|
|
//@}
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-01-07 06:22:37 +01:00
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
* @brief Numeric formatting.
|
|
|
|
*
|
|
|
|
* Formats the floating point value @a v and inserts it into a stream.
|
|
|
|
* It does so by calling num_put::do_put().
|
|
|
|
*
|
|
|
|
* Formatting is affected by the flag settings in @a io.
|
|
|
|
*
|
|
|
|
* The basic format is affected by the value of io.flags() &
|
|
|
|
* ios_base::floatfield. If equal to ios_base::fixed, formats like the
|
|
|
|
* printf %f specifier. Else if equal to ios_base::scientific, formats
|
|
|
|
* like %e or %E with ios_base::uppercase unset or set respectively.
|
|
|
|
* Otherwise, formats like %g or %G depending on uppercase. Note that
|
|
|
|
* if both fixed and scientific are set, the effect will also be like
|
|
|
|
* %g or %G.
|
|
|
|
*
|
|
|
|
* The output precision is given by io.precision(). This precision is
|
|
|
|
* capped at numeric_limits::digits10 + 2 (different for double and
|
|
|
|
* long double). The default precision is 6.
|
|
|
|
*
|
|
|
|
* If ios_base::showpos is set, '+' is output before positive values.
|
|
|
|
* If ios_base::showpoint is set, a decimal point will always be
|
|
|
|
* output.
|
|
|
|
*
|
|
|
|
* Thousands separators are inserted according to numpunct::grouping()
|
|
|
|
* and numpunct::thousands_sep(). The decimal point character used is
|
|
|
|
* numpunct::decimal_point().
|
|
|
|
*
|
|
|
|
* If io.width() is non-zero, enough @a fill characters are inserted to
|
|
|
|
* make the result at least that wide. If
|
|
|
|
* (io.flags() & ios_base::adjustfield) == ios_base::left, result is
|
|
|
|
* padded at the end. If ios_base::internal, then padding occurs
|
|
|
|
* immediately after either a '+' or '-' or after '0x' or '0X'.
|
|
|
|
* Otherwise, padding occurs at the beginning.
|
|
|
|
*
|
|
|
|
* @param s Stream to write to.
|
|
|
|
* @param io Source of locale and flags.
|
|
|
|
* @param fill Char_type to use for filling.
|
|
|
|
* @param v Value to format and insert.
|
|
|
|
* @return Iterator after writing.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
iter_type
|
2000-10-05 13:27:02 +02:00
|
|
|
put(iter_type __s, ios_base& __f, char_type __fill, double __v) const
|
2001-11-28 05:07:11 +01:00
|
|
|
{ return this->do_put(__s, __f, __fill, __v); }
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
iter_type
|
|
|
|
put(iter_type __s, ios_base& __f, char_type __fill,
|
2000-10-05 13:27:02 +02:00
|
|
|
long double __v) const
|
2001-11-28 05:07:11 +01:00
|
|
|
{ return this->do_put(__s, __f, __fill, __v); }
|
2004-01-07 06:22:37 +01:00
|
|
|
//@}
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-01-07 06:22:37 +01:00
|
|
|
/**
|
|
|
|
* @brief Numeric formatting.
|
|
|
|
*
|
|
|
|
* Formats the pointer value @a v and inserts it into a stream. It
|
|
|
|
* does so by calling num_put::do_put().
|
|
|
|
*
|
|
|
|
* This function formats @a v as an unsigned long with ios_base::hex
|
|
|
|
* and ios_base::showbase set.
|
|
|
|
*
|
|
|
|
* @param s Stream to write to.
|
|
|
|
* @param io Source of locale and flags.
|
|
|
|
* @param fill Char_type to use for filling.
|
|
|
|
* @param v Value to format and insert.
|
|
|
|
* @return Iterator after writing.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
iter_type
|
|
|
|
put(iter_type __s, ios_base& __f, char_type __fill,
|
2000-10-05 13:27:02 +02:00
|
|
|
const void* __v) const
|
2001-11-28 05:07:11 +01:00
|
|
|
{ return this->do_put(__s, __f, __fill, __v); }
|
2000-10-05 13:27:02 +02:00
|
|
|
|
|
|
|
protected:
|
2001-11-28 05:07:11 +01:00
|
|
|
template<typename _ValueT>
|
|
|
|
iter_type
|
2004-02-08 05:46:42 +01:00
|
|
|
_M_insert_float(iter_type, ios_base& __io, char_type __fill,
|
2003-07-17 03:54:44 +02:00
|
|
|
char __mod, _ValueT __v) const;
|
2001-11-28 05:07:11 +01:00
|
|
|
|
2003-02-11 22:55:49 +01:00
|
|
|
void
|
locale_facets.h (struct __numpunct_cache): Add member _M_grouping_size, caching the length of _M_grouping.
2004-01-14 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (struct __numpunct_cache):
Add member _M_grouping_size, caching the length of _M_grouping.
(__numpunct_cache<>::_M_cache): Assign the latter.
(__verify_grouping): Move declaration...
* include/bits/locale_facets.tcc (__verify_grouping):
... here, change signature to take a const char* and a size_t
for the grouping; not a template anymore.
(__add_grouping, num_put::_M_group_int, num_put::_M_group_float):
Likewise change signature and tweak consistently.
(num_get::_M_extract_float, num_get::_M_extract_int,
num_put::_M_insert_int, num_put::_M_insert_float,
money_get::do_get(string_type&), money_get::do_put(string_type)):
Update callers.
* config/locale/generic/numeric_members.cc
(numpunct<>::_M_initialize_numpunct): Assign the new member.
* config/locale/gnu/numeric_members.cc
(numpunct<>::_M_initialize_numpunct): Likewise.
* src/locale-inst.cc (__add_grouping): Tweak signature.
(__verify_grouping): Don't instantiate, not a template anymore.
* include/bits/locale_facets.h: Rename _M_truename_len ->
_M_truename_size, _M_falsename_len -> _M_falsename_size.
* include/bits/locale_facets.tcc: Likewise.
* config/locale/generic/numeric_members.cc: Likewise.
* config/locale/gnu/numeric_members.cc: Likewise.
From-SVN: r75876
2004-01-14 20:14:39 +01:00
|
|
|
_M_group_float(const char* __grouping, size_t __grouping_size,
|
|
|
|
char_type __sep, const char_type* __p, char_type* __new,
|
|
|
|
char_type* __cs, int& __len) const;
|
2003-02-11 22:55:49 +01:00
|
|
|
|
2001-11-28 05:07:11 +01:00
|
|
|
template<typename _ValueT>
|
|
|
|
iter_type
|
2004-02-08 05:46:42 +01:00
|
|
|
_M_insert_int(iter_type, ios_base& __io, char_type __fill,
|
2003-07-17 03:54:44 +02:00
|
|
|
_ValueT __v) const;
|
2001-11-28 05:07:11 +01:00
|
|
|
|
2003-02-11 22:55:49 +01:00
|
|
|
void
|
locale_facets.h (struct __numpunct_cache): Add member _M_grouping_size, caching the length of _M_grouping.
2004-01-14 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (struct __numpunct_cache):
Add member _M_grouping_size, caching the length of _M_grouping.
(__numpunct_cache<>::_M_cache): Assign the latter.
(__verify_grouping): Move declaration...
* include/bits/locale_facets.tcc (__verify_grouping):
... here, change signature to take a const char* and a size_t
for the grouping; not a template anymore.
(__add_grouping, num_put::_M_group_int, num_put::_M_group_float):
Likewise change signature and tweak consistently.
(num_get::_M_extract_float, num_get::_M_extract_int,
num_put::_M_insert_int, num_put::_M_insert_float,
money_get::do_get(string_type&), money_get::do_put(string_type)):
Update callers.
* config/locale/generic/numeric_members.cc
(numpunct<>::_M_initialize_numpunct): Assign the new member.
* config/locale/gnu/numeric_members.cc
(numpunct<>::_M_initialize_numpunct): Likewise.
* src/locale-inst.cc (__add_grouping): Tweak signature.
(__verify_grouping): Don't instantiate, not a template anymore.
* include/bits/locale_facets.h: Rename _M_truename_len ->
_M_truename_size, _M_falsename_len -> _M_falsename_size.
* include/bits/locale_facets.tcc: Likewise.
* config/locale/generic/numeric_members.cc: Likewise.
* config/locale/gnu/numeric_members.cc: Likewise.
From-SVN: r75876
2004-01-14 20:14:39 +01:00
|
|
|
_M_group_int(const char* __grouping, size_t __grouping_size,
|
|
|
|
char_type __sep, ios_base& __io, char_type* __new,
|
|
|
|
char_type* __cs, int& __len) const;
|
2001-11-28 05:07:11 +01:00
|
|
|
|
2003-02-11 22:55:49 +01:00
|
|
|
void
|
2004-02-08 05:46:42 +01:00
|
|
|
_M_pad(char_type __fill, streamsize __w, ios_base& __io,
|
2003-02-11 22:55:49 +01:00
|
|
|
char_type* __new, const char_type* __cs, int& __len) const;
|
2001-11-28 05:07:11 +01:00
|
|
|
|
2004-01-07 06:22:37 +01:00
|
|
|
/// Destructor.
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual
|
2000-10-05 13:27:02 +02:00
|
|
|
~num_put() { };
|
|
|
|
|
2004-01-07 06:22:37 +01:00
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
* @brief Numeric formatting.
|
|
|
|
*
|
|
|
|
* These functions do the work of formatting numeric values and
|
|
|
|
* inserting them into a stream. This function is a hook for derived
|
|
|
|
* classes to change the value returned.
|
|
|
|
*
|
|
|
|
* @param s Stream to write to.
|
|
|
|
* @param io Source of locale and flags.
|
|
|
|
* @param fill Char_type to use for filling.
|
|
|
|
* @param v Value to format and insert.
|
|
|
|
* @return Iterator after writing.
|
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual iter_type
|
2000-10-05 13:27:02 +02:00
|
|
|
do_put(iter_type, ios_base&, char_type __fill, bool __v) const;
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual iter_type
|
2000-10-05 13:27:02 +02:00
|
|
|
do_put(iter_type, ios_base&, char_type __fill, long __v) const;
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual iter_type
|
2001-11-28 05:07:11 +01:00
|
|
|
do_put(iter_type, ios_base&, char_type __fill, unsigned long) const;
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
#ifdef _GLIBCXX_USE_LONG_LONG
|
|
|
|
virtual iter_type
|
2001-11-28 05:07:11 +01:00
|
|
|
do_put(iter_type, ios_base&, char_type __fill, long long __v) const;
|
2000-10-05 13:27:02 +02:00
|
|
|
|
|
|
|
virtual iter_type
|
|
|
|
do_put(iter_type, ios_base&, char_type __fill, unsigned long long) const;
|
|
|
|
#endif
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual iter_type
|
2000-10-05 13:27:02 +02:00
|
|
|
do_put(iter_type, ios_base&, char_type __fill, double __v) const;
|
|
|
|
|
configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
2006-02-07 Jakub Jelinek <jakub@redhat.com>
Benjamin Kosnik <bkoz@redhat.com>
* configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
If true, set also port_specific_symbol_files and create
as_symver_specs.
(GLIBCXX_LDBL_COMPAT): New GLIBCXX_CONDITIONAL.
* configure: Rebuilt.
* config.h.in: Rebuilt.
* config/os/gnu-linux/ldbl-extra.ver: New file.
* config/abi/pre/gnu.ver: Make sure no __float128 symbols are
exported.
* include/bits/c++config (_GLIBCXX_LONG_DOUBLE_COMPAT,
_GLIBCXX_LDBL_NAMESPACE, _GLIBCXX_BEGIN_LDBL_NAMESPACE,
_GLIBCXX_END_LDBL_NAMESPACE): Define.
* include/bits/localefwd.h: Use them to conditionally scope facets.
* include/bits/locale_facets.h: Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_get): Add __do_get method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_put): Add __do_put method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_get): Add __do_get method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_put): Add __do_put method.
* include/bits/locale_facets.tcc: Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
(std::money_get::__do_get, std::money_put::__do_put,
std::num_get::__do_get, std::num_put::__do_put): New
specializations.
* include/Makefile.am: Conditionally define
_GLIBCXX_LONG_DOUBLE_COMPAT in c++config.
* include/Makefile.in: Regenerate.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT] (_GLIBCXX_LOC_ID,
_GLIBCXX_SYNC_ID): Define, use them.
* src/compatibility-ldbl.cc: New file.
* src/complex_io.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Add compatibility
symbols.
* src/limits.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale-misc-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/istream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/ostream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/wlocale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/compatibility.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* config/locale/generic/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
Likewise.
* config/locale/gnu/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
Likewise.
* src/Makefile.am (libstdc++-symbol.ver): Append instead of
insert in the middle if port specific symbol file requests it.
(ldbl_compat_sources): New variable.
(sources): Use it.
(compatibility-ldbl.lo, compatibility-ldbl.o): New rules.
* src/Makefile.in: Rebuilt.
* testsuite/testsuite_abi.cc: Recognize GLIBCXX_LDBL_3.4,
GLIBCXX_LDBL_3.4.7, CXXABI_LDBL_1.3.
Co-Authored-By: Benjamin Kosnik <bkoz@redhat.com>
From-SVN: r110725
2006-02-07 23:23:58 +01:00
|
|
|
// XXX GLIBCXX_ABI Deprecated
|
|
|
|
#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
|
|
|
|
virtual iter_type
|
|
|
|
__do_put(iter_type, ios_base&, char_type __fill, double __v) const;
|
|
|
|
#else
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual iter_type
|
2000-10-05 13:27:02 +02:00
|
|
|
do_put(iter_type, ios_base&, char_type __fill, long double __v) const;
|
configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
2006-02-07 Jakub Jelinek <jakub@redhat.com>
Benjamin Kosnik <bkoz@redhat.com>
* configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
If true, set also port_specific_symbol_files and create
as_symver_specs.
(GLIBCXX_LDBL_COMPAT): New GLIBCXX_CONDITIONAL.
* configure: Rebuilt.
* config.h.in: Rebuilt.
* config/os/gnu-linux/ldbl-extra.ver: New file.
* config/abi/pre/gnu.ver: Make sure no __float128 symbols are
exported.
* include/bits/c++config (_GLIBCXX_LONG_DOUBLE_COMPAT,
_GLIBCXX_LDBL_NAMESPACE, _GLIBCXX_BEGIN_LDBL_NAMESPACE,
_GLIBCXX_END_LDBL_NAMESPACE): Define.
* include/bits/localefwd.h: Use them to conditionally scope facets.
* include/bits/locale_facets.h: Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_get): Add __do_get method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_put): Add __do_put method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_get): Add __do_get method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_put): Add __do_put method.
* include/bits/locale_facets.tcc: Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
(std::money_get::__do_get, std::money_put::__do_put,
std::num_get::__do_get, std::num_put::__do_put): New
specializations.
* include/Makefile.am: Conditionally define
_GLIBCXX_LONG_DOUBLE_COMPAT in c++config.
* include/Makefile.in: Regenerate.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT] (_GLIBCXX_LOC_ID,
_GLIBCXX_SYNC_ID): Define, use them.
* src/compatibility-ldbl.cc: New file.
* src/complex_io.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Add compatibility
symbols.
* src/limits.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale-misc-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/istream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/ostream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/wlocale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/compatibility.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* config/locale/generic/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
Likewise.
* config/locale/gnu/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
Likewise.
* src/Makefile.am (libstdc++-symbol.ver): Append instead of
insert in the middle if port specific symbol file requests it.
(ldbl_compat_sources): New variable.
(sources): Use it.
(compatibility-ldbl.lo, compatibility-ldbl.o): New rules.
* src/Makefile.in: Rebuilt.
* testsuite/testsuite_abi.cc: Recognize GLIBCXX_LDBL_3.4,
GLIBCXX_LDBL_3.4.7, CXXABI_LDBL_1.3.
Co-Authored-By: Benjamin Kosnik <bkoz@redhat.com>
From-SVN: r110725
2006-02-07 23:23:58 +01:00
|
|
|
#endif
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
virtual iter_type
|
2000-10-05 13:27:02 +02:00
|
|
|
do_put(iter_type, ios_base&, char_type __fill, const void* __v) const;
|
configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
2006-02-07 Jakub Jelinek <jakub@redhat.com>
Benjamin Kosnik <bkoz@redhat.com>
* configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
If true, set also port_specific_symbol_files and create
as_symver_specs.
(GLIBCXX_LDBL_COMPAT): New GLIBCXX_CONDITIONAL.
* configure: Rebuilt.
* config.h.in: Rebuilt.
* config/os/gnu-linux/ldbl-extra.ver: New file.
* config/abi/pre/gnu.ver: Make sure no __float128 symbols are
exported.
* include/bits/c++config (_GLIBCXX_LONG_DOUBLE_COMPAT,
_GLIBCXX_LDBL_NAMESPACE, _GLIBCXX_BEGIN_LDBL_NAMESPACE,
_GLIBCXX_END_LDBL_NAMESPACE): Define.
* include/bits/localefwd.h: Use them to conditionally scope facets.
* include/bits/locale_facets.h: Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_get): Add __do_get method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_put): Add __do_put method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_get): Add __do_get method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_put): Add __do_put method.
* include/bits/locale_facets.tcc: Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
(std::money_get::__do_get, std::money_put::__do_put,
std::num_get::__do_get, std::num_put::__do_put): New
specializations.
* include/Makefile.am: Conditionally define
_GLIBCXX_LONG_DOUBLE_COMPAT in c++config.
* include/Makefile.in: Regenerate.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT] (_GLIBCXX_LOC_ID,
_GLIBCXX_SYNC_ID): Define, use them.
* src/compatibility-ldbl.cc: New file.
* src/complex_io.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Add compatibility
symbols.
* src/limits.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale-misc-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/istream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/ostream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/wlocale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/compatibility.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* config/locale/generic/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
Likewise.
* config/locale/gnu/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
Likewise.
* src/Makefile.am (libstdc++-symbol.ver): Append instead of
insert in the middle if port specific symbol file requests it.
(ldbl_compat_sources): New variable.
(sources): Use it.
(compatibility-ldbl.lo, compatibility-ldbl.o): New rules.
* src/Makefile.in: Rebuilt.
* testsuite/testsuite_abi.cc: Recognize GLIBCXX_LDBL_3.4,
GLIBCXX_LDBL_3.4.7, CXXABI_LDBL_1.3.
Co-Authored-By: Benjamin Kosnik <bkoz@redhat.com>
From-SVN: r110725
2006-02-07 23:23:58 +01:00
|
|
|
|
|
|
|
// XXX GLIBCXX_ABI Deprecated
|
|
|
|
#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
|
|
|
|
virtual iter_type
|
|
|
|
do_put(iter_type, ios_base&, char_type __fill, long double __v) const;
|
|
|
|
#endif
|
2004-01-07 06:22:37 +01:00
|
|
|
//@}
|
2000-10-05 13:27:02 +02:00
|
|
|
};
|
|
|
|
|
2000-12-22 12:03:33 +01:00
|
|
|
template <typename _CharT, typename _OutIter>
|
|
|
|
locale::id num_put<_CharT, _OutIter>::id;
|
|
|
|
|
configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
2006-02-07 Jakub Jelinek <jakub@redhat.com>
Benjamin Kosnik <bkoz@redhat.com>
* configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
If true, set also port_specific_symbol_files and create
as_symver_specs.
(GLIBCXX_LDBL_COMPAT): New GLIBCXX_CONDITIONAL.
* configure: Rebuilt.
* config.h.in: Rebuilt.
* config/os/gnu-linux/ldbl-extra.ver: New file.
* config/abi/pre/gnu.ver: Make sure no __float128 symbols are
exported.
* include/bits/c++config (_GLIBCXX_LONG_DOUBLE_COMPAT,
_GLIBCXX_LDBL_NAMESPACE, _GLIBCXX_BEGIN_LDBL_NAMESPACE,
_GLIBCXX_END_LDBL_NAMESPACE): Define.
* include/bits/localefwd.h: Use them to conditionally scope facets.
* include/bits/locale_facets.h: Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_get): Add __do_get method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::money_put): Add __do_put method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_get): Add __do_get method.
[_GLIBCXX_LONG_DOUBLE_COMPAT] (std::num_put): Add __do_put method.
* include/bits/locale_facets.tcc: Surround std::{money,num}_{get,put}
with _GLIBCXX_BEGIN_LDBL_NAMESPACE and _GLIBCXX_END_LDBL_NAMESPACE.
(std::money_get::__do_get, std::money_put::__do_put,
std::num_get::__do_get, std::num_put::__do_put): New
specializations.
* include/Makefile.am: Conditionally define
_GLIBCXX_LONG_DOUBLE_COMPAT in c++config.
* include/Makefile.in: Regenerate.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT] (_GLIBCXX_LOC_ID,
_GLIBCXX_SYNC_ID): Define, use them.
* src/compatibility-ldbl.cc: New file.
* src/complex_io.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Add compatibility
symbols.
* src/limits.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale-misc-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/istream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/ostream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/wlocale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* src/compatibility.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
* config/locale/generic/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
Likewise.
* config/locale/gnu/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
Likewise.
* src/Makefile.am (libstdc++-symbol.ver): Append instead of
insert in the middle if port specific symbol file requests it.
(ldbl_compat_sources): New variable.
(sources): Use it.
(compatibility-ldbl.lo, compatibility-ldbl.o): New rules.
* src/Makefile.in: Rebuilt.
* testsuite/testsuite_abi.cc: Recognize GLIBCXX_LDBL_3.4,
GLIBCXX_LDBL_3.4.7, CXXABI_LDBL_1.3.
Co-Authored-By: Benjamin Kosnik <bkoz@redhat.com>
From-SVN: r110725
2006-02-07 23:23:58 +01:00
|
|
|
_GLIBCXX_END_LDBL_NAMESPACE
|
2001-08-08 04:49:01 +02:00
|
|
|
|
2001-09-10 03:00:27 +02:00
|
|
|
// Subclause convenience interfaces, inlines.
|
|
|
|
// NB: These are inline because, when used in a loop, some compilers
|
|
|
|
// can hoist the body out of the loop; then it's just as fast as the
|
|
|
|
// C is*() function.
|
locale_facets.h (isspace, [...]): Add doxygen markup.
2004-11-22 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/locale_facets.h (isspace, isprint, isupper,
islower, isalpha, isdigit, ispunct, isxdigit, isalnum, isgraph,
toupper, tolower): Add doxygen markup.
(codecvt_byname, ctype_byname, numpunct_byname, collate_byname,
time_get_byname, time_put_byname, moneypunct_byname,
messages_byname): Same.
* include/std/std_fstream.h: Remove superfluous markup.
* include/std/std_sstream.h: Same.
* include/std/std_streambuf.h: Same.
* include/ext/enc_filebuf.h: Adjust markup.
* include/ext/stdio_filebuf.h: Same.
* include/ext/stdio_sync_filebuf.h: Same.
* include/bits/codecvt.h: Same.
* config/os/gnu-linux/ctype_base.h: Same.
* config/locale/ieee_1003.1-2001/codecvt_specializations.h: Same.
* include/tr1/array: Add markup.
* include/tr1/tuple: Same.
* docs/doxygen/run_doxygen: Print arguments.
* docs/doxygen/user.cfg.in: Tweaks.
From-SVN: r91080
2004-11-23 10:18:41 +01:00
|
|
|
|
|
|
|
/// Convenience interface to ctype.is(ctype_base::space, __c).
|
2000-10-05 13:27:02 +02:00
|
|
|
template<typename _CharT>
|
2004-02-08 05:46:42 +01:00
|
|
|
inline bool
|
2000-10-05 13:27:02 +02:00
|
|
|
isspace(_CharT __c, const locale& __loc)
|
|
|
|
{ return use_facet<ctype<_CharT> >(__loc).is(ctype_base::space, __c); }
|
|
|
|
|
locale_facets.h (isspace, [...]): Add doxygen markup.
2004-11-22 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/locale_facets.h (isspace, isprint, isupper,
islower, isalpha, isdigit, ispunct, isxdigit, isalnum, isgraph,
toupper, tolower): Add doxygen markup.
(codecvt_byname, ctype_byname, numpunct_byname, collate_byname,
time_get_byname, time_put_byname, moneypunct_byname,
messages_byname): Same.
* include/std/std_fstream.h: Remove superfluous markup.
* include/std/std_sstream.h: Same.
* include/std/std_streambuf.h: Same.
* include/ext/enc_filebuf.h: Adjust markup.
* include/ext/stdio_filebuf.h: Same.
* include/ext/stdio_sync_filebuf.h: Same.
* include/bits/codecvt.h: Same.
* config/os/gnu-linux/ctype_base.h: Same.
* config/locale/ieee_1003.1-2001/codecvt_specializations.h: Same.
* include/tr1/array: Add markup.
* include/tr1/tuple: Same.
* docs/doxygen/run_doxygen: Print arguments.
* docs/doxygen/user.cfg.in: Tweaks.
From-SVN: r91080
2004-11-23 10:18:41 +01:00
|
|
|
/// Convenience interface to ctype.is(ctype_base::print, __c).
|
2000-10-05 13:27:02 +02:00
|
|
|
template<typename _CharT>
|
2004-02-08 05:46:42 +01:00
|
|
|
inline bool
|
2000-10-05 13:27:02 +02:00
|
|
|
isprint(_CharT __c, const locale& __loc)
|
|
|
|
{ return use_facet<ctype<_CharT> >(__loc).is(ctype_base::print, __c); }
|
|
|
|
|
locale_facets.h (isspace, [...]): Add doxygen markup.
2004-11-22 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/locale_facets.h (isspace, isprint, isupper,
islower, isalpha, isdigit, ispunct, isxdigit, isalnum, isgraph,
toupper, tolower): Add doxygen markup.
(codecvt_byname, ctype_byname, numpunct_byname, collate_byname,
time_get_byname, time_put_byname, moneypunct_byname,
messages_byname): Same.
* include/std/std_fstream.h: Remove superfluous markup.
* include/std/std_sstream.h: Same.
* include/std/std_streambuf.h: Same.
* include/ext/enc_filebuf.h: Adjust markup.
* include/ext/stdio_filebuf.h: Same.
* include/ext/stdio_sync_filebuf.h: Same.
* include/bits/codecvt.h: Same.
* config/os/gnu-linux/ctype_base.h: Same.
* config/locale/ieee_1003.1-2001/codecvt_specializations.h: Same.
* include/tr1/array: Add markup.
* include/tr1/tuple: Same.
* docs/doxygen/run_doxygen: Print arguments.
* docs/doxygen/user.cfg.in: Tweaks.
From-SVN: r91080
2004-11-23 10:18:41 +01:00
|
|
|
/// Convenience interface to ctype.is(ctype_base::cntrl, __c).
|
2000-10-05 13:27:02 +02:00
|
|
|
template<typename _CharT>
|
2004-02-08 05:46:42 +01:00
|
|
|
inline bool
|
2000-10-05 13:27:02 +02:00
|
|
|
iscntrl(_CharT __c, const locale& __loc)
|
|
|
|
{ return use_facet<ctype<_CharT> >(__loc).is(ctype_base::cntrl, __c); }
|
|
|
|
|
locale_facets.h (isspace, [...]): Add doxygen markup.
2004-11-22 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/locale_facets.h (isspace, isprint, isupper,
islower, isalpha, isdigit, ispunct, isxdigit, isalnum, isgraph,
toupper, tolower): Add doxygen markup.
(codecvt_byname, ctype_byname, numpunct_byname, collate_byname,
time_get_byname, time_put_byname, moneypunct_byname,
messages_byname): Same.
* include/std/std_fstream.h: Remove superfluous markup.
* include/std/std_sstream.h: Same.
* include/std/std_streambuf.h: Same.
* include/ext/enc_filebuf.h: Adjust markup.
* include/ext/stdio_filebuf.h: Same.
* include/ext/stdio_sync_filebuf.h: Same.
* include/bits/codecvt.h: Same.
* config/os/gnu-linux/ctype_base.h: Same.
* config/locale/ieee_1003.1-2001/codecvt_specializations.h: Same.
* include/tr1/array: Add markup.
* include/tr1/tuple: Same.
* docs/doxygen/run_doxygen: Print arguments.
* docs/doxygen/user.cfg.in: Tweaks.
From-SVN: r91080
2004-11-23 10:18:41 +01:00
|
|
|
/// Convenience interface to ctype.is(ctype_base::upper, __c).
|
2000-10-05 13:27:02 +02:00
|
|
|
template<typename _CharT>
|
2004-02-08 05:46:42 +01:00
|
|
|
inline bool
|
2000-10-05 13:27:02 +02:00
|
|
|
isupper(_CharT __c, const locale& __loc)
|
|
|
|
{ return use_facet<ctype<_CharT> >(__loc).is(ctype_base::upper, __c); }
|
|
|
|
|
locale_facets.h (isspace, [...]): Add doxygen markup.
2004-11-22 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/locale_facets.h (isspace, isprint, isupper,
islower, isalpha, isdigit, ispunct, isxdigit, isalnum, isgraph,
toupper, tolower): Add doxygen markup.
(codecvt_byname, ctype_byname, numpunct_byname, collate_byname,
time_get_byname, time_put_byname, moneypunct_byname,
messages_byname): Same.
* include/std/std_fstream.h: Remove superfluous markup.
* include/std/std_sstream.h: Same.
* include/std/std_streambuf.h: Same.
* include/ext/enc_filebuf.h: Adjust markup.
* include/ext/stdio_filebuf.h: Same.
* include/ext/stdio_sync_filebuf.h: Same.
* include/bits/codecvt.h: Same.
* config/os/gnu-linux/ctype_base.h: Same.
* config/locale/ieee_1003.1-2001/codecvt_specializations.h: Same.
* include/tr1/array: Add markup.
* include/tr1/tuple: Same.
* docs/doxygen/run_doxygen: Print arguments.
* docs/doxygen/user.cfg.in: Tweaks.
From-SVN: r91080
2004-11-23 10:18:41 +01:00
|
|
|
/// Convenience interface to ctype.is(ctype_base::lower, __c).
|
2000-10-05 13:27:02 +02:00
|
|
|
template<typename _CharT>
|
locale_facets.h (isspace, [...]): Add doxygen markup.
2004-11-22 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/locale_facets.h (isspace, isprint, isupper,
islower, isalpha, isdigit, ispunct, isxdigit, isalnum, isgraph,
toupper, tolower): Add doxygen markup.
(codecvt_byname, ctype_byname, numpunct_byname, collate_byname,
time_get_byname, time_put_byname, moneypunct_byname,
messages_byname): Same.
* include/std/std_fstream.h: Remove superfluous markup.
* include/std/std_sstream.h: Same.
* include/std/std_streambuf.h: Same.
* include/ext/enc_filebuf.h: Adjust markup.
* include/ext/stdio_filebuf.h: Same.
* include/ext/stdio_sync_filebuf.h: Same.
* include/bits/codecvt.h: Same.
* config/os/gnu-linux/ctype_base.h: Same.
* config/locale/ieee_1003.1-2001/codecvt_specializations.h: Same.
* include/tr1/array: Add markup.
* include/tr1/tuple: Same.
* docs/doxygen/run_doxygen: Print arguments.
* docs/doxygen/user.cfg.in: Tweaks.
From-SVN: r91080
2004-11-23 10:18:41 +01:00
|
|
|
inline bool
|
|
|
|
islower(_CharT __c, const locale& __loc)
|
2000-10-05 13:27:02 +02:00
|
|
|
{ return use_facet<ctype<_CharT> >(__loc).is(ctype_base::lower, __c); }
|
|
|
|
|
locale_facets.h (isspace, [...]): Add doxygen markup.
2004-11-22 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/locale_facets.h (isspace, isprint, isupper,
islower, isalpha, isdigit, ispunct, isxdigit, isalnum, isgraph,
toupper, tolower): Add doxygen markup.
(codecvt_byname, ctype_byname, numpunct_byname, collate_byname,
time_get_byname, time_put_byname, moneypunct_byname,
messages_byname): Same.
* include/std/std_fstream.h: Remove superfluous markup.
* include/std/std_sstream.h: Same.
* include/std/std_streambuf.h: Same.
* include/ext/enc_filebuf.h: Adjust markup.
* include/ext/stdio_filebuf.h: Same.
* include/ext/stdio_sync_filebuf.h: Same.
* include/bits/codecvt.h: Same.
* config/os/gnu-linux/ctype_base.h: Same.
* config/locale/ieee_1003.1-2001/codecvt_specializations.h: Same.
* include/tr1/array: Add markup.
* include/tr1/tuple: Same.
* docs/doxygen/run_doxygen: Print arguments.
* docs/doxygen/user.cfg.in: Tweaks.
From-SVN: r91080
2004-11-23 10:18:41 +01:00
|
|
|
/// Convenience interface to ctype.is(ctype_base::alpha, __c).
|
2000-10-05 13:27:02 +02:00
|
|
|
template<typename _CharT>
|
2004-02-08 05:46:42 +01:00
|
|
|
inline bool
|
2000-10-05 13:27:02 +02:00
|
|
|
isalpha(_CharT __c, const locale& __loc)
|
|
|
|
{ return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alpha, __c); }
|
|
|
|
|
locale_facets.h (isspace, [...]): Add doxygen markup.
2004-11-22 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/locale_facets.h (isspace, isprint, isupper,
islower, isalpha, isdigit, ispunct, isxdigit, isalnum, isgraph,
toupper, tolower): Add doxygen markup.
(codecvt_byname, ctype_byname, numpunct_byname, collate_byname,
time_get_byname, time_put_byname, moneypunct_byname,
messages_byname): Same.
* include/std/std_fstream.h: Remove superfluous markup.
* include/std/std_sstream.h: Same.
* include/std/std_streambuf.h: Same.
* include/ext/enc_filebuf.h: Adjust markup.
* include/ext/stdio_filebuf.h: Same.
* include/ext/stdio_sync_filebuf.h: Same.
* include/bits/codecvt.h: Same.
* config/os/gnu-linux/ctype_base.h: Same.
* config/locale/ieee_1003.1-2001/codecvt_specializations.h: Same.
* include/tr1/array: Add markup.
* include/tr1/tuple: Same.
* docs/doxygen/run_doxygen: Print arguments.
* docs/doxygen/user.cfg.in: Tweaks.
From-SVN: r91080
2004-11-23 10:18:41 +01:00
|
|
|
/// Convenience interface to ctype.is(ctype_base::digit, __c).
|
2000-10-05 13:27:02 +02:00
|
|
|
template<typename _CharT>
|
2004-02-08 05:46:42 +01:00
|
|
|
inline bool
|
2000-10-05 13:27:02 +02:00
|
|
|
isdigit(_CharT __c, const locale& __loc)
|
|
|
|
{ return use_facet<ctype<_CharT> >(__loc).is(ctype_base::digit, __c); }
|
|
|
|
|
locale_facets.h (isspace, [...]): Add doxygen markup.
2004-11-22 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/locale_facets.h (isspace, isprint, isupper,
islower, isalpha, isdigit, ispunct, isxdigit, isalnum, isgraph,
toupper, tolower): Add doxygen markup.
(codecvt_byname, ctype_byname, numpunct_byname, collate_byname,
time_get_byname, time_put_byname, moneypunct_byname,
messages_byname): Same.
* include/std/std_fstream.h: Remove superfluous markup.
* include/std/std_sstream.h: Same.
* include/std/std_streambuf.h: Same.
* include/ext/enc_filebuf.h: Adjust markup.
* include/ext/stdio_filebuf.h: Same.
* include/ext/stdio_sync_filebuf.h: Same.
* include/bits/codecvt.h: Same.
* config/os/gnu-linux/ctype_base.h: Same.
* config/locale/ieee_1003.1-2001/codecvt_specializations.h: Same.
* include/tr1/array: Add markup.
* include/tr1/tuple: Same.
* docs/doxygen/run_doxygen: Print arguments.
* docs/doxygen/user.cfg.in: Tweaks.
From-SVN: r91080
2004-11-23 10:18:41 +01:00
|
|
|
/// Convenience interface to ctype.is(ctype_base::punct, __c).
|
2000-10-05 13:27:02 +02:00
|
|
|
template<typename _CharT>
|
2004-02-08 05:46:42 +01:00
|
|
|
inline bool
|
2000-10-05 13:27:02 +02:00
|
|
|
ispunct(_CharT __c, const locale& __loc)
|
|
|
|
{ return use_facet<ctype<_CharT> >(__loc).is(ctype_base::punct, __c); }
|
|
|
|
|
locale_facets.h (isspace, [...]): Add doxygen markup.
2004-11-22 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/locale_facets.h (isspace, isprint, isupper,
islower, isalpha, isdigit, ispunct, isxdigit, isalnum, isgraph,
toupper, tolower): Add doxygen markup.
(codecvt_byname, ctype_byname, numpunct_byname, collate_byname,
time_get_byname, time_put_byname, moneypunct_byname,
messages_byname): Same.
* include/std/std_fstream.h: Remove superfluous markup.
* include/std/std_sstream.h: Same.
* include/std/std_streambuf.h: Same.
* include/ext/enc_filebuf.h: Adjust markup.
* include/ext/stdio_filebuf.h: Same.
* include/ext/stdio_sync_filebuf.h: Same.
* include/bits/codecvt.h: Same.
* config/os/gnu-linux/ctype_base.h: Same.
* config/locale/ieee_1003.1-2001/codecvt_specializations.h: Same.
* include/tr1/array: Add markup.
* include/tr1/tuple: Same.
* docs/doxygen/run_doxygen: Print arguments.
* docs/doxygen/user.cfg.in: Tweaks.
From-SVN: r91080
2004-11-23 10:18:41 +01:00
|
|
|
/// Convenience interface to ctype.is(ctype_base::xdigit, __c).
|
2000-10-05 13:27:02 +02:00
|
|
|
template<typename _CharT>
|
2004-02-08 05:46:42 +01:00
|
|
|
inline bool
|
2000-10-05 13:27:02 +02:00
|
|
|
isxdigit(_CharT __c, const locale& __loc)
|
|
|
|
{ return use_facet<ctype<_CharT> >(__loc).is(ctype_base::xdigit, __c); }
|
|
|
|
|
locale_facets.h (isspace, [...]): Add doxygen markup.
2004-11-22 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/locale_facets.h (isspace, isprint, isupper,
islower, isalpha, isdigit, ispunct, isxdigit, isalnum, isgraph,
toupper, tolower): Add doxygen markup.
(codecvt_byname, ctype_byname, numpunct_byname, collate_byname,
time_get_byname, time_put_byname, moneypunct_byname,
messages_byname): Same.
* include/std/std_fstream.h: Remove superfluous markup.
* include/std/std_sstream.h: Same.
* include/std/std_streambuf.h: Same.
* include/ext/enc_filebuf.h: Adjust markup.
* include/ext/stdio_filebuf.h: Same.
* include/ext/stdio_sync_filebuf.h: Same.
* include/bits/codecvt.h: Same.
* config/os/gnu-linux/ctype_base.h: Same.
* config/locale/ieee_1003.1-2001/codecvt_specializations.h: Same.
* include/tr1/array: Add markup.
* include/tr1/tuple: Same.
* docs/doxygen/run_doxygen: Print arguments.
* docs/doxygen/user.cfg.in: Tweaks.
From-SVN: r91080
2004-11-23 10:18:41 +01:00
|
|
|
/// Convenience interface to ctype.is(ctype_base::alnum, __c).
|
2000-10-05 13:27:02 +02:00
|
|
|
template<typename _CharT>
|
2004-02-08 05:46:42 +01:00
|
|
|
inline bool
|
2000-10-05 13:27:02 +02:00
|
|
|
isalnum(_CharT __c, const locale& __loc)
|
|
|
|
{ return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alnum, __c); }
|
|
|
|
|
locale_facets.h (isspace, [...]): Add doxygen markup.
2004-11-22 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/locale_facets.h (isspace, isprint, isupper,
islower, isalpha, isdigit, ispunct, isxdigit, isalnum, isgraph,
toupper, tolower): Add doxygen markup.
(codecvt_byname, ctype_byname, numpunct_byname, collate_byname,
time_get_byname, time_put_byname, moneypunct_byname,
messages_byname): Same.
* include/std/std_fstream.h: Remove superfluous markup.
* include/std/std_sstream.h: Same.
* include/std/std_streambuf.h: Same.
* include/ext/enc_filebuf.h: Adjust markup.
* include/ext/stdio_filebuf.h: Same.
* include/ext/stdio_sync_filebuf.h: Same.
* include/bits/codecvt.h: Same.
* config/os/gnu-linux/ctype_base.h: Same.
* config/locale/ieee_1003.1-2001/codecvt_specializations.h: Same.
* include/tr1/array: Add markup.
* include/tr1/tuple: Same.
* docs/doxygen/run_doxygen: Print arguments.
* docs/doxygen/user.cfg.in: Tweaks.
From-SVN: r91080
2004-11-23 10:18:41 +01:00
|
|
|
/// Convenience interface to ctype.is(ctype_base::graph, __c).
|
2000-10-05 13:27:02 +02:00
|
|
|
template<typename _CharT>
|
2004-02-08 05:46:42 +01:00
|
|
|
inline bool
|
2000-10-05 13:27:02 +02:00
|
|
|
isgraph(_CharT __c, const locale& __loc)
|
|
|
|
{ return use_facet<ctype<_CharT> >(__loc).is(ctype_base::graph, __c); }
|
|
|
|
|
locale_facets.h (isspace, [...]): Add doxygen markup.
2004-11-22 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/locale_facets.h (isspace, isprint, isupper,
islower, isalpha, isdigit, ispunct, isxdigit, isalnum, isgraph,
toupper, tolower): Add doxygen markup.
(codecvt_byname, ctype_byname, numpunct_byname, collate_byname,
time_get_byname, time_put_byname, moneypunct_byname,
messages_byname): Same.
* include/std/std_fstream.h: Remove superfluous markup.
* include/std/std_sstream.h: Same.
* include/std/std_streambuf.h: Same.
* include/ext/enc_filebuf.h: Adjust markup.
* include/ext/stdio_filebuf.h: Same.
* include/ext/stdio_sync_filebuf.h: Same.
* include/bits/codecvt.h: Same.
* config/os/gnu-linux/ctype_base.h: Same.
* config/locale/ieee_1003.1-2001/codecvt_specializations.h: Same.
* include/tr1/array: Add markup.
* include/tr1/tuple: Same.
* docs/doxygen/run_doxygen: Print arguments.
* docs/doxygen/user.cfg.in: Tweaks.
From-SVN: r91080
2004-11-23 10:18:41 +01:00
|
|
|
/// Convenience interface to ctype.toupper(__c).
|
2000-10-05 13:27:02 +02:00
|
|
|
template<typename _CharT>
|
2004-02-08 05:46:42 +01:00
|
|
|
inline _CharT
|
2000-10-05 13:27:02 +02:00
|
|
|
toupper(_CharT __c, const locale& __loc)
|
|
|
|
{ return use_facet<ctype<_CharT> >(__loc).toupper(__c); }
|
|
|
|
|
locale_facets.h (isspace, [...]): Add doxygen markup.
2004-11-22 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/locale_facets.h (isspace, isprint, isupper,
islower, isalpha, isdigit, ispunct, isxdigit, isalnum, isgraph,
toupper, tolower): Add doxygen markup.
(codecvt_byname, ctype_byname, numpunct_byname, collate_byname,
time_get_byname, time_put_byname, moneypunct_byname,
messages_byname): Same.
* include/std/std_fstream.h: Remove superfluous markup.
* include/std/std_sstream.h: Same.
* include/std/std_streambuf.h: Same.
* include/ext/enc_filebuf.h: Adjust markup.
* include/ext/stdio_filebuf.h: Same.
* include/ext/stdio_sync_filebuf.h: Same.
* include/bits/codecvt.h: Same.
* config/os/gnu-linux/ctype_base.h: Same.
* config/locale/ieee_1003.1-2001/codecvt_specializations.h: Same.
* include/tr1/array: Add markup.
* include/tr1/tuple: Same.
* docs/doxygen/run_doxygen: Print arguments.
* docs/doxygen/user.cfg.in: Tweaks.
From-SVN: r91080
2004-11-23 10:18:41 +01:00
|
|
|
/// Convenience interface to ctype.tolower(__c).
|
2000-10-05 13:27:02 +02:00
|
|
|
template<typename _CharT>
|
2004-02-08 05:46:42 +01:00
|
|
|
inline _CharT
|
2000-10-05 13:27:02 +02:00
|
|
|
tolower(_CharT __c, const locale& __loc)
|
|
|
|
{ return use_facet<ctype<_CharT> >(__loc).tolower(__c); }
|
2005-12-19 01:56:05 +01:00
|
|
|
|
|
|
|
_GLIBCXX_END_NAMESPACE
|
2000-10-05 13:27:02 +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
|
|
|
#ifndef _GLIBCXX_EXPORT_TEMPLATE
|
|
|
|
# include <bits/locale_facets.tcc>
|
|
|
|
#endif
|
|
|
|
|
2001-09-10 03:00:27 +02:00
|
|
|
#endif
|