GNU g++  v5.2.1
GNU Standard C++
Locales

Functions

namespace std _GLIBCXX_VISIBILITY (default)
 

Detailed Description

Classes and functions for internationalization and localization.

Function Documentation

namespace std _GLIBCXX_VISIBILITY ( default  )

Empty base class for codecvt facet [22.2.1.5].

Common base for codecvt functions.

This template class provides implementations of the public functions that forward to the protected virtual functions.

This template also provides abstract stubs for the protected virtual functions.

Convert from internal to external character set.

Converts input string of intern_type to output string of extern_type. This is analogous to wcsrtombs. It does this by calling codecvt::do_out.

The source and destination character sets are determined by the facet's locale, internal and external types.

The characters in [from,from_end) are converted and written to [to,to_end). from_next and to_next are set to point to the character following the last successfully converted character, respectively. If the result needed no conversion, from_next and to_next are not affected.

The state argument should be initialized if the input is at the beginning and carried from a previous call if continuing conversion. There are no guarantees about how state is used.

The result returned is a member of codecvt_base::result. If all the input is converted, returns codecvt_base::ok. If no conversion is necessary, returns codecvt_base::noconv. If the input ends early or there is insufficient space in the output, returns codecvt_base::partial. Otherwise the conversion failed and codecvt_base::error is returned.

Parameters
__statePersistent conversion state data.
__fromStart of input.
__from_endEnd of input.
__from_nextReturns start of unconverted data.
__toStart of output buffer.
__to_endEnd of output buffer.
__to_nextReturns start of unused output area.
Returns
codecvt_base::result.

Reset conversion state.

Writes characters to output that would restore state to initial conditions. The idea is that if a partial conversion occurs, then the converting the characters written by this function would leave the state in initial conditions, rather than partial conversion state. It does this by calling codecvt::do_unshift().

For example, if 4 external characters always converted to 1 internal character, and input to in() had 6 external characters with state saved, this function would write two characters to the output and set the state to initialized conditions.

The source and destination character sets are determined by the facet's locale, internal and external types.

The result returned is a member of codecvt_base::result. If the state could be reset and data written, returns codecvt_base::ok. If no conversion is necessary, returns codecvt_base::noconv. If the output has insufficient space, returns codecvt_base::partial. Otherwise the reset failed and codecvt_base::error is returned.

Parameters
__statePersistent conversion state data.
__toStart of output buffer.
__to_endEnd of output buffer.
__to_nextReturns start of unused output area.
Returns
codecvt_base::result.

Convert from external to internal character set.

Converts input string of extern_type to output string of intern_type. This is analogous to mbsrtowcs. It does this by calling codecvt::do_in.

The source and destination character sets are determined by the facet's locale, internal and external types.

The characters in [from,from_end) are converted and written to [to,to_end). from_next and to_next are set to point to the character following the last successfully converted character, respectively. If the result needed no conversion, from_next and to_next are not affected.

The state argument should be initialized if the input is at the beginning and carried from a previous call if continuing conversion. There are no guarantees about how state is used.

The result returned is a member of codecvt_base::result. If all the input is converted, returns codecvt_base::ok. If no conversion is necessary, returns codecvt_base::noconv. If the input ends early or there is insufficient space in the output, returns codecvt_base::partial. Otherwise the conversion failed and codecvt_base::error is returned.

Parameters
__statePersistent conversion state data.
__fromStart of input.
__from_endEnd of input.
__from_nextReturns start of unconverted data.
__toStart of output buffer.
__to_endEnd of output buffer.
__to_nextReturns start of unused output area.
Returns
codecvt_base::result.

Convert from internal to external character set.

Converts input string of intern_type to output string of extern_type. This function is a hook for derived classes to change the value returned.

See also
out for more information.

Primary class template codecvt.

NB: Generic, mostly useless implementation.

class codecvt<char, char, mbstate_t> specialization.

class codecvt_byname [22.2.1.6].

Container class for localization functionality.

The locale class is first a class wrapper for C library locales. It is also an extensible container for user-defined localization. A locale is a collection of facets that implement various localization features such as money, time, and number printing.

Constructing C++ locales does not change the C library locale.

This library supports efficient construction and copying of locales through a reference counting implementation of the locale class.

Definition of locale::category.

Category values.

The standard category values are none, ctype, numeric, collate, time, monetary, and messages. They form a bitmask that supports union and intersection. The category all is the union of these values.

NB: Order must match _S_facet_categories definition in locale.cc

Default constructor.

Constructs a copy of the global locale. If no locale has been explicitly set, this is the C locale.

Copy constructor.

Constructs a copy of other.

Parameters
__otherThe locale to copy.

Named locale constructor.

Constructs a copy of the named C library locale.

Parameters
__sName of the locale to construct.
Exceptions
std::runtime_errorif __s is null or an undefined locale.

Construct locale with facets from another locale.

Constructs a copy of the locale base. The facets specified by cat are replaced with those from the locale named by s. If base is named, this locale instance will also be named.

Parameters
__baseThe locale to copy.
__sName of the locale to use facets from.
__catSet of categories defining the facets to use from __s.
Exceptions
std::runtime_errorif __s is null or an undefined locale.

