std::moneypunct_byname
提供: cppreference.com
<tbody>
</tbody>
| ヘッダ <locale> で定義
|
||
template< class CharT, bool Intl = false > class moneypunct_byname : public std::moneypunct<CharT, Intl>; |
||
std::moneypunct_byname は構築時に指定されたロケールの金額の書式化の設定をカプセル化する std::moneypunct ファセットです。
2つの特殊化が標準ライブラリによって提供されます。
ヘッダ
<locale> で定義 | |
std::moneypunct_byname<char, Intl>
|
ナロー文字入出力のためのロケール固有の std::moneypunct ファセット |
std::moneypunct_byname<wchar_t, Intl>
|
ワイド文字入出力のためのロケール固有の std::moneypunct ファセット |
メンバ型
| メンバ型 | 定義 |
pattern
|
std::money_base::pattern |
string_type
|
std::basic_string<CharT>
|
メンバ関数
新しい moneypunct_byname ファセットを構築します (パブリックメンバ関数) | |
moneypunct_byname ファセットを破棄します (プロテクテッドメンバ関数) |
std::moneypunct_byname::moneypunct_byname
<tbody> </tbody> explicit moneypunct_byname( const char* name, std::size_t refs = 0 ); |
||
explicit moneypunct_byname( const std::string& name, std::size_t refs = 0 ); |
(C++11以上) | |
名前 name を持つロケールに対する新しい std::moneypunct_byname ファセットを構築します。
refs はリソース管理のために使用されます。 refs == 0 の場合、処理系はそれを保持する最後の std::locale オブジェクトが破棄されたときにファセットを破棄します。 そうでなければ、オブジェクトは破棄されません。
引数
| name | - | ロケールの名前 |
| refs | - | ファセットにリンクする参照の数 |
std::moneypunct_byname::~moneypunct_byname
<tbody> </tbody> protected: ~moneypunct_byname(); |
||
ファセットを破棄します。
std::moneypunct から継承
メンバ型
| メンバ型 | 定義 |
char_type
|
CharT
|
string_type
|
std::basic_string<CharT>
|
メンバ関数
do_decimal_point を呼びます ( std::moneypunct<CharT,International>のパブリックメンバ関数)
| |
do_thousands_sep を呼びます ( std::moneypunct<CharT,International>のパブリックメンバ関数)
| |
do_grouping を呼びます ( std::moneypunct<CharT,International>のパブリックメンバ関数)
| |
do_curr_symbol を呼びます ( std::moneypunct<CharT,International>のパブリックメンバ関数)
| |
do_positive_sign または do_negative_sign を呼びます ( std::moneypunct<CharT,International>のパブリックメンバ関数)
| |
do_frac_digits を呼びます ( std::moneypunct<CharT,International>のパブリックメンバ関数)
| |
do_pos_format または do_neg_format を呼びます ( std::moneypunct<CharT,International>のパブリックメンバ関数)
|
プロテクテッドメンバ関数
[仮想] |
小数点として使用する文字を提供します ( std::moneypunct<CharT,International>の仮想プロテクテッドメンバ関数)
|
[仮想] |
桁区切り文字として使用する文字を提供します ( std::moneypunct<CharT,International>の仮想プロテクテッドメンバ関数)
|
[仮想] |
桁区切り文字間の桁数を提供します ( std::moneypunct<CharT,International>の仮想プロテクテッドメンバ関数)
|
[仮想] |
通貨識別子として使用する文字列を提供します ( std::moneypunct<CharT,International>の仮想プロテクテッドメンバ関数)
|
| 正または負の値を示す文字列を提供します ( std::moneypunct<CharT,International>の仮想プロテクテッドメンバ関数)
| |
[仮想] |
小数点以下の桁数を提供します ( std::moneypunct<CharT,International>の仮想プロテクテッドメンバ関数)
|
| 通貨値のための書式化パターンを提供します ( std::moneypunct<CharT,International>の仮想プロテクテッドメンバ関数)
|
メンバ定数
| メンバ | 定義 |
const bool intl (static)
|
International
|
メンバオブジェクト
static std::locale::id id |
ロケールの id (パブリックメンバオブジェクト) |
std::money_base から継承
| メンバ型 | 定義 |
enum part { none, space, symbol, sign, value };
|
スコープなし列挙型 |
struct pattern { char field[4]; };
|
金額の書式の型 |
| 列挙定数 | 定義 |
none
|
ホワイトスペースが許容されない最後の位置を除き、ホワイトスペースは許容されますが要求されません |
space
|
1つ以上のホワイトスペース文字が要求されます |
symbol
|
moneypunct::curr_symbol によって返される文字のシーケンスが要求されます |
sign
|
moneypunct::positive_sign または moneypunct::negative_sign によって返される最初の文字が要求されます |
value
|
金額の数値の絶対値が要求されます |
例
この例はロケールの残りを変更せずに別の言語の金額の書式化ルールを適用する方法をデモンストレーションします。
Run this code
#include <iostream>
#include <iomanip>
#include <locale>
int main()
{
long double mon = 1234567;
std::locale::global(std::locale("en_US.utf8"));
std::wcout.imbue(std::locale());
std::wcout << L"american locale : " << std::showbase
<< std::put_money(mon) << '\n';
std::wcout.imbue(std::locale(std::wcout.getloc(),
new std::moneypunct_byname<wchar_t>("ru_RU.utf8")));
std::wcout << L"american locale with russian moneypunct: "
<< std::put_money(mon) << '\n';
}
出力:
american locale : $12,345.67
american locale with russian moneypunct: 12 345.67 руб
関連項目
| std::money_get および std::money_put で使用される金額の書式パラメータを定義します (クラステンプレート) |