man std::num_get (Fonctions bibliothèques) - Facet for parsing number strings.

NAME

std::num_get - Facet for parsing number strings.

SYNOPSIS



#include <locale>

Inherits std::locale::facet.

Public Types



typedef CharT char_type

Public typedefs. typedef InIter iter_type

Public typedefs.

Public Member Functions

num_get (size_t __refs=0)

Constructor performs initialization. iter_type get (iter_type in, iter_type __end, ios_base &__io, ios_base::iostate &__err, bool &__v) const

Numeric parsing. iter_type get (iter_type in, iter_type __end, ios_base &__io, ios_base::iostate &__err, void *&__v) const

Numeric parsing.



iter_type get (iter_type in, iter_type __end, ios_base &__io, ios_base::iostate &__err, long &__v) const

Numeric parsing. iter_type get (iter_type in, iter_type __end, ios_base &__io, ios_base::iostate &__err, unsigned short &__v) const

Numeric parsing. iter_type get (iter_type in, iter_type __end, ios_base &__io, ios_base::iostate &__err, unsigned int &__v) const

Numeric parsing. iter_type get (iter_type in, iter_type __end, ios_base &__io, ios_base::iostate &__err, unsigned long &__v) const

Numeric parsing.



iter_type get (iter_type in, iter_type __end, ios_base &__io, ios_base::iostate &__err, float &__v) const

Numeric parsing. iter_type get (iter_type in, iter_type __end, ios_base &__io, ios_base::iostate &__err, double &__v) const

Numeric parsing. iter_type get (iter_type in, iter_type __end, ios_base &__io, ios_base::iostate &__err, long double &__v) const

Numeric parsing.

Static Public Attributes

static locale::id id

Numpunct facet id.

Protected Member Functions

virtual ~num_get ()

Destructor. iter_type M_extract_float (iter_type, iter_type, ios_base &, ios_base::iostate &, string &xtrc) const

template<typename ValueT> iter_type M_extract_int (iter_type, iter_type, ios_base &, ios_base::iostate &, ValueT &__v) const



virtual iter_type do_get (iter_type, iter_type, ios_base &, ios_base::iostate &, bool &) const

Numeric parsing. virtual iter_type do_get (iter_type, iter_type, ios_base &, ios_base::iostate &, long &) const

Numeric parsing. virtual iter_type do_get (iter_type, iter_type, ios_base &, ios_base::iostate &__err, unsigned short &) const

Numeric parsing. virtual iter_type do_get (iter_type, iter_type, ios_base &, ios_base::iostate &__err, unsigned int &) const

Numeric parsing. virtual iter_type do_get (iter_type, iter_type, ios_base &, ios_base::iostate &__err, unsigned long &) const

Numeric parsing. virtual iter_type do_get (iter_type, iter_type, ios_base &, ios_base::iostate &__err, float &) const

Numeric parsing. virtual iter_type do_get (iter_type, iter_type, ios_base &, ios_base::iostate &__err, double &) const

Numeric parsing. virtual iter_type do_get (iter_type, iter_type, ios_base &, ios_base::iostate &__err, long double &) const

Numeric parsing. virtual iter_type do_get (iter_type, iter_type, ios_base &, ios_base::iostate &__err, void *&) const

Numeric parsing.

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::num_get< CharT, InIter >

Facet for parsing number strings.

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

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

Definition at line 1925 of file locale.

Member Typedef Documentation

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

Public typedefs.

Definition at line 1931 of file locale.

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

Public typedefs.

Definition at line 1932 of file locale.

Constructor & Destructor Documentation

template<typename CharT, typename InIter> std::num_get< CharT, InIter >::num_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 1946 of file locale.

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

Destructor.

Definition at line 2115 of file locale.

Member Function Documentation

template<typename CharT, typename InIter> InIter std::num_get< CharT, InIter >::do_get (iter_type, iter_type, ios_base &, ios_base::iostate & __err, void *&) const [protected, virtual]

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: in Start of input stream.

end End of input stream.

io Source of locale and flags.

err Error flags to set.

v Value to format and insert.

Returns: Iterator after reading.

Definition at line 775 of file locale_facets.tcc.

References std::ios_base::basefield, std::ios_base::failbit, std::ios_base::flags(), and std::ios_base::hex.

template<typename CharT, typename InIter> InIter std::num_get< CharT, InIter >::do_get (iter_type, iter_type, ios_base &, ios_base::iostate & __err, long double &) const [protected, virtual]

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: in Start of input stream.

end End of input stream.

io Source of locale and flags.

err Error flags to set.

v Value to format and insert.

