man std::money_get (Fonctions bibliothèques) - Facet for parsing monetary amounts.

NAME

std::money_get - Facet for parsing monetary amounts.

SYNOPSIS



#include <locale>

Inherits std::locale::facet.

Public Types



typedef CharT char_type

Public typedefs. typedef InIter iter_type

Public typedefs. typedef basic_string< CharT > string_type

Public typedefs.

Public Member Functions

money_get (size_t __refs=0)

Constructor performs initialization. iter_type get (iter_type s, iter_type __end, bool intl, ios_base &__io, ios_base::iostate &__err, long double &__units) const

Read and parse a monetary value. iter_type get (iter_type s, iter_type __end, bool intl, ios_base &__io, ios_base::iostate &__err, string_type &__digits) const

Read and parse a monetary value.

Static Public Attributes

static locale::id id

Numpunct facet id.

Protected Member Functions

virtual ~money_get ()

Destructor. virtual iter_type do_get (iter_type s, iter_type __end, bool intl, ios_base &__io, ios_base::iostate &__err, long double &__units) const

Read and parse a monetary value. virtual iter_type do_get (iter_type s, iter_type __end, bool intl, ios_base &__io, ios_base::iostate &__err, string_type &__digits) const

Read and parse a monetary value. template<bool Intl> iter_type M_extract (iter_type s, iter_type __end, ios_base &__io, ios_base::iostate &__err, string &__digits) const

Static Protected Member Functions

static c_locale S_get_c_locale ()

static const char * S_get_c_name ()

Friends

class locale::Impl

Detailed Description

template<typename CharT, typename InIter> class std::money_get< CharT, InIter >

Facet for parsing monetary amounts.

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.

Definition at line 3962 of file locale.

Member Typedef Documentation

template<typename CharT, typename InIter> typedef CharT std::money_get< CharT, InIter >::char_type

Public typedefs.

Definition at line 3968 of file locale.

template<typename CharT, typename InIter> typedef InIter std::money_get< CharT, InIter >::iter_type

Public typedefs.

Definition at line 3969 of file locale.

template<typename CharT, typename InIter> typedef basic_string<CharT> std::money_get< CharT, InIter >::string_type

Public typedefs.

Definition at line 3970 of file locale.

Constructor & Destructor Documentation

template<typename CharT, typename InIter> std::money_get< CharT, InIter >::money_get (size_t __refs = 0) [inline, explicit]

Constructor performs initialization.

This is the constructor provided by the standard.

Parameters: refs Passed to the base facet class.

Definition at line 3984 of file locale.

template<typename CharT, typename InIter> virtual std::money_get< CharT, InIter >::~money_get () [inline, protected, virtual]

Destructor.

Definition at line 4051 of file locale.

Member Function Documentation

template<typename CharT, typename InIter> InIter std::money_get< CharT, InIter >::do_get (iter_type s, iter_type __end, bool intl, ios_base & __io, ios_base::iostate & __err, string_type & __digits) const [protected, virtual]

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.

Definition at line 1474 of file locale_facets.tcc.

References std::basic_string< CharT, Traits, Alloc >::assign(), and std::ctype_abstract_base< CharT >::widen().

template<typename CharT, typename InIter> InIter std::money_get< CharT, InIter >::do_get (iter_type s, iter_type __end, bool intl, ios_base & __io, ios_base::iostate & __err, long double & __units) const [protected, virtual]

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.

Definition at line 1459 of file locale_facets.tcc.

References std::basic_string< CharT, Traits, Alloc >::c_str().

Referenced by std::money_get< CharT, InIter >::get().

template<typename CharT, typename InIter> iter_type std::money_get< CharT, InIter >::get (iter_type s, iter_type __end, bool intl, ios_base & __io, ios_base::iostate & __err, string_type & __digits) const [inline]

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: s Start of characters to parse.

end End of characters to parse.

intl Parameter to use_facet<moneypunct<CharT,intl> >.

io Source of facets and io state.

err Error field to set if parsing fails.

digits Place to store result of parsing.

Returns: Iterator referencing first character beyond valid money amount.

Definition at line 4044 of file locale.

References std::money_get< CharT, InIter >::do_get().

template<typename CharT, typename InIter> iter_type std::money_get< CharT, InIter >::get (iter_type s, iter_type __end, bool intl, ios_base & __io, ios_base::iostate & __err, long double & __units) const [inline]

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: s Start of characters to parse.

end End of characters to parse.

intl Parameter to use_facet<moneypunct<CharT,intl> >.

io Source of facets and io state.

err Error field to set if parsing fails.

units Place to store result of parsing.

Returns: Iterator referencing first character beyond valid money amount.

Definition at line 4014 of file locale.

References std::money_get< CharT, InIter >::do_get().

Member Data Documentation

template<typename CharT, typename InIter> locale::id std::money_get< CharT, InIter >::id [static]

Numpunct facet id.

Definition at line 3974 of file locale.

Author

Generated automatically by Doxygen for libstdc++-v3 Source from the source code.