close
Espacios de nombres
Variantes

std::money_get

De cppreference.com
 
 
 
std::money_get
Las funciones miembro
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
 
<tbody> </tbody>
Definido en el archivo de encabezado <locale>
template< class CharT, class InputIt = std::istreambuf_iterator<CharT> > class money_get;
std::money_get clase de plantilla encapsula las reglas para analizar los valores monetarios de los flujos de caracteres. El estándar de E / S std::get_money manipulador utiliza la faceta std::money_get de la configuración regional del flujo de I / O .
Original:
Class template std::money_get encapsulates the rules for parsing monetary values from character streams. The standard I/O manipulator std::get_money uses the std::money_get facet of the I/O stream's locale.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Imagecpp/locale/locale/facet

Inheritance diagram

Tipo de requisitos

-
InputIt debe reunir los requerimientos de InputIterator.

Especializaciones

Dos especializaciones y dos especializaciones parciales son proporcionados por la biblioteca estándar y son aplicadas por todos los objetos creados en un entorno nacional C + + programa:
Original:
Two specializations and two partial specializations are provided by the standard library and are implemented by all locale objects created in a C++ program:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Definido en el archivo de encabezado <locale>
std::money_get<char>
analiza las representaciones de cadena de valores estrechos monetarios
Original:
parses narrow string representations of monetary values
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
std::money_get<wchar_t>
analiza las representaciones de ancho de cadena de valores monetarios
Original:
parses wide string representations of monetary values
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
std::money_get<char, InputIt>
analiza las representaciones de cadena de valores estrechos monetarios utilizando iterador de entrada personalizado
Original:
parses narrow string representations of monetary values using custom input iterator
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
std::money_get<wchar_t, InputIt>
analiza las representaciones de ancho de cadena de valor de la moneda con iterador de entrada personalizado
Original:
parses wide string representations of monetary values using custom input iterator
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Tipos de miembros

Miembro de tipo
Original:
Member type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Definition
char_type CharT
string_type std::basic_string<CharT>
iter_type InputIt

Las funciones miembro

construye una nueva faceta money_get
Original:
constructs a new money_get facet
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función miembro pública)
destructs una faceta money_get
Original:
destructs a money_get facet
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función miembro protegida)
Invoca do_get
Original:
invokes do_get
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función miembro pública)

Protegido funciones miembro

[virtual]
analiza un valor monetario de un flujo de entrada
Original:
parses a monetary value from an input stream
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función miembro virtual protegida)

Objetos miembros

static std::locale::id id
Identificador de la configuración regional
Original:
id of the locale
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(objeto miembro público)

Ejemplo

#include <iostream>
#include <sstream>
#include <locale>
#include <iomanip>
#include <iterator>
int main()
{
    std::string str = "$1.11 $2.22 $3.33";
    std::cout << std::fixed << std::setprecision(2);

    std::cout << '"' << str << "\" parsed with the I/O manipulator: ";
    std::istringstream s1(str);
    s1.imbue(std::locale("en_US.UTF-8"));
    long double val;
    while(s1 >> std::get_money(val))
        std::cout << val/100 << ' ';
    std::cout << '\n';

    str = "USD  1,234.56";
    std::cout << '"' << str << "\" parsed with the facet directly: ";
    std::istringstream s2(str);
    s2.imbue(std::locale("en_US.UTF-8"));
    auto& f = std::use_facet<std::money_get<char>>(s2.getloc());
    std::ios_base::iostate err;
    std::istreambuf_iterator<char> beg(s2), end;
    f.get(beg, end, true, s2, err, val);
    std::cout << val/100 << '\n';
}

Salida:

"$1.11 $2.22 $3.33" parsed with the I/O manipulator: 1.11 2.22 3.33
"USD  1,234.56" parsed with the facet directly: 1234.56

Ver también

Define los parámetros de formato monetario utilizados por std::money_get y std::money_put.
(plantilla de clase) [editar]
Formatos de un valor monetario para la salida como una secuencia de caracteres.
(plantilla de clase) [editar]
(C++11)
analiza un valor monetario
Original:
parses a monetary value
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(plantilla de función)