Construct locale with facets from another locale.

Constructs a copy of the locale base. The facets specified by cat are replaced with those from the locale add. If base and add are named, this locale instance will also be named.

Parameters
__baseThe locale to copy.
__addThe locale to use facets from.
__catSet of categories defining the facets to use from add.

Construct locale with another facet.

Constructs a copy of the locale __other. The facet __f is added to __other, replacing an existing facet of type Facet if there is one. If __f is null, this locale is a copy of __other.

Parameters
__otherThe locale to copy.
__fThe facet to add in.

Locale destructor.

Assignment operator.

Set this locale to be a copy of other.

Parameters
__otherThe locale to copy.
Returns
A reference to this locale.

Construct locale with another facet.

Constructs and returns a new copy of this locale. Adds or replaces an existing facet of type Facet from the locale other into the new locale.

Template Parameters
_FacetThe facet type to copy from other
Parameters
__otherThe locale to copy from.
Returns
Newly constructed locale.
Exceptions
std::runtime_errorif __other has no facet of type _Facet.

Return locale name.

Returns
Locale name or "*" if unnamed.

Locale equality.

Parameters
__otherThe locale to compare against.
Returns
True if other and this refer to the same locale instance, are copies, or have the same name. False otherwise.

Locale inequality.

Parameters
__otherThe locale to compare against.
Returns
! (*this == __other)

Compare two strings according to collate.

Template operator to compare two strings using the compare function of the collate facet in this locale. One use is to provide the locale to the sort function. For example, a vector v of strings could be sorted according to locale loc by doing:

1 std::sort(v.begin(), v.end(), loc);
Parameters
__s1First string to compare.
__s2Second string to compare.
Returns
True if collate<_Char> facet compares __s1 < __s2, else false.

Set global locale

This function sets the global locale to the argument and returns a copy of the previous global locale. If the argument has a name, it will also call std::setlocale(LC_ALL, loc.name()).

Parameters
__locThe new locale to make global.
Returns
Copy of the old global locale.

Return reference to the C locale.

Localization functionality base class.

The facet class is the base class for a localization feature, such as money, time, and number printing. It provides common support for facets and reference management.

Facets may not be copied or assigned.

Facet constructor.

This is the constructor provided by the standard. If refs is 0, the facet is destroyed when the last referencing locale is destroyed. Otherwise the facet will never be destroyed.

Parameters
__refsThe initial value for reference count.

Facet destructor.

Facet ID class.

The ID class provides facets with an index used to identify them. Every facet class must define a public static member locale::id, or be derived from a facet that provides this member, otherwise the facet cannot be used in a locale. The locale::id ensures that each class type gets a unique identifier.

Constructor.

Facet for localized string comparison.

This facet encapsulates the code to compare strings in a localized manner.

The collate template uses protected virtual functions to provide the actual results. The public accessors forward the call to the virtual functions. These virtual functions are hooks for developers to implement the behavior they require from the collate facet.

Public typedefs

Numpunct facet id.

Constructor performs initialization.

This is the constructor provided by the standard.

Parameters
__refsPassed to the base facet class.

Internal constructor. Not for general use.

This is a constructor for use by the library itself to set up new locales.

Parameters
__clocThe C locale.
__refsPassed to the base facet class.

Compare two strings.

This function compares two strings and returns the result by calling collate::do_compare().

Parameters
__lo1Start of string 1.
__hi1End of string 1.
__lo2Start of string 2.
__hi2End of string 2.
Returns
1 if string1 > string2, -1 if string1 < string2, else 0.

Transform string to comparable form.

This function is a wrapper for strxfrm functionality. It takes the input string and returns a modified string that can be directly compared to other transformed strings. In the C locale, this function just returns a copy of the input string. In some other locales, it may replace two chars with one, change a char for another, etc. It does so by returning collate::do_transform().

Parameters
__loStart of string.
__hiEnd of string.
Returns
Transformed string_type.

Return hash of a string.

This function computes and returns a hash on the input string. It does so by returning collate::do_hash().

Parameters
__loStart of string.
__hiEnd of string.
Returns
Hash value.

Destructor.

Compare two strings.

This function is a hook for derived classes to change the value returned.

See also
compare().
Parameters
__lo1Start of string 1.
__hi1End of string 1.
__lo2Start of string 2.
__hi2End of string 2.
Returns
1 if string1 > string2, -1 if string1 < string2, else 0.

Transform string to comparable form.

This function is a hook for derived classes to change the value returned.

Parameters
__loStart.
__hiEnd.
Returns
transformed string.

Return hash of a string.

This function computes and returns a hash on the input string. This function is a hook for derived classes to change the value returned.

Parameters
__loStart of string.
__hiEnd of string.
Returns
Hash value.

class collate_byname [22.2.4.2].

Public typedefs

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 abstract stubs for the protected virtual functions.

Typedef for the template parameter

Test char_type classification.

This function finds a mask M for __c and compares it to mask __m. It does so by returning the value of ctype<char_type>::do_is().

Parameters
__cThe char_type to compare the mask of.
__mThe mask to compare against.
Returns
(M & __m) != 0.

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().

