// Locale support -*- C++ -*-
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-// 2006, 2007
-// Free Software Foundation, Inc.
+// Copyright (C) 1997-2014 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
+// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// 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
-// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
-// 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.
-
-/** @file locale_facets.h
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file bits/locale_facets.h
* This is an internal header file, included by other library headers.
- * You should not attempt to use it directly.
+ * Do not attempt to use it directly. @headername{locale}
*/
//
#include <cwctype> // For wctype_t
#include <cctype>
-#include <bits/ctype_base.h>
+#include <bits/ctype_base.h>
#include <iosfwd>
#include <bits/ios_base.h> // For ios_base, ios_base::iostate
#include <streambuf>
#include <ext/numeric_traits.h>
#include <bits/streambuf_iterator.h>
-_GLIBCXX_BEGIN_NAMESPACE(std)
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
// NB: Don't instantiate required wchar_t facets if no wchar_t support.
#ifdef _GLIBCXX_USE_WCHAR_T
# define _GLIBCXX_NUM_FACETS 14
#endif
- // Convert string to numeric value of type _Tv and store results.
+ // Convert string to numeric value of type _Tp and store results.
// NB: This is specialized for all required types, there is no
// generic definition.
- template<typename _Tv>
+ template<typename _Tp>
void
- __convert_to_v(const char* __in, _Tv& __out, ios_base::iostate& __err,
- const __c_locale& __cloc);
+ __convert_to_v(const char*, _Tp&, ios_base::iostate&,
+ const __c_locale&) throw();
// Explicit specializations for required types.
template<>
void
__convert_to_v(const char*, float&, ios_base::iostate&,
- const __c_locale&);
+ const __c_locale&) throw();
template<>
void
__convert_to_v(const char*, double&, ios_base::iostate&,
- const __c_locale&);
+ const __c_locale&) throw();
template<>
void
__convert_to_v(const char*, long double&, ios_base::iostate&,
- const __c_locale&);
+ const __c_locale&) throw();
// NB: __pad is a struct, rather than a function, so it can be
// partially-specialized.
{
static void
_S_pad(ios_base& __io, _CharT __fill, _CharT* __news,
- const _CharT* __olds, const streamsize __newlen,
- const streamsize __oldlen);
+ const _CharT* __olds, streamsize __newlen, streamsize __oldlen);
};
// Used by both numeric and monetary facets.
// 22.2.1.1 Template class ctype
// Include host and configuration specific ctype enums for ctype_base.
- // Common base for ctype<_CharT>.
/**
* @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
+ * This template also provides abstract stubs for the protected virtual
* functions.
*/
template<typename _CharT>
/**
* @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().
+ * 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.
+ * @param __c The char_type to compare the mask of.
+ * @param __m The mask to compare against.
+ * @return (M & __m) != 0.
*/
bool
is(mask __m, char_type __c) const
* 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.
+ * @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.
*/
const char_type*
is(const char_type *__lo, const char_type *__hi, mask *__vec) const
* [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.
+ * @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.
*/
const char_type*
scan_is(mask __m, const char_type* __lo, const char_type* __hi) const
* [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.
+ * @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.
*/
const char_type*
scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
* 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.
+ * @param __c The char_type to convert.
+ * @return The uppercase char_type if convertible, else @a __c.
*/
char_type
toupper(char_type __c) const
* 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.
+ * @param __lo Pointer to start of range.
+ * @param __hi Pointer to end of range.
+ * @return @a __hi.
*/
const char_type*
toupper(char_type *__lo, const char_type* __hi) const
* 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.
+ * @param __c The char_type to convert.
+ * @return The lowercase char_type if convertible, else @a __c.
*/
char_type
tolower(char_type __c) const
/**
* @brief Convert array to lowercase.
*
- * This function converts each char_type in the range [lo,hi) to
+ * 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).
+ * 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.
+ * @param __lo Pointer to start of range.
+ * @param __hi Pointer to end of range.
+ * @return @a __hi.
*/
const char_type*
tolower(char_type* __lo, const char_type* __hi) const
* Note: this is not what you want for codepage conversions. See
* codecvt for that.
*
- * @param c The char to convert.
+ * @param __c The char to convert.
* @return The converted char_type.
*/
char_type
* 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.
+ * @param __lo Pointer to start of range.
+ * @param __hi Pointer to end of range.
+ * @param __to Pointer to the destination array.
+ * @return @a __hi.
*/
const char*
widen(const char* __lo, const char* __hi, char_type* __to) const
* 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).
+ * 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.
+ * @param __c The char_type to convert.
+ * @param __dfault Char to return if conversion fails.
* @return The converted char.
*/
char
* 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).
+ * 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.
+ * @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.
*/
const char_type*
narrow(const char_type* __lo, const char_type* __hi,
- char __dfault, char *__to) const
+ char __dfault, char* __to) const
{ return this->do_narrow(__lo, __hi, __dfault, __to); }
protected:
* 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.
+ * @param __c The char_type to find the mask of.
+ * @param __m The mask to compare against.
+ * @return (M & __m) != 0.
*/
virtual bool
do_is(mask __m, char_type __c) const = 0;
* 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.
+ * @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.
*/
virtual const char_type*
do_is(const char_type* __lo, const char_type* __hi,
* @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.
+ * [__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.
+ * @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.
*/
virtual const char_type*
do_scan_is(mask __m, const char_type* __lo,
* 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.
+ * @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.
*/
virtual const char_type*
do_scan_not(mask __m, const char_type* __lo,
* 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.
+ * @param __c The char_type to convert.
+ * @return The uppercase char_type if convertible, else @a __c.
*/
virtual char_type
- do_toupper(char_type) const = 0;
+ do_toupper(char_type __c) const = 0;
/**
* @brief Convert array to uppercase.
*
- * This virtual function converts each char_type in the range [lo,hi)
+ * 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.
+ * @param __lo Pointer to start of range.
+ * @param __hi Pointer to end of range.
+ * @return @a __hi.
*/
virtual const char_type*
do_toupper(char_type* __lo, const char_type* __hi) const = 0;
* 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.
+ * @param __c The char_type to convert.
+ * @return The lowercase char_type if convertible, else @a __c.
*/
virtual char_type
- do_tolower(char_type) const = 0;
+ do_tolower(char_type __c) const = 0;
/**
* @brief Convert array to lowercase.
*
- * This virtual function converts each char_type in the range [lo,hi)
+ * 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.
+ * @param __lo Pointer to start of range.
+ * @param __hi Pointer to end of range.
+ * @return @a __hi.
*/
virtual const char_type*
do_tolower(char_type* __lo, const char_type* __hi) const = 0;
* Note: this is not what you want for codepage conversions. See
* codecvt for that.
*
- * @param c The char to convert.
+ * @param __c The char to convert.
* @return The converted char_type
*/
virtual char_type
- do_widen(char) const = 0;
+ do_widen(char __c) const = 0;
/**
* @brief Widen char array
* 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.
+ * @param __lo Pointer to start range.
+ * @param __hi Pointer to end of range.
+ * @param __to Pointer to the destination array.
+ * @return @a __hi.
*/
virtual const char*
- do_widen(const char* __lo, const char* __hi,
- char_type* __dest) const = 0;
+ do_widen(const char* __lo, const char* __hi, char_type* __to) const = 0;
/**
* @brief Narrow char_type to char
* 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.
+ * @param __c The char_type to convert.
+ * @param __dfault Char to return if conversion fails.
* @return The converted char.
*/
virtual char
- do_narrow(char_type, char __dfault) const = 0;
+ do_narrow(char_type __c, char __dfault) const = 0;
/**
* @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.
+ * 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
* 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.
+ * @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.
*/
virtual const char_type*
do_narrow(const char_type* __lo, const char_type* __hi,
- char __dfault, char* __dest) const = 0;
+ char __dfault, char* __to) const = 0;
};
- // NB: Generic, mostly useless implementation.
/**
- * @brief Template ctype facet
+ * @brief Primary class template ctype facet.
+ * @ingroup locales
*
* This template class defines classification and conversion functions for
- * character sets. It wraps <cctype> functionality. Ctype gets used by
+ * 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
virtual const char_type*
do_narrow(const char_type* __lo, const char_type* __hi,
- char __dfault, char* __dest) const;
+ char __dfault, char* __to) const;
};
template<typename _CharT>
locale::id ctype<_CharT>::id;
- // 22.2.1.3 ctype<char> specialization.
/**
* @brief The ctype<char> specialization.
+ * @ingroup locales
*
* This class defines classification and conversion functions for
* the char type. It gets used by char streams for many I/O
*
* This is the constructor provided by the standard.
*
- * @param table If non-zero, table is used as the per-char mask.
+ * @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.
+ * @param __del If true, passes ownership of table to this facet.
+ * @param __refs Passed to the base facet class.
*/
explicit
ctype(const mask* __table = 0, bool __del = false, size_t __refs = 0);
*
* 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.
+ * @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.
*/
explicit
ctype(__c_locale __cloc, const mask* __table = 0, bool __del = false,
/**
* @brief Test char classification.
*
- * This function compares the mask table[c] to @a m.
+ * 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.
+ * @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
is(mask __m, char __c) const;
* 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.
+ * @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.
*/
inline const char*
is(const char* __lo, const char* __hi, mask* __vec) const;
* 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.
+ * @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.
*/
inline const char*
scan_is(mask __m, const char* __lo, const char* __hi) const;
* @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.
+ * 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.
+ * @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.
*/
inline const char*
scan_not(mask __m, const char* __lo, const char* __hi) const;
* 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.
+ * @param __c The char to convert.
+ * @return The uppercase char if convertible, else @a __c.
*/
char_type
toupper(char_type __c) const
/**
* @brief Convert array to uppercase.
*
- * This function converts each char in the range [lo,hi) 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).
+ * 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.
+ * @param __lo Pointer to first char in range.
+ * @param __hi Pointer to end of range.
+ * @return @a __hi.
*/
const char_type*
toupper(char_type *__lo, const char_type* __hi) const
* 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).
+ * 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.
+ * @param __c The char to convert.
+ * @return The lowercase char if convertible, else @a __c.
*/
char_type
tolower(char_type __c) const
* 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).
+ * 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.
+ * @param __lo Pointer to first char in range.
+ * @param __hi Pointer to end of range.
+ * @return @a __hi.
*/
const char_type*
tolower(char_type* __lo, const char_type* __hi) const
* Note: this is not what you want for codepage conversions. See
* codecvt for that.
*
- * @param c The char to convert.
+ * @param __c The char to convert.
* @return The converted character.
*/
char_type
* 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.
+ * @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.
*/
const char*
widen(const char* __lo, const char* __hi, char_type* __to) const
{
if (_M_widen_ok == 1)
{
- memcpy(__to, __lo, __hi - __lo);
+ __builtin_memcpy(__to, __lo, __hi - __lo);
return __hi;
}
if (!_M_widen_ok)
* 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.
+ * @param __c The char to convert.
+ * @param __dfault Char to return if conversion fails.
* @return The converted character.
*/
char
* 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.
+ * @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.
*/
const char_type*
narrow(const char_type* __lo, const char_type* __hi,
- char __dfault, char *__to) const
+ char __dfault, char* __to) const
{
if (__builtin_expect(_M_narrow_ok == 1, true))
{
- memcpy(__to, __lo, __hi - __lo);
+ __builtin_memcpy(__to, __lo, __hi - __lo);
return __hi;
}
if (!_M_narrow_ok)
return this->do_narrow(__lo, __hi, __dfault, __to);
}
- protected:
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 695. ctype<char>::classic_table() not accessible.
/// Returns a pointer to the mask table provided to the constructor, or
/// the default from classic_table() if none was provided.
const mask*
/// Returns a pointer to the C locale mask table.
static const mask*
classic_table() throw();
+ protected:
/**
* @brief Destructor.
* 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.
+ * @param __c The char to convert.
+ * @return The uppercase char if convertible, else @a __c.
*/
virtual char_type
- do_toupper(char_type) const;
+ do_toupper(char_type __c) const;
/**
* @brief Convert array to uppercase.
* 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.
+ * @param __lo Pointer to start of range.
+ * @param __hi Pointer to end of range.
+ * @return @a __hi.
*/
virtual const char_type*
do_toupper(char_type* __lo, const char_type* __hi) const;
* 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.
+ * @param __c The char to convert.
+ * @return The lowercase char if convertible, else @a __c.
*/
virtual char_type
- do_tolower(char_type) const;
+ do_tolower(char_type __c) const;
/**
* @brief Convert array to lowercase.
* 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.
+ * @param __lo Pointer to first char in range.
+ * @param __hi Pointer to end of range.
+ * @return @a __hi.
*/
virtual const char_type*
do_tolower(char_type* __lo, const char_type* __hi) const;
* Note: this is not what you want for codepage conversions. See
* codecvt for that.
*
- * @param c The char to convert.
+ * @param __c The char to convert.
* @return The converted character.
*/
virtual char_type
* 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.
+ * @param __lo Pointer to start of range.
+ * @param __hi Pointer to end of range.
+ * @param __to Pointer to the destination array.
+ * @return @a __hi.
*/
virtual const char*
- do_widen(const char* __lo, const char* __hi, char_type* __dest) const
+ do_widen(const char* __lo, const char* __hi, char_type* __to) const
{
- memcpy(__dest, __lo, __hi - __lo);
+ __builtin_memcpy(__to, __lo, __hi - __lo);
return __hi;
}
* 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.
+ * @param __c The char to convert.
+ * @param __dfault Char to return if conversion fails.
* @return The converted char.
*/
virtual char
- do_narrow(char_type __c, char) const
+ do_narrow(char_type __c, char __dfault) const
{ return __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 dfault Char to use if conversion fails.
- * @param to Pointer to the destination array.
- * @return @a hi.
+ * @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.
*/
virtual const char_type*
do_narrow(const char_type* __lo, const char_type* __hi,
- char, char* __dest) const
+ char __dfault, char* __to) const
{
- memcpy(__dest, __lo, __hi - __lo);
+ __builtin_memcpy(__to, __lo, __hi - __lo);
return __hi;
}
private:
-
- void _M_widen_init() const
- {
- char __tmp[sizeof(_M_widen)];
- for (size_t __i = 0; __i < sizeof(_M_widen); ++__i)
- __tmp[__i] = __i;
- do_widen(__tmp, __tmp + sizeof(__tmp), _M_widen);
-
- _M_widen_ok = 1;
- // Set _M_widen_ok to 2 if memcpy can't be used.
- if (memcmp(__tmp, _M_widen, sizeof(_M_widen)))
- _M_widen_ok = 2;
- }
-
- // Fill in the narrowing cache and flag whether all values are
- // valid or not. _M_narrow_ok is set to 2 if memcpy can't
- // be used.
- void _M_narrow_init() const
- {
- char __tmp[sizeof(_M_narrow)];
- for (size_t __i = 0; __i < sizeof(_M_narrow); ++__i)
- __tmp[__i] = __i;
- do_narrow(__tmp, __tmp + sizeof(__tmp), 0, _M_narrow);
-
- _M_narrow_ok = 1;
- if (memcmp(__tmp, _M_narrow, sizeof(_M_narrow)))
- _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;
- }
- }
+ void _M_narrow_init() const;
+ void _M_widen_init() const;
};
- template<>
- const ctype<char>&
- use_facet<ctype<char> >(const locale& __loc);
-
#ifdef _GLIBCXX_USE_WCHAR_T
- // 22.2.1.3 ctype<wchar_t> specialization
/**
* @brief The ctype<wchar_t> specialization.
+ * @ingroup locales
*
* This class defines classification and conversion functions for the
* wchar_t type. It gets used by wchar_t streams for many I/O operations.
*
* This is the constructor provided by the standard.
*
- * @param refs Passed to the base facet class.
+ * @param __refs Passed to the base facet class.
*/
explicit
ctype(size_t __refs = 0);
*
* 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.
+ * @param __cloc Handle to C locale data.
+ * @param __refs Passed to the base facet class.
*/
explicit
ctype(__c_locale __cloc, size_t __refs = 0);
protected:
__wmask_type
- _M_convert_to_wmask(const mask __m) const;
+ _M_convert_to_wmask(const mask __m) const throw();
/// Destructor
virtual
* 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.
+ * @param __c The wchar_t to find the mask of.
+ * @param __m The mask to compare against.
+ * @return (M & __m) != 0.
*/
virtual bool
do_is(mask __m, char_type __c) const;
* 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.
+ * @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.
*/
virtual const char_type*
do_is(const char_type* __lo, const char_type* __hi, mask* __vec) const;
* @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.
+ * [__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.
+ * @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.
*/
virtual const char_type*
do_scan_is(mask __m, const char_type* __lo, const char_type* __hi) const;
* @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.
+ * 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.
+ * @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.
*/
virtual const char_type*
do_scan_not(mask __m, const char_type* __lo,
* 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.
+ * @param __c The wchar_t to convert.
+ * @return The uppercase wchar_t if convertible, else @a __c.
*/
virtual char_type
- do_toupper(char_type) const;
+ do_toupper(char_type __c) const;
/**
* @brief Convert array to uppercase.
* 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.
+ * @param __lo Pointer to start of range.
+ * @param __hi Pointer to end of range.
+ * @return @a __hi.
*/
virtual const char_type*
do_toupper(char_type* __lo, const char_type* __hi) const;
* 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.
+ * @param __c The wchar_t to convert.
+ * @return The lowercase wchar_t if convertible, else @a __c.
*/
virtual char_type
- do_tolower(char_type) const;
+ do_tolower(char_type __c) const;
/**
* @brief Convert array to lowercase.
* 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.
+ * @param __lo Pointer to start of range.
+ * @param __hi Pointer to end of range.
+ * @return @a __hi.
*/
virtual const char_type*
do_tolower(char_type* __lo, const char_type* __hi) const;
* Note: this is not what you want for codepage conversions. See
* codecvt for that.
*
- * @param c The char to convert.
+ * @param __c The char to convert.
* @return The converted wchar_t.
*/
virtual char_type
- do_widen(char) const;
+ do_widen(char __c) const;
/**
* @brief Widen char array to wchar_t array
* 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.
+ * @param __lo Pointer to start range.
+ * @param __hi Pointer to end of range.
+ * @param __to Pointer to the destination array.
+ * @return @a __hi.
*/
virtual const char*
- do_widen(const char* __lo, const char* __hi, char_type* __dest) const;
+ do_widen(const char* __lo, const char* __hi, char_type* __to) const;
/**
* @brief Narrow wchar_t to char
* 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.
+ * @param __c The wchar_t to convert.
+ * @param __dfault Char to return if conversion fails.
* @return The converted char.
*/
virtual char
- do_narrow(char_type, char __dfault) const;
+ do_narrow(char_type __c, char __dfault) const;
/**
* @brief Narrow wchar_t array to char array
* 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.
+ * @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.
*/
virtual const char_type*
do_narrow(const char_type* __lo, const char_type* __hi,
- char __dfault, char* __dest) const;
+ char __dfault, char* __to) const;
// For use at construction time only.
void
- _M_initialize_ctype();
+ _M_initialize_ctype() throw();
};
-
- template<>
- const ctype<wchar_t>&
- use_facet<ctype<wchar_t> >(const locale& __loc);
#endif //_GLIBCXX_USE_WCHAR_T
- /// @brief class ctype_byname [22.2.1.2].
+ /// class ctype_byname [22.2.1.2].
template<typename _CharT>
class ctype_byname : public ctype<_CharT>
{
};
#endif
-_GLIBCXX_END_NAMESPACE
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
// Include host and configuration specific ctype inlines.
#include <bits/ctype_inline.h>
-_GLIBCXX_BEGIN_NAMESPACE(std)
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
// 22.2.2 The numeric category.
class __num_base
// Below are the indices into _S_atoms_out.
enum
{
- _S_ominus,
- _S_oplus,
- _S_ox,
- _S_oX,
- _S_odigits,
- _S_odigits_end = _S_odigits + 16,
- _S_oudigits = _S_odigits_end,
- _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_ominus,
+ _S_oplus,
+ _S_ox,
+ _S_oX,
+ _S_odigits,
+ _S_odigits_end = _S_odigits + 16,
+ _S_oudigits = _S_odigits_end,
+ _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
};
// num_put
// Construct and return valid scanf format for floating point types.
static void
- _S_format_float(const ios_base& __io, char* __fptr, char __mod);
+ _S_format_float(const ios_base& __io, char* __fptr, char __mod) throw();
};
template<typename _CharT>
bool _M_allocated;
- __numpunct_cache(size_t __refs = 0) : facet(__refs),
- _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)
- { }
+ __numpunct_cache(size_t __refs = 0)
+ : facet(__refs), _M_grouping(0), _M_grouping_size(0),
+ _M_use_grouping(false),
+ _M_truename(0), _M_truename_size(0), _M_falsename(0),
+ _M_falsename_size(0), _M_decimal_point(_CharT()),
+ _M_thousands_sep(_CharT()), _M_allocated(false)
+ { }
~__numpunct_cache();
private:
__numpunct_cache&
operator=(const __numpunct_cache&);
-
+
explicit
__numpunct_cache(const __numpunct_cache&);
};
}
/**
- * @brief Numpunct facet.
+ * @brief Primary class template numpunct.
+ * @ingroup locales
*
* This facet stores several pieces of information related to printing and
* scanning numbers, such as the decimal point character. It takes a
/**
* @brief Numpunct constructor.
*
- * @param refs Refcount to pass to the base class.
+ * @param __refs Refcount to pass to the base class.
*/
explicit
- numpunct(size_t __refs = 0) : facet(__refs), _M_data(NULL)
+ numpunct(size_t __refs = 0)
+ : facet(__refs), _M_data(0)
{ _M_initialize_numpunct(); }
/**
* 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.
+ * @param __cache __numpunct_cache object.
+ * @param __refs Refcount to pass to the base class.
*/
explicit
numpunct(__cache_type* __cache, size_t __refs = 0)
* 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.
+ * @param __cloc The C locale.
+ * @param __refs Refcount to pass to the base class.
*/
explicit
numpunct(__c_locale __cloc, size_t __refs = 0)
- : facet(__refs), _M_data(NULL)
+ : facet(__refs), _M_data(0)
{ _M_initialize_numpunct(__cloc); }
/**
// For use at construction time only.
void
- _M_initialize_numpunct(__c_locale __cloc = NULL);
+ _M_initialize_numpunct(__c_locale __cloc = 0);
};
template<typename _CharT>
numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc);
#endif
- /// @brief class numpunct_byname [22.2.3.2].
+ /// class numpunct_byname [22.2.3.2].
template<typename _CharT>
class numpunct_byname : public numpunct<_CharT>
{
numpunct_byname(const char* __s, size_t __refs = 0)
: numpunct<_CharT>(__refs)
{
- if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
+ if (__builtin_strcmp(__s, "C") != 0
+ && __builtin_strcmp(__s, "POSIX") != 0)
{
__c_locale __tmp;
this->_S_create_c_locale(__tmp, __s);
~numpunct_byname() { }
};
-_GLIBCXX_BEGIN_LDBL_NAMESPACE
+_GLIBCXX_BEGIN_NAMESPACE_LDBL
/**
- * @brief Facet for parsing number strings.
+ * @brief Primary class template num_get.
+ * @ingroup locales
*
* This facet encapsulates the code to parse and return a number
* from a string. It is used by the istream numeric extraction
*
* This is the constructor provided by the standard.
*
- * @param refs Passed to the base facet class.
+ * @param __refs Passed to the base facet class.
*/
explicit
num_get(size_t __refs = 0) : facet(__refs) { }
* 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.
+ * @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.
*/
iter_type
* 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.
+ * Digit grouping is interpreted 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.
+ * @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.
*/
iter_type
* 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.
+ * Digit grouping is interpreted 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.
+ * @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.
*/
iter_type
*
* 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.
+ * Digit grouping is interpreted 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.
* 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.
+ * @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.
*/
iter_type
iter_type
_M_extract_float(iter_type, iter_type, ios_base&, ios_base::iostate&,
- string& __xtrc) const;
+ string&) const;
template<typename _ValueT>
- iter_type
- _M_extract_int(iter_type, iter_type, ios_base&, ios_base::iostate&,
- _ValueT& __v) const;
+ iter_type
+ _M_extract_int(iter_type, iter_type, ios_base&, ios_base::iostate&,
+ _ValueT&) const;
template<typename _CharT2>
typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, int>::__type
- _M_find(const _CharT2*, size_t __len, _CharT2 __c) const
- {
+ _M_find(const _CharT2*, size_t __len, _CharT2 __c) const
+ {
int __ret = -1;
if (__len <= 10)
{
}
template<typename _CharT2>
- typename __gnu_cxx::__enable_if<!__is_char<_CharT2>::__value,
+ typename __gnu_cxx::__enable_if<!__is_char<_CharT2>::__value,
int>::__type
- _M_find(const _CharT2* __zero, size_t __len, _CharT2 __c) const
- {
+ _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)
* 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.
+ * @param __beg 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.
*/
virtual iter_type
do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, bool&) const;
-
virtual iter_type
- do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, long&) const;
+ do_get(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, long& __v) const
+ { return _M_extract_int(__beg, __end, __io, __err, __v); }
virtual iter_type
- do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
- unsigned short&) const;
+ do_get(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, unsigned short& __v) const
+ { return _M_extract_int(__beg, __end, __io, __err, __v); }
virtual iter_type
- do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
- unsigned int&) const;
+ do_get(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, unsigned int& __v) const
+ { return _M_extract_int(__beg, __end, __io, __err, __v); }
virtual iter_type
- do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
- unsigned long&) const;
+ do_get(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, unsigned long& __v) const
+ { return _M_extract_int(__beg, __end, __io, __err, __v); }
#ifdef _GLIBCXX_USE_LONG_LONG
virtual iter_type
- do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
- long long&) const;
+ do_get(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, long long& __v) const
+ { return _M_extract_int(__beg, __end, __io, __err, __v); }
virtual iter_type
- do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
- unsigned long long&) const;
+ do_get(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, unsigned long long& __v) const
+ { return _M_extract_int(__beg, __end, __io, __err, __v); }
#endif
virtual iter_type
- do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
- float&) const;
+ do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, float&) const;
virtual iter_type
- do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
+ do_get(iter_type, iter_type, ios_base&, ios_base::iostate&,
double&) const;
// 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,
+ __do_get(iter_type, iter_type, ios_base&, ios_base::iostate&,
double&) const;
#else
virtual iter_type
- do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
+ do_get(iter_type, iter_type, ios_base&, ios_base::iostate&,
long double&) const;
#endif
virtual iter_type
- do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
- void*&) const;
+ do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, void*&) const;
// 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,
+ do_get(iter_type, iter_type, ios_base&, ios_base::iostate&,
long double&) const;
#endif
//@}
/**
- * @brief Facet for converting numbers to strings.
+ * @brief Primary class template num_put.
+ * @ingroup locales
*
* This facet encapsulates the code to convert a number to a string. It is
* used by the ostream numeric insertion operators.
*
* This is the constructor provided by the standard.
*
- * @param refs Passed to the base facet class.
+ * @param __refs Passed to the base facet class.
*/
explicit
num_put(size_t __refs = 0) : facet(__refs) { }
* 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.
+ * @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.
*/
iter_type
- put(iter_type __s, ios_base& __f, char_type __fill, bool __v) const
- { return this->do_put(__s, __f, __fill, __v); }
+ put(iter_type __s, ios_base& __io, char_type __fill, bool __v) const
+ { return this->do_put(__s, __io, __fill, __v); }
//@{
/**
* 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().
+ * The decimal point character used is numpunct::decimal_point().
+ * Thousands separators are inserted according to
+ * numpunct::grouping() and numpunct::thousands_sep().
*
* If io.width() is non-zero, enough @a fill characters are inserted to
* make the result at least that wide. If
* 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.
+ * @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.
*/
iter_type
- put(iter_type __s, ios_base& __f, char_type __fill, long __v) const
- { return this->do_put(__s, __f, __fill, __v); }
+ put(iter_type __s, ios_base& __io, char_type __fill, long __v) const
+ { return this->do_put(__s, __io, __fill, __v); }
iter_type
- put(iter_type __s, ios_base& __f, char_type __fill,
+ put(iter_type __s, ios_base& __io, char_type __fill,
unsigned long __v) const
- { return this->do_put(__s, __f, __fill, __v); }
+ { return this->do_put(__s, __io, __fill, __v); }
#ifdef _GLIBCXX_USE_LONG_LONG
iter_type
- put(iter_type __s, ios_base& __f, char_type __fill, long long __v) const
- { return this->do_put(__s, __f, __fill, __v); }
+ put(iter_type __s, ios_base& __io, char_type __fill, long long __v) const
+ { return this->do_put(__s, __io, __fill, __v); }
iter_type
- put(iter_type __s, ios_base& __f, char_type __fill,
+ put(iter_type __s, ios_base& __io, char_type __fill,
unsigned long long __v) const
- { return this->do_put(__s, __f, __fill, __v); }
+ { return this->do_put(__s, __io, __fill, __v); }
#endif
//@}
* 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().
+ * The decimal point character used is numpunct::decimal_point().
+ * Thousands separators are inserted according to
+ * numpunct::grouping() and numpunct::thousands_sep().
*
* If io.width() is non-zero, enough @a fill characters are inserted to
* make the result at least that wide. If
* 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.
+ * @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.
*/
iter_type
- put(iter_type __s, ios_base& __f, char_type __fill, double __v) const
- { return this->do_put(__s, __f, __fill, __v); }
+ put(iter_type __s, ios_base& __io, char_type __fill, double __v) const
+ { return this->do_put(__s, __io, __fill, __v); }
iter_type
- put(iter_type __s, ios_base& __f, char_type __fill,
+ put(iter_type __s, ios_base& __io, char_type __fill,
long double __v) const
- { return this->do_put(__s, __f, __fill, __v); }
+ { return this->do_put(__s, __io, __fill, __v); }
//@}
/**
* 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.
+ * @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.
*/
iter_type
- put(iter_type __s, ios_base& __f, char_type __fill,
+ put(iter_type __s, ios_base& __io, char_type __fill,
const void* __v) const
- { return this->do_put(__s, __f, __fill, __v); }
+ { return this->do_put(__s, __io, __fill, __v); }
protected:
template<typename _ValueT>
- iter_type
- _M_insert_float(iter_type, ios_base& __io, char_type __fill,
+ iter_type
+ _M_insert_float(iter_type, ios_base& __io, char_type __fill,
char __mod, _ValueT __v) const;
void
char_type* __cs, int& __len) const;
template<typename _ValueT>
- iter_type
- _M_insert_int(iter_type, ios_base& __io, char_type __fill,
+ iter_type
+ _M_insert_int(iter_type, ios_base& __io, char_type __fill,
_ValueT __v) const;
void
* 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.
+ * @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.
*/
virtual iter_type
- do_put(iter_type, ios_base&, char_type __fill, bool __v) const;
+ do_put(iter_type __s, ios_base& __io, char_type __fill, bool __v) const;
virtual iter_type
- do_put(iter_type, ios_base&, char_type __fill, long __v) const;
+ do_put(iter_type __s, ios_base& __io, char_type __fill, long __v) const
+ { return _M_insert_int(__s, __io, __fill, __v); }
virtual iter_type
- do_put(iter_type, ios_base&, char_type __fill, unsigned long) const;
+ do_put(iter_type __s, ios_base& __io, char_type __fill,
+ unsigned long __v) const
+ { return _M_insert_int(__s, __io, __fill, __v); }
#ifdef _GLIBCXX_USE_LONG_LONG
virtual iter_type
- do_put(iter_type, ios_base&, char_type __fill, long long __v) const;
+ do_put(iter_type __s, ios_base& __io, char_type __fill,
+ long long __v) const
+ { return _M_insert_int(__s, __io, __fill, __v); }
virtual iter_type
- do_put(iter_type, ios_base&, char_type __fill, unsigned long long) const;
+ do_put(iter_type __s, ios_base& __io, char_type __fill,
+ unsigned long long __v) const
+ { return _M_insert_int(__s, __io, __fill, __v); }
#endif
virtual iter_type
- do_put(iter_type, ios_base&, char_type __fill, double __v) const;
+ do_put(iter_type, ios_base&, char_type, double) const;
// 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;
+ __do_put(iter_type, ios_base&, char_type, double) const;
#else
virtual iter_type
- do_put(iter_type, ios_base&, char_type __fill, long double __v) const;
+ do_put(iter_type, ios_base&, char_type, long double) const;
#endif
virtual iter_type
- do_put(iter_type, ios_base&, char_type __fill, const void* __v) const;
+ do_put(iter_type, ios_base&, char_type, const void*) const;
// 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;
+ do_put(iter_type, ios_base&, char_type, long double) const;
#endif
//@}
};
template <typename _CharT, typename _OutIter>
locale::id num_put<_CharT, _OutIter>::id;
-_GLIBCXX_END_LDBL_NAMESPACE
+_GLIBCXX_END_NAMESPACE_LDBL
// Subclause convenience interfaces, inlines.
// NB: These are inline because, when used in a loop, some compilers
/// Convenience interface to ctype.is(ctype_base::lower, __c).
template<typename _CharT>
- inline bool
+ inline bool
islower(_CharT __c, const locale& __loc)
{ return use_facet<ctype<_CharT> >(__loc).is(ctype_base::lower, __c); }
tolower(_CharT __c, const locale& __loc)
{ return use_facet<ctype<_CharT> >(__loc).tolower(__c); }
-_GLIBCXX_END_NAMESPACE
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace std
-#ifndef _GLIBCXX_EXPORT_TEMPLATE
# include <bits/locale_facets.tcc>
-#endif
#endif