Returns: Iterator after reading.

Definition at line 762 of file locale_facets.tcc.

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

template<typename CharT, typename InIter> InIter std::num_get< CharT, InIter >::do_get (iter_type, iter_type, ios_base &, ios_base::iostate & __err, double &) const [protected, virtual]

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: in Start of input stream.

end End of input stream.

io Source of locale and flags.

err Error flags to set.

v Value to format and insert.

Returns: Iterator after reading.

Definition at line 749 of file locale_facets.tcc.

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

template<typename CharT, typename InIter> InIter std::num_get< CharT, InIter >::do_get (iter_type, iter_type, ios_base &, ios_base::iostate & __err, float &) const [protected, virtual]

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: in Start of input stream.

end End of input stream.

io Source of locale and flags.

err Error flags to set.

v Value to format and insert.

Returns: Iterator after reading.

Definition at line 736 of file locale_facets.tcc.

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

template<typename CharT, typename InIter> InIter std::num_get< CharT, InIter >::do_get (iter_type, iter_type, ios_base &, ios_base::iostate & __err, unsigned long &) const [protected, virtual]

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: in Start of input stream.

end End of input stream.

io Source of locale and flags.

err Error flags to set.

v Value to format and insert.

Returns: Iterator after reading.

Definition at line 713 of file locale_facets.tcc.

template<typename CharT, typename InIter> InIter std::num_get< CharT, InIter >::do_get (iter_type, iter_type, ios_base &, ios_base::iostate & __err, unsigned int &) const [protected, virtual]

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: in Start of input stream.

end End of input stream.

io Source of locale and flags.

err Error flags to set.

v Value to format and insert.

Returns: Iterator after reading.

Definition at line 706 of file locale_facets.tcc.

template<typename CharT, typename InIter> InIter std::num_get< CharT, InIter >::do_get (iter_type, iter_type, ios_base &, ios_base::iostate & __err, unsigned short &) const [protected, virtual]

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: in Start of input stream.

end End of input stream.

io Source of locale and flags.

err Error flags to set.

v Value to format and insert.

Returns: Iterator after reading.

Definition at line 699 of file locale_facets.tcc.

template<typename CharT, typename InIter> InIter std::num_get< CharT, InIter >::do_get (iter_type, iter_type, ios_base &, ios_base::iostate &, long &) const [protected, virtual]

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: in Start of input stream.

end End of input stream.

io Source of locale and flags.

err Error flags to set.

v Value to format and insert.

Returns: Iterator after reading.

Definition at line 692 of file locale_facets.tcc.

template<typename CharT, typename InIter> InIter std::num_get< CharT, InIter >::do_get (iter_type, iter_type, ios_base &, ios_base::iostate &, bool &) const [protected, virtual]

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: in Start of input stream.

end End of input stream.

io Source of locale and flags.

err Error flags to set.

v Value to format and insert.

Returns: Iterator after reading.

Definition at line 632 of file locale_facets.tcc.

References std::ios_base::boolalpha, std::ios_base::eofbit, and std::ios_base::flags().

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

template<typename CharT, typename InIter> iter_type std::num_get< CharT, InIter >::get (iter_type in, iter_type __end, ios_base & __io, ios_base::iostate & __err, void *& __v) const [inline]

Numeric parsing.

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

The input characters are parsed like the scanf p specifier.

Digit grouping is intrepreted according to numpunct::grouping() and numpunct::thousands_sep(). If the pattern of digit groups isn't consistent, sets err to ios_base::failbit.

Note that the digit grouping effect for pointers is a bit ambiguous in the standard and shouldn't be relied on. See DR 344.

If parsing the string yields a valid value for 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: in Start of input stream.

end End of input stream.

io Source of locale and flags.

err Error flags to set.

v Value to format and insert.

Returns: Iterator after reading.

Definition at line 2109 of file locale.

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

template<typename CharT, typename InIter> iter_type std::num_get< CharT, InIter >::get (iter_type in, iter_type __end, ios_base & __io, ios_base::iostate & __err, long double & __v) const [inline]

Numeric parsing.

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

The input characters are parsed like the scanf g specifier. The matching type length modifier is also used.

The decimal point character used is numpunct::decimal_point(). Digit grouping is intrepreted according to numpunct::grouping() and numpunct::thousands_sep(). If the pattern of digit groups isn't consistent, sets err to ios_base::failbit.

If parsing the string yields a valid value for 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: in Start of input stream.

end End of input stream.

io Source of locale and flags.

err Error flags to set.

v Value to format and insert.

Returns: Iterator after reading.