Parameters
__loPointer to start of range.
__hiPointer to end of range.
__vecPointer to an array of mask storage.
Returns
__hi.

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().

Parameters
__mThe mask to compare against.
__loPointer to start of range.
__hiPointer to end of range.
Returns
Pointer to matching char_type if found, else __hi.

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().

Parameters
__mThe mask to compare against.
__loPointer to first char in range.
__hiPointer to end of range.
Returns
Pointer to non-matching char if found, else __hi.

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().

Parameters
__cThe char_type to convert.
Returns
The uppercase char_type if convertible, else __c.

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).

Parameters
__loPointer to start of range.
__hiPointer to end of range.
Returns
__hi.

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).

Parameters
__cThe char_type to convert.
Returns
The lowercase char_type if convertible, else __c.

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).

Parameters
__loPointer to start of range.
__hiPointer to end of range.
Returns
__hi.

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.

Parameters
__cThe char to convert.
Returns
The converted char_type.

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.

Parameters
__loPointer to start of range.
__hiPointer to end of range.
__toPointer to the destination array.
Returns
__hi.

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.

Parameters
__cThe char_type to convert.
__dfaultChar to return if conversion fails.
Returns
The converted char.

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, 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.

Parameters
__loPointer to start of range.
__hiPointer to end of range.
__dfaultChar to use if conversion fails.
__toPointer to the destination array.
Returns
__hi.

Test char_type classification.

This function finds a mask M for c and compares it to mask 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.

Parameters
__cThe char_type to find the mask of.
__mThe mask to compare against.
Returns
(M & __m) != 0.

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.

Parameters
__loPointer to start of range.
__hiPointer to end of range.
__vecPointer to an array of mask storage.
Returns
__hi.

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.

Parameters
__mThe mask to compare against.
__loPointer to start of range.
__hiPointer to end of range.
Returns
Pointer to a matching char_type if found, else __hi.

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.

Parameters
__mThe mask to compare against.
__loPointer to start of range.
__hiPointer to end of range.
Returns
Pointer to a non-matching char_type if found, else __hi.

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.

Parameters
__cThe char_type to convert.
Returns
The uppercase char_type if convertible, else __c.

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.

Parameters
__loPointer to start of range.
__hiPointer to end of range.
Returns
__hi.

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.

Parameters
__cThe char_type to convert.
Returns
The lowercase char_type if convertible, else __c.

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.

Parameters
__loPointer to start of range.
__hiPointer to end of range.
Returns
__hi.

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.

Parameters
__cThe char to convert.
Returns
The converted char_type

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.

Parameters
__loPointer to start range.
__hiPointer to end of range.
__toPointer to the destination array.
Returns
__hi.

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.

Parameters
__cThe char_type to convert.
__dfaultChar to return if conversion fails.
Returns
The converted char.

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, __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.

Parameters
__loPointer to start of range.
__hiPointer to end of range.
__dfaultChar to use if conversion fails.
__toPointer to the destination array.
Returns
__hi.

Primary class 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.

The facet id for ctype<char_type>

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.

Typedef for the template parameter char.

The facet id for ctype<char>

The size of the mask table. It is SCHAR_MAX + 1.

Constructor performs initialization.

This is the constructor provided by the standard.

Parameters
__tableIf non-zero, table is used as the per-char mask. Else classic_table() is used.
__delIf true, passes ownership of table to this facet.
__refsPassed to the base facet class.

Constructor performs static initialization.

This constructor is used to construct the initial C locale facet.

Parameters
__clocHandle to C locale data.
__tableIf non-zero, table is used as the per-char mask.
__delIf true, passes ownership of table to this facet.
__refsPassed to the base facet class.

Test char classification.

This function compares the mask table[c] to __m.

Parameters
__cThe char to compare the mask of.
__mThe mask to compare against.
Returns
True if __m & table[__c] is true, false otherwise.

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.

Parameters
__loPointer to start of range.
__hiPointer to end of range.
__vecPointer to an array of mask storage.
Returns
__hi.

Find char matching a mask

This function searches for and returns the first char in [lo,hi) for which is(m,char) is true.

Parameters
__mThe mask to compare against.
__loPointer to start of range.
__hiPointer to end of range.
Returns
Pointer to a matching char if found, else __hi.

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.

Parameters
__mThe mask to compare against.
__loPointer to start of range.
__hiPointer to end of range.
Returns
Pointer to a non-matching char if found, else __hi.

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.

Parameters
__cThe char to convert.
Returns
The uppercase char if convertible, else __c.

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.

Parameters
__loPointer to first char in range.
__hiPointer to end of range.
Returns
__hi.

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.

Parameters
__cThe char to convert.
Returns
The lowercase char if convertible, else __c.

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.

Parameters
__loPointer to first char in range.
__hiPointer to end of range.
Returns
__hi.

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.

Parameters
__cThe char to convert.
Returns
The converted character.

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.

Parameters
__loPointer to first char in range.
__hiPointer to end of range.
__toPointer to the destination array.
Returns
__hi.

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, 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.

Parameters
__cThe char to convert.
__dfaultChar to return if conversion fails.
Returns
The converted character.

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, 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.

