#include <locale_facets.h>
Inheritance diagram for std::money_get< _CharT, _InIter >:
Public Types | |
typedef _CharT | char_type |
Public typedefs. | |
typedef _InIter | iter_type |
typedef basic_string< _CharT > | string_type |
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 |
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 3998 of file locale_facets.h.
typedef _CharT std::money_get< _CharT, _InIter >::char_type |
typedef _InIter std::money_get< _CharT, _InIter >::iter_type |
Definition at line 4005 of file locale_facets.h.
typedef basic_string<_CharT> std::money_get< _CharT, _InIter >::string_type |
Definition at line 4006 of file locale_facets.h.
std::money_get< _CharT, _InIter >::money_get | ( | size_t | __refs = 0 |
) | [inline, explicit] |
Constructor performs initialization.
This is the constructor provided by the standard.
refs | Passed to the base facet class. |
Definition at line 4020 of file locale_facets.h.
virtual std::money_get< _CharT, _InIter >::~money_get | ( | ) | [inline, protected, virtual] |
_InIter std::money_get< _CharT, _InIter >::_M_extract | ( | iter_type | __s, | |
iter_type | __end, | |||
ios_base & | __io, | |||
ios_base::iostate & | __err, | |||
string & | __digits | |||
) | const [protected] |
Definition at line 1298 of file locale_facets.tcc.
References std::__verify_grouping(), std::ios_base::_M_getloc(), std::money_base::_S_atoms, std::money_base::_S_zero, std::basic_string< _CharT, _Traits, _Alloc >::begin(), std::basic_string< _CharT, _Traits, _Alloc >::empty(), std::ios_base::eofbit, std::basic_string< _CharT, _Traits, _Alloc >::erase(), std::ios_base::failbit, std::money_base::pattern::field, std::find(), std::basic_string< _CharT, _Traits, _Alloc >::find_first_not_of(), std::ios_base::flags(), std::basic_string< _CharT, _Traits, _Alloc >::insert(), std::__ctype_abstract_base< _CharT >::is(), std::money_base::none, std::basic_string< _CharT, _Traits, _Alloc >::npos, std::basic_string< _CharT, _Traits, _Alloc >::reserve(), std::ios_base::showbase, std::money_base::sign, std::basic_string< _CharT, _Traits, _Alloc >::size(), ctype_base::space, std::money_base::space, std::basic_string< _CharT, _Traits, _Alloc >::swap(), std::money_base::symbol, and std::money_base::value.
_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.
Definition at line 1545 of file locale_facets.tcc.
References std::ios_base::_M_getloc(), std::basic_string< _CharT, _Traits, _Alloc >::assign(), and std::__ctype_abstract_base< _CharT >::widen().
_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.
Definition at line 1530 of file locale_facets.tcc.
References std::__convert_to_v(), std::locale::facet::_S_get_c_locale(), and std::basic_string< _CharT, _Traits, _Alloc >::c_str().
Referenced by std::money_get< _CharT, _InIter >::get().
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().
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. |
Definition at line 4080 of file locale_facets.h.
References std::money_get< _CharT, _InIter >::do_get().
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().
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. |
Definition at line 4050 of file locale_facets.h.
References std::money_get< _CharT, _InIter >::do_get().
locale::id std::money_get< _CharT, _InIter >::id [static] |