std::moneypunct<CharT,International>::pos_format,do_pos_format,neg_format,do_neg_format (3) - Linux Manuals
std::moneypunct<CharT,International>::pos_format,do_pos_format,neg_format,do_neg_format: std::moneypunct<CharT,International>::pos_format,do_pos_format,neg_format,do_neg_format
Command to display std::moneypunct<CharT,International>::pos_format,do_pos_format,neg_format,do_neg_format
manual in Linux: $ man 3 std::moneypunct<CharT,International>::pos_format,do_pos_format,neg_format,do_neg_format
NAME
std::moneypunct<CharT,International>::pos_format,do_pos_format,neg_format,do_neg_format - std::moneypunct<CharT,International>::pos_format,do_pos_format,neg_format,do_neg_format
Synopsis
Defined in header <locale>
public: (1)
pattern pos_format() const;
public: (2)
pattern neg_format() const;
protected: (3)
virtual pattern do_pos_format() const;
protected: (4)
virtual pattern do_neg_format() const;
1) Public member function, calls the member function do_pos_format of the most derived class.
2) Public member function, calls the member function do_neg_format of the most derived class.
3) Returns the format structure (of type std::money_base::format) which describes the formatting of positive monetary values.
4) Returns the format structure (of type std::money_base::format) which describes the formatting of negative monetary values.
The standard specializations of std::moneypunct return the pattern {symbol, sign, none, value}
Return value
The object of type std::money_base::format describing the formatting used by this locale.
Notes
While std::money_put uses pos_format for formatting positive values and neg_format for formatting negative values, std::money_get uses neg_format for parsing all monetary values: it assumes that neg_format is compatible with pos_format.
Example
// Run this code
#include <locale>
#include <iostream>
#include <iomanip>
struct my_punct : std::moneypunct_byname<char, false> {
my_punct(const char* name) : moneypunct_byname(name) {}
pattern do_pos_format() const { return { {value, space, symbol, sign} };}
pattern do_neg_format() const { return { {value, space, symbol, sign} };}
};
int main()
{
std::cout.imbue(std::locale("en_US.utf8"));
std::cout << "american locale: " << std::showbase
<< std::put_money(12345678.0) << '\n';
std::cout.imbue(std::locale(std::cout.getloc(), new my_punct("en_US.utf8")));
std::cout << "locale with modified moneypunct:\n"
<< std::put_money(12345678.0) << '\n'
<< std::put_money(-12345678.0) << '\n';
}
Output:
american locale: $123,456.78
locale with modified moneypunct:
123,456.78 $
123,456.78 $-
See also
do_curr_symbol provides the string to use as the currency identifier
(virtual protected member function)
[virtual]
do_positive_sign provides the string to indicate a positive or negative value
do_negative_sign (virtual protected member function)
[virtual]
do_get parses a monetary value from an input stream
(virtual protected member function of std::money_get<CharT,InputIt>)
[virtual]
do_put formats a monetary value and writes to output stream
(virtual protected member function of std::money_put<CharT,OutputIt>)
[virtual]
Pages related to std::moneypunct<CharT,International>::pos_format,do_pos_format,neg_format,do_neg_format
- std::moneypunct<CharT,International>::positive_sign,do_positive_sign,negative_sign, (3) - std::moneypunct<CharT,International>::positive_sign,do_positive_sign,negative_sign,
- std::moneypunct<CharT,International>::positive_sign,do_positive_sign,negative_sign,do_negative_sign (3) - std::moneypunct<CharT,International>::positive_sign,do_positive_sign,negative_sign,do_negative_sign
- std::moneypunct<CharT,International>::curr_symbol,do_curr_symbol (3) - std::moneypunct<CharT,International>::curr_symbol,do_curr_symbol
- std::moneypunct<CharT,International>::decimal_point,do_decimal_point (3) - std::moneypunct<CharT,International>::decimal_point,do_decimal_point
- std::moneypunct<CharT,International>::frac_digits,do_frac_digits (3) - std::moneypunct<CharT,International>::frac_digits,do_frac_digits
- std::moneypunct<CharT,International>::grouping,do_grouping (3) - std::moneypunct<CharT,International>::grouping,do_grouping
- std::moneypunct<CharT,International>::moneypunct (3) - std::moneypunct<CharT,International>::moneypunct
- std::moneypunct<CharT,International>::thousands_sep,do_thousands_sep (3) - std::moneypunct<CharT,International>::thousands_sep,do_thousands_sep
- std::moneypunct<CharT,International>::~moneypunct (3) - std::moneypunct<CharT,International>::~moneypunct
- std::moneypunct (3) - std::moneypunct
- std::moneypunct_byname (3) - std::moneypunct_byname
- std::money_base (3) - std::money_base
- std::money_get (3) - std::money_get
- std::money_get<CharT,InputIt>::get,do_get (3) - std::money_get<CharT,InputIt>::get,do_get