Parameters
__loPointer to start of range.
__hiPointer to end of range.
__dfaultChar to use if conversion fails.
__toPointer to the destination array.
Returns
__hi.

Returns a pointer to the mask table provided to the constructor, or the default from classic_table() if none was provided.

Returns a pointer to the C locale mask table.

Destructor.

This function deletes table() if del was true in the constructor.

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.

Parameters
__cThe char to convert.
Returns
The uppercase char if convertible, else __c.

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.

Parameters
__loPointer to start of range.
__hiPointer to end of range.
Returns
__hi.

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.

Parameters
__cThe char to convert.
Returns
The lowercase char if convertible, else __c.

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.

Parameters
__loPointer to first char in range.
__hiPointer to end of range.
Returns
__hi.

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.

Parameters
__cThe char to convert.
Returns
The converted character.

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.

Parameters
__loPointer to start of range.
__hiPointer to end of range.
__toPointer to the destination array.
Returns
__hi.

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, 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.

Parameters
__cThe char to convert.
__dfaultChar to return if conversion fails.
Returns
The converted char.

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, 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.

Parameters
__loPointer to start of range.
__hiPointer to end of range.
__dfaultChar to use if conversion fails.
__toPointer to the destination array.
Returns
__hi.

class ctype_byname [22.2.1.2].

22.2.1.4 Class ctype_byname specializations.

Primary class template numpunct.

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.

Public typedefs

Numpunct facet id.

Numpunct constructor.

Parameters
__refsRefcount to pass to the base class.

Internal constructor. Not for general use.

This is a constructor for use by the library itself to set up the predefined locale facets.

Parameters
__cache__numpunct_cache object.
__refsRefcount to pass to the base class.

Internal constructor. Not for general use.

This is a constructor for use by the library itself to set up new locales.

Parameters
__clocThe C locale.
__refsRefcount to pass to the base class.

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().

Returns
char_type representing a decimal point.

Return thousands separator character.

This function returns a char_type to use as a thousands separator. It does so by returning returning numpunct<char_type>::do_thousands_sep().

Returns
char_type representing a thousands separator.

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.

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 string are required to group a number, the last char is used repeatedly.

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.

The string is returned by calling numpunct<char_type>::do_grouping().

Returns
string representing grouping specification.

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().

Returns
string_type representing printed form of true.

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().

Returns
string_type representing printed form of false.

Destructor.

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.

Returns
char_type representing a decimal point.

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.

Returns
char_type representing a thousands separator.

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 also
grouping() for details.
Returns
String representing grouping specification.

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.

Returns
string_type representing printed form of true.

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.

Returns
string_type representing printed form of false.

class numpunct_byname [22.2.3.2].

Primary class template num_get.

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.

Public typedefs

Numpunct facet id.

Constructor performs initialization.

This is the constructor provided by the standard.

Parameters
__refsPassed to the base facet class.

Numeric parsing.

Parses the input stream into the bool v. It does so by calling num_get::do_get().

If ios_base::boolalpha is set, attempts to read ctype<CharT>::truename() or ctype<CharT>::falsename(). Sets 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.

If ios_base::boolalpha is not set, proceeds as with reading a long, except if the value is 1, sets v to true, if the value is 0, sets v to false, and otherwise set err to ios_base::failbit.

Parameters
__inStart of input stream.
__endEnd of input stream.
__ioSource of locale and flags.
__errError flags to set.
__vValue to format and insert.
Returns
Iterator after reading.

Numeric parsing.

Parses the input stream into the integral variable v. It does so by calling num_get::do_get().

Parsing is affected by the flag settings in 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 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 v, v is set. Otherwise, sets err to ios_base::failbit and leaves v unaltered. Sets err to ios_base::eofbit if the stream is emptied.

Parameters
__inStart of input stream.
__endEnd of input stream.
__ioSource of locale and flags.
__errError flags to set.
__vValue to format and insert.
Returns
Iterator after reading.

Numeric parsing.

Parses the input stream into the integral variable v. It does so by calling num_get::do_get().

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 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 v, v is set. Otherwise, sets err to ios_base::failbit and leaves v unaltered. Sets err to ios_base::eofbit if the stream is emptied.

Parameters
__inStart of input stream.
__endEnd of input stream.
__ioSource of locale and flags.
__errError flags to set.
__vValue to format and insert.
Returns
Iterator after reading.

Numeric parsing.

Parses the input stream into the pointer variable v. It does so by calling num_get::do_get().

The input characters are parsed like the scanf p specifier.

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.

If parsing the string yields a valid value for v, v is set. Otherwise, sets err to ios_base::failbit and leaves v unaltered. Sets err to ios_base::eofbit if the stream is emptied.

Parameters
__inStart of input stream.
__endEnd of input stream.
__ioSource of locale and flags.
__errError flags to set.
__vValue to format and insert.
Returns
Iterator after reading.

Destructor.

Numeric parsing.

Parses the input stream into the variable v. This function is a hook for derived classes to change the value returned.

See also
get() for more details.
Parameters
__begStart of input stream.
__endEnd of input stream.
__ioSource of locale and flags.
__errError flags to set.
__vValue to format and insert.
Returns
Iterator after reading.

Primary class template num_put.

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.

Public typedefs

