std:: moneypunct_byname
|
ヘッダーで定義
<locale>
|
||
|
template
<
class
CharT,
bool
Intl
=
false
>
class moneypunct_byname : public std:: moneypunct < CharT, Intl > ; |
||
std::moneypunct_byname
は、
std::moneypunct
ファセットであり、その構築時に指定されたロケールの通貨書式設定の設定をカプセル化します。
目次 |
特殊化
標準ライブラリは、以下の型要件を満たすすべての特殊化を提供することが保証されています:
-
CharTは char と wchar_t のいずれかであり、 -
Intlは bool パラメータに対する特殊化の可能性があります。
ネスト型
| 型 | 定義 |
pattern
|
std::money_base::pattern |
string_type
|
std:: basic_string < CharT > |
メンバー関数
|
(constructor)
|
新しい
moneypunct_byname
ファセットを構築する
(public member function) |
|
(destructor)
|
moneypunct_byname
ファセットを破棄する
(protected member function) |
std::moneypunct_byname:: moneypunct_byname
|
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以降) | |
指定されたロケール名
std::moneypunct_byname
ファセットを新しく構築します。
refs はリソース管理に使用されます: refs == 0 の場合、実装はこのファセットを保持する最後の std::locale オブジェクトが破棄されるときにファセットを破棄します。それ以外の場合、オブジェクトは破棄されません。
パラメータ
| name | - | ロケールの名前 |
| refs | - | ファセットにリンクする参照数 |
std::moneypunct_byname:: ~moneypunct_byname
|
protected
:
~moneypunct_byname ( ) ; |
||
ファセットを破棄します。
std:: moneypunct から継承
ネストされた型
| 型 | 定義 |
char_type
|
CharT
|
string_type
|
std:: basic_string < CharT > |
データメンバ
| メンバー | 説明 |
std::locale::id
id
[static]
|
ファセット の識別子 |
const
bool
intl
[static]
|
International |
メンバー関数
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>
の公開メンバ関数)
|
プロテクテッドメンバー関数
|
[virtual]
|
小数点として使用する文字を提供する
(
std::moneypunct<CharT,International>
の仮想保護メンバ関数)
|
|
[virtual]
|
千の区切り文字として使用する文字を提供する
(
std::moneypunct<CharT,International>
の仮想保護メンバ関数)
|
|
[virtual]
|
千の区切り文字の各ペア間の桁数を提供する
(
std::moneypunct<CharT,International>
の仮想保護メンバ関数)
|
|
[virtual]
|
通貨識別子として使用する文字列を提供する
(
std::moneypunct<CharT,International>
の仮想保護メンバ関数)
|
|
[virtual]
|
正または負の値を示す文字列を提供する
(
std::moneypunct<CharT,International>
の仮想保護メンバ関数)
|
|
[virtual]
|
小数点以下に表示する桁数を提供する
(
std::moneypunct<CharT,International>
の仮想保護メンバ関数)
|
|
[virtual]
|
通貨値の書式パターンを提供する
(
std::moneypunct<CharT,International>
の仮想保護メンバ関数)
|
std:: money_base から継承
ネストされた型
| 型 | 定義 |
| enum part { none, space, symbol, sign, value } ; | スコープなし列挙型 |
| struct pattern { char field [ 4 ] ; } ; | 通貨フォーマット型 |
| 列挙定数 | 説明 |
none
|
空白は許可されるが必須ではない(最後の位置を除く)。最後の位置では空白は許可されない |
space
|
1つ以上の空白文字が必須 |
symbol
|
std::moneypunct::curr_symbol によって返される文字シーケンスが必須 |
sign
|
std::moneypunct::positive_sign または std::moneypunct::negative_sign によって返される文字の最初の文字が必須 |
value
|
絶対数値の通貨値が必須 |
例
この例では、ロケールの他の部分を変更せずに別の言語の通貨書式設定ルールを適用する方法を示します。
#include <iomanip> #include <iostream> #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
で使用される通貨書式パラメータを定義する
(クラステンプレート) |