Definition at line 2077 of file locale.

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

template<typename CharT, typename InIter> iter_type std::num_get< CharT, InIter >::get (iter_type in, iter_type __end, ios_base & __io, ios_base::iostate & __err, double & __v) const [inline]

Numeric parsing.

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

The input characters are parsed like the scanf g specifier. The matching type length modifier is also used.

The decimal point character used is numpunct::decimal_point(). Digit grouping is intrepreted according to numpunct::grouping() and numpunct::thousands_sep(). If the pattern of digit groups isn't consistent, sets err to ios_base::failbit.

If parsing the string yields a valid value for 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: in Start of input stream.

end End of input stream.

io Source of locale and flags.

err Error flags to set.

v Value to format and insert.

Returns: Iterator after reading.

Definition at line 2072 of file locale.

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

template<typename CharT, typename InIter> iter_type std::num_get< CharT, InIter >::get (iter_type in, iter_type __end, ios_base & __io, ios_base::iostate & __err, float & __v) const [inline]

Numeric parsing.

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

The input characters are parsed like the scanf g specifier. The matching type length modifier is also used.

The decimal point character used is numpunct::decimal_point(). Digit grouping is intrepreted according to numpunct::grouping() and numpunct::thousands_sep(). If the pattern of digit groups isn't consistent, sets err to ios_base::failbit.

If parsing the string yields a valid value for 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: in Start of input stream.

end End of input stream.

io Source of locale and flags.

err Error flags to set.

v Value to format and insert.

Returns: Iterator after reading.

Definition at line 2067 of file locale.

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

template<typename CharT, typename InIter> iter_type std::num_get< CharT, InIter >::get (iter_type in, iter_type __end, ios_base & __io, ios_base::iostate & __err, unsigned long & __v) const [inline]

Numeric parsing.

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

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 intrepreted according to numpunct::grouping() and numpunct::thousands_sep(). If the pattern of digit groups isn't consistent, sets err to ios_base::failbit.

If parsing the string yields a valid value for 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: in Start of input stream.

end End of input stream.

io Source of locale and flags.

err Error flags to set.

v Value to format and insert.

Returns: Iterator after reading.

Definition at line 2023 of file locale.

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

template<typename CharT, typename InIter> iter_type std::num_get< CharT, InIter >::get (iter_type in, iter_type __end, ios_base & __io, ios_base::iostate & __err, unsigned int & __v) const [inline]

Numeric parsing.

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

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 intrepreted according to numpunct::grouping() and numpunct::thousands_sep(). If the pattern of digit groups isn't consistent, sets err to ios_base::failbit.

If parsing the string yields a valid value for 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: in Start of input stream.

end End of input stream.

io Source of locale and flags.

err Error flags to set.

v Value to format and insert.

Returns: Iterator after reading.

Definition at line 2018 of file locale.

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

template<typename CharT, typename InIter> iter_type std::num_get< CharT, InIter >::get (iter_type in, iter_type __end, ios_base & __io, ios_base::iostate & __err, unsigned short & __v) const [inline]

Numeric parsing.

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

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 intrepreted according to numpunct::grouping() and numpunct::thousands_sep(). If the pattern of digit groups isn't consistent, sets err to ios_base::failbit.

If parsing the string yields a valid value for 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: in Start of input stream.

end End of input stream.

io Source of locale and flags.

err Error flags to set.

v Value to format and insert.

Returns: Iterator after reading.

Definition at line 2013 of file locale.

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

template<typename CharT, typename InIter> iter_type std::num_get< CharT, InIter >::get (iter_type in, iter_type __end, ios_base & __io, ios_base::iostate & __err, long & __v) const [inline]

Numeric parsing.

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

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 intrepreted according to numpunct::grouping() and numpunct::thousands_sep(). If the pattern of digit groups isn't consistent, sets err to ios_base::failbit.

If parsing the string yields a valid value for 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: in Start of input stream.

end End of input stream.

io Source of locale and flags.

err Error flags to set.

v Value to format and insert.

Returns: Iterator after reading.

Definition at line 2008 of file locale.

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

template<typename CharT, typename InIter> iter_type std::num_get< CharT, InIter >::get (iter_type in, iter_type __end, ios_base & __io, ios_base::iostate & __err, bool & __v) const [inline]

Numeric parsing.

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

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: in Start of input stream.

end End of input stream.

io Source of locale and flags.

err Error flags to set.

v Value to format and insert.

Returns: Iterator after reading.

Definition at line 1972 of file locale.

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

Member Data Documentation

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

Numpunct facet id.

Definition at line 1936 of file locale.

Author

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