Numpunct facet id.

Constructor performs initialization.

This is the constructor provided by the standard.

Parameters
__refsPassed to the base facet class.

Numeric formatting.

Formats the boolean 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 v as an int.

Parameters
__sStream to write to.
__ioSource of locale and flags.
__fillChar_type to use for filling.
__vValue to format and insert.
Returns
Iterator after writing.

Numeric formatting.

Formats the integral value v and inserts it into a stream. It does so by calling num_put::do_put().

Formatting is affected by the flag settings in 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.

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 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.

Parameters
__sStream to write to.
__ioSource of locale and flags.
__fillChar_type to use for filling.
__vValue to format and insert.
Returns
Iterator after writing.

Numeric formatting.

Formats the floating point value v and inserts it into a stream. It does so by calling num_put::do_put().

Formatting is affected by the flag settings in 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.

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 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.

Parameters
__sStream to write to.
__ioSource of locale and flags.
__fillChar_type to use for filling.
__vValue to format and insert.
Returns
Iterator after writing.

Numeric formatting.

Formats the pointer value v and inserts it into a stream. It does so by calling num_put::do_put().

This function formats v as an unsigned long with ios_base::hex and ios_base::showbase set.

Parameters
__sStream to write to.
__ioSource of locale and flags.
__fillChar_type to use for filling.
__vValue to format and insert.
Returns
Iterator after writing.

Destructor.

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.

Parameters
__sStream to write to.
__ioSource of locale and flags.
__fillChar_type to use for filling.
__vValue to format and insert.
Returns
Iterator after writing.

Convenience interface to ctype.is(ctype_base::space, __c).

Convenience interface to ctype.is(ctype_base::print, __c).

Convenience interface to ctype.is(ctype_base::cntrl, __c).

Convenience interface to ctype.is(ctype_base::upper, __c).

Convenience interface to ctype.is(ctype_base::lower, __c).

Convenience interface to ctype.is(ctype_base::alpha, __c).

Convenience interface to ctype.is(ctype_base::digit, __c).

Convenience interface to ctype.is(ctype_base::punct, __c).

Convenience interface to ctype.is(ctype_base::xdigit, __c).

Convenience interface to ctype.is(ctype_base::alnum, __c).

Convenience interface to ctype.is(ctype_base::graph, __c).

Convenience interface to ctype.toupper(__c).

Convenience interface to ctype.tolower(__c).

Time format ordering data.

This class provides an enum representing different orderings of time: day, month, and year.

Numpunct facet id.

Internal constructor. Not for general use.

This is a constructor for use by the library itself to set up new locales.

Parameters
__clocThe C locale.
__sThe name of a locale.
refsPassed to the base facet class.

Primary class template time_get.

This facet encapsulates the code to parse and return a date or time from a string. It is used by the istream numeric extraction operators.

The time_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 time_get facet.

Public typedefs

Numpunct facet id.

Constructor performs initialization.

This is the constructor provided by the standard.

Parameters
__refsPassed to the base facet class.

Return preferred order of month, day, and year.

This function returns an enum from time_base::dateorder giving the preferred ordering if the format x given to time_put::put() only uses month, day, and year. If the format x for the associated locale uses other fields, this function returns time_base::dateorder::noorder.

NOTE: The library always returns noorder at the moment.

Returns
A member of time_base::dateorder.

Parse input time string.

This function parses a time according to the format X and puts the results into a user-supplied struct tm. The result is returned by calling time_get::do_get_time().

If there is a valid time string according to format X, tm will be filled in accordingly and the returned iterator will point to the first character beyond the time string. If an error occurs before the end, err |= ios_base::failbit. If parsing reads all the characters, err |= ios_base::eofbit.

Parameters
__begStart of string to parse.
__endEnd of string to parse.
__ioSource of the locale.
__errError flags to set.
__tmPointer to struct tm to fill in.
Returns
Iterator to first char beyond time string.

Parse input date string.

This function parses a date according to the format x and puts the results into a user-supplied struct tm. The result is returned by calling time_get::do_get_date().

If there is a valid date string according to format x, tm will be filled in accordingly and the returned iterator will point to the first character beyond the date string. If an error occurs before the end, err |= ios_base::failbit. If parsing reads all the characters, err |= ios_base::eofbit.

Parameters
__begStart of string to parse.
__endEnd of string to parse.
__ioSource of the locale.
__errError flags to set.
__tmPointer to struct tm to fill in.
Returns
Iterator to first char beyond date string.

Parse input weekday string.

This function parses a weekday name and puts the results into a user-supplied struct tm. The result is returned by calling time_get::do_get_weekday().

Parsing starts by parsing an abbreviated weekday name. If a valid abbreviation is followed by a character that would lead to the full weekday name, parsing continues until the full name is found or an error occurs. Otherwise parsing finishes at the end of the abbreviated name.

If an error occurs before the end, err |= ios_base::failbit. If parsing reads all the characters, err |= ios_base::eofbit.

Parameters
__begStart of string to parse.
__endEnd of string to parse.
__ioSource of the locale.
__errError flags to set.
__tmPointer to struct tm to fill in.
Returns
Iterator to first char beyond weekday name.

Parse input month string.

This function parses a month name and puts the results into a user-supplied struct tm. The result is returned by calling time_get::do_get_monthname().

Parsing starts by parsing an abbreviated month name. If a valid abbreviation is followed by a character that would lead to the full month name, parsing continues until the full name is found or an error occurs. Otherwise parsing finishes at the end of the abbreviated name.

If an error occurs before the end, err |= ios_base::failbit. If parsing reads all the characters, err |= ios_base::eofbit.

Parameters
__begStart of string to parse.
__endEnd of string to parse.
__ioSource of the locale.
__errError flags to set.
__tmPointer to struct tm to fill in.
Returns
Iterator to first char beyond month name.

Parse input year string.

This function reads up to 4 characters to parse a year string and puts the results into a user-supplied struct tm. The result is returned by calling time_get::do_get_year().

4 consecutive digits are interpreted as a full year. If there are exactly 2 consecutive digits, the library interprets this as the number of years since 1900.

If an error occurs before the end, err |= ios_base::failbit. If parsing reads all the characters, err |= ios_base::eofbit.

Parameters
__begStart of string to parse.
__endEnd of string to parse.
__ioSource of the locale.
__errError flags to set.
__tmPointer to struct tm to fill in.
Returns
Iterator to first char beyond year.

Destructor.

Return preferred order of month, day, and year.

This function returns an enum from time_base::dateorder giving the preferred ordering if the format x given to time_put::put() only uses month, day, and year. This function is a hook for derived classes to change the value returned.

Returns
A member of time_base::dateorder.

Parse input time string.

This function parses a time according to the format x and puts the results into a user-supplied struct tm. This function is a hook for derived classes to change the value returned.

See also
get_time() for details.
Parameters
__begStart of string to parse.
__endEnd of string to parse.
__ioSource of the locale.
__errError flags to set.
__tmPointer to struct tm to fill in.
Returns
Iterator to first char beyond time string.

Parse input date string.

This function parses a date according to the format X and puts the results into a user-supplied struct tm. This function is a hook for derived classes to change the value returned.

See also
get_date() for details.
Parameters
__begStart of string to parse.
__endEnd of string to parse.
__ioSource of the locale.
__errError flags to set.
__tmPointer to struct tm to fill in.
Returns
Iterator to first char beyond date string.

Parse input weekday string.

This function parses a weekday name and puts the results into a user-supplied struct tm. This function is a hook for derived classes to change the value returned.

See also
get_weekday() for details.
Parameters
__begStart of string to parse.
__endEnd of string to parse.
__ioSource of the locale.
__errError flags to set.
__tmPointer to struct tm to fill in.
Returns
Iterator to first char beyond weekday name.

Parse input month string.

This function parses a month name and puts the results into a user-supplied struct tm. This function is a hook for derived classes to change the value returned.

See also
get_monthname() for details.
Parameters
__begStart of string to parse.
__endEnd of string to parse.
__ioSource of the locale.
__errError flags to set.
__tmPointer to struct tm to fill in.
Returns
Iterator to first char beyond month name.

Parse input year string.

This function reads up to 4 characters to parse a year string and puts the results into a user-supplied struct tm. This function is a hook for derived classes to change the value returned.

See also
get_year() for details.
Parameters
__begStart of string to parse.
__endEnd of string to parse.
__ioSource of the locale.
__errError flags to set.
__tmPointer to struct tm to fill in.
Returns
Iterator to first char beyond year.

class time_get_byname [22.2.5.2].

Primary class template time_put.

This facet encapsulates the code to format and output dates and times according to formats used by strftime().

The time_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 time_put facet.

Public typedefs

Numpunct facet id.

Constructor performs initialization.

This is the constructor provided by the standard.

Parameters
__refsPassed to the base facet class.

Format and output a time or date.

This function formats the data in struct tm according to the provided format string. The format string is interpreted as by strftime().

Parameters
__sThe stream to write to.
__ioSource of locale.
__fillchar_type to use for padding.
__tmStruct tm with date and time info to format.
__begStart of format string.
__endEnd of format string.
Returns
Iterator after writing.

Format and output a time or date.

This function formats the data in struct tm according to the provided format char and optional modifier. The format and modifier are interpreted as by strftime(). It does so by returning time_put::do_put().

Parameters
__sThe stream to write to.
__ioSource of locale.
__fillchar_type to use for padding.
__tmStruct tm with date and time info to format.
__formatFormat char.
__modOptional modifier char.
Returns
Iterator after writing.

Destructor.

Format and output a time or date.

This function formats the data in struct tm according to the provided format char and optional modifier. This function is a hook for derived classes to change the value returned.

See also
put() for more details.
Parameters
__sThe stream to write to.
__ioSource of locale.
__fillchar_type to use for padding.
__tmStruct tm with date and time info to format.
__formatFormat char.
__modOptional modifier char.
Returns
Iterator after writing.

class time_put_byname [22.2.5.4].

Money format ordering data.

This class contains an ordered array of 4 fields to represent the pattern for formatting a money amount. Each field may contain one entry from the part enum. symbol, sign, and value must be present and the remaining field must contain either none or space.

See also
moneypunct::pos_format() and moneypunct::neg_format() for details of how these fields are interpreted.

Primary class template moneypunct.

This facet encapsulates the punctuation, grouping and other formatting features of money amount string representations.

Public typedefs

This value is provided by the standard, but no reason for its existence.

Numpunct facet id.

Constructor performs initialization.

This is the constructor provided by the standard.

Parameters
__refsPassed to the base facet class.

Constructor performs initialization.

This is an internal constructor.

Parameters
__cacheCache for optimization.
__refsPassed to the base facet class.

Internal constructor. Not for general use.

This is a constructor for use by the library itself to set up new locales.

Parameters
__clocThe C locale.
__sThe name of a locale.
__refsPassed to the base facet class.

Return decimal point character.

This function returns a char_type to use as a decimal point. It does so by returning returning moneypunct<char_type>::do_decimal_point().

Returns
char_type representing a decimal point.

Return thousands separator character.

This function returns a char_type to use as a thousands separator. It does so by returning returning moneypunct<char_type>::do_thousands_sep().

Returns
char_type representing a thousands separator.

Return grouping specification.

This function returns a string representing groupings for the integer part of an amount. Groupings indicate where thousands separators should be inserted.

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 string are required to group a number, the last char is used repeatedly.

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.

The string is returned by calling moneypunct<char_type>::do_grouping().

Returns
string representing grouping specification.

Return currency symbol string.

This function returns a string_type to use as a currency symbol. It does so by returning returning moneypunct<char_type>::do_curr_symbol().

Returns
string_type representing a currency symbol.

Return positive sign string.

This function returns a string_type to use as a sign for positive amounts. It does so by returning returning moneypunct<char_type>::do_positive_sign().

If the return value contains more than one character, the first character appears in the position indicated by pos_format() and the remainder appear at the end of the formatted string.

Returns
string_type representing a positive sign.

Return negative sign string.

This function returns a string_type to use as a sign for negative amounts. It does so by returning returning moneypunct<char_type>::do_negative_sign().

If the return value contains more than one character, the first character appears in the position indicated by neg_format() and the remainder appear at the end of the formatted string.

Returns
string_type representing a negative sign.

Return number of digits in fraction.

This function returns the exact number of digits that make up the fractional part of a money amount. It does so by returning returning moneypunct<char_type>::do_frac_digits().

The fractional part of a money amount is optional. But if it is present, there must be frac_digits() digits.

Returns
Number of digits in amount fraction.

Return pattern for money values.

This function returns a pattern describing the formatting of a positive or negative valued money amount. It does so by returning returning moneypunct<char_type>::do_pos_format() or moneypunct<char_type>::do_neg_format().

The pattern has 4 fields describing the ordering of symbol, sign, value, and none or space. There must be one of each in the pattern. The none and space enums may not appear in the first field and space may not appear in the final field.

The parts of a money string must appear in the order indicated by the fields of the pattern. The symbol field indicates that the value of curr_symbol() may be present. The sign field indicates that the value of positive_sign() or negative_sign() must be present. The value field indicates that the absolute value of the money amount is present. none indicates 0 or more whitespace characters, except at the end, where it permits no whitespace. space indicates that 1 or more whitespace characters must be present.

For example, for the US locale and pos_format() pattern {symbol,sign,value,none}, curr_symbol() == '$' positive_sign() == '+', and value 10.01, and options set to force the symbol, the corresponding string is $+10.01.

Returns
Pattern for money values.

Destructor.

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.

Returns
char_type representing a decimal point.

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.

Returns
char_type representing a thousands separator.

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 also
grouping() for details.
Returns
String representing grouping specification.

Return currency symbol string.

This function returns a string_type to use as a currency symbol. This function is a hook for derived classes to change the value returned.

See also
curr_symbol() for details.
Returns
string_type representing a currency symbol.

Return positive sign string.

This function returns a string_type to use as a sign for positive amounts. This function is a hook for derived classes to change the value returned.

See also
positive_sign() for details.
Returns
string_type representing a positive sign.

Return negative sign string.

This function returns a string_type to use as a sign for negative amounts. This function is a hook for derived classes to change the value returned.

See also
negative_sign() for details.
Returns
string_type representing a negative sign.

Return number of digits in fraction.

This function returns the exact number of digits that make up the fractional part of a money amount. This function is a hook for derived classes to change the value returned.

See also
frac_digits() for details.
Returns
Number of digits in amount fraction.

Return pattern for money values.

This function returns a pattern describing the formatting of a positive valued money amount. This function is a hook for derived classes to change the value returned.

See also
pos_format() for details.
Returns
Pattern for money values.

Return pattern for money values.

This function returns a pattern describing the formatting of a negative valued money amount. This function is a hook for derived classes to change the value returned.

See also
neg_format() for details.
Returns
Pattern for money values.

class moneypunct_byname [22.2.6.4].

Primary class template money_get.

This facet encapsulates the code to parse and return a monetary amount from a string.

The money_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 money_get facet.

Public typedefs

Numpunct facet id.

Constructor performs initialization.

This is the constructor provided by the standard.

Parameters
__refsPassed to the base facet class.

Read and parse a monetary value.

This function reads characters from __s, interprets them as a monetary value according to moneypunct and ctype facets retrieved from io.getloc(), and returns the result in units as an integral value moneypunct::frac_digits() * the actual amount. For example, the string $10.01 in a US locale would store 1001 in units.

Any characters not part of a valid money amount are not consumed.

If a money value cannot be parsed from the input stream, sets err=(err|io.failbit). If the stream is consumed before finishing parsing, sets err=(err|io.failbit|io.eofbit). units is unchanged if parsing fails.

This function works by returning the result of do_get().

Parameters
__sStart of characters to parse.
__endEnd of characters to parse.
__intlParameter to use_facet<moneypunct<CharT,intl> >.
__ioSource of facets and io state.
__errError field to set if parsing fails.
__unitsPlace to store result of parsing.
Returns
Iterator referencing first character beyond valid money amount.

Read and parse a monetary value.

This function reads characters from __s, interprets them as a monetary value according to moneypunct and ctype facets retrieved from io.getloc(), and returns the result in digits. For example, the string $10.01 in a US locale would store 1001 in digits.

Any characters not part of a valid money amount are not consumed.

If a money value cannot be parsed from the input stream, sets err=(err|io.failbit). If the stream is consumed before finishing parsing, sets err=(err|io.failbit|io.eofbit).

This function works by returning the result of do_get().

Parameters
__sStart of characters to parse.
__endEnd of characters to parse.
__intlParameter to use_facet<moneypunct<CharT,intl> >.
__ioSource of facets and io state.
__errError field to set if parsing fails.
__digitsPlace to store result of parsing.
Returns
Iterator referencing first character beyond valid money amount.

Destructor.

Read and parse a monetary value.

This function reads and parses characters representing a monetary value. This function is a hook for derived classes to change the value returned.

See also
get() for details.

Read and parse a monetary value.

This function reads and parses characters representing a monetary value. This function is a hook for derived classes to change the value returned.

See also
get() for details.

Primary class template money_put.

This facet encapsulates the code to format and output a monetary amount.

The money_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 money_put facet.

Public typedefs

Numpunct facet id.

Constructor performs initialization.

This is the constructor provided by the standard.

Parameters
__refsPassed to the base facet class.

Format and output a monetary value.

This function formats units as a monetary value according to moneypunct and ctype facets retrieved from io.getloc(), and writes the resulting characters to __s. For example, the value 1001 in a US locale would write $10.01 to __s.

This function works by returning the result of do_put().

Parameters
__sThe stream to write to.
__intlParameter to use_facet<moneypunct<CharT,intl> >.
__ioSource of facets and io state.
__fillchar_type to use for padding.
__unitsPlace to store result of parsing.
Returns
Iterator after writing.

Format and output a monetary value.

This function formats digits as a monetary value according to moneypunct and ctype facets retrieved from io.getloc(), and writes the resulting characters to __s. For example, the string 1001 in a US locale would write $10.01 to __s.

This function works by returning the result of do_put().

Parameters
__sThe stream to write to.
__intlParameter to use_facet<moneypunct<CharT,intl> >.
__ioSource of facets and io state.
__fillchar_type to use for padding.
__digitsPlace to store result of parsing.
Returns
Iterator after writing.

Destructor.

Format and output a monetary value.

This function formats units as a monetary value according to moneypunct and ctype facets retrieved from io.getloc(), and writes the resulting characters to __s. For example, the value 1001 in a US locale would write $10.01 to __s.

This function is a hook for derived classes to change the value returned.

See also
put().
Parameters
__sThe stream to write to.
__intlParameter to use_facet<moneypunct<CharT,intl> >.
__ioSource of facets and io state.
__fillchar_type to use for padding.
__unitsPlace to store result of parsing.
Returns
Iterator after writing.

Format and output a monetary value.

This function formats digits as a monetary value according to moneypunct and ctype facets retrieved from io.getloc(), and writes the resulting characters to __s. For example, the string 1001 in a US locale would write $10.01 to __s.

This function is a hook for derived classes to change the value returned.

See also
put().
Parameters
__sThe stream to write to.
__intlParameter to use_facet<moneypunct<CharT,intl> >.
__ioSource of facets and io state.
__fillchar_type to use for padding.
__digitsPlace to store result of parsing.
Returns
Iterator after writing.

Messages facet base class providing catalog typedef.

Primary class template messages.

This facet encapsulates the code to retrieve messages from message catalogs. The only thing defined by the standard for this facet is the interface. All underlying functionality is implementation-defined.

This library currently implements 3 versions of the message facet. The first version (gnu) is a wrapper around gettext, provided by libintl. The second version (ieee) is a wrapper around catgets. The final version (default) does no actual translation. These implementations are only provided for char and wchar_t instantiations.

The messages 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 messages facet.

Public typedefs

Numpunct facet id.

Constructor performs initialization.

This is the constructor provided by the standard.

Parameters
__refsPassed to the base facet class.

Internal constructor. Not for general use.

This is a constructor for use by the library itself to set up new locales.

Parameters
__clocThe C locale.
__sThe name of a locale.
__refsRefcount to pass to the base class.

Destructor.

Specializations for required instantiations.

class messages_byname [22.2.7.2].