std::numpunct_byname
提供: cppreference.com
<tbody>
</tbody>
| ヘッダ <locale> で定義
|
||
template< class CharT > class numpunct_byname : public std::numpunct<CharT>; |
||
std::numpunct_byname は構築時に指定されたロケールの数値の句読点の設定をカプセル化する std::numpunct ファセットです。
2つの特殊化が標準ライブラリによって提供されます。
ヘッダ
<locale> で定義 | |
std::numpunct_byname<char>
|
ナロー文字入出力のためのロケール固有の std::numpunct ファセット |
std::numpunct_byname<wchar_t>
|
ワイド文字入出力のためのロケール固有の std::numpunct ファセット |
メンバ型
| メンバ型 | 定義 |
char_type
|
CharT
|
string_type
|
std::basic_string<CharT>
|
メンバ関数
新しい numpunct_byname ファセットを構築します (パブリックメンバ関数) | |
numpunct_byname ファセットを破棄します (プロテクテッドメンバ関数) |
std::numpunct_byname::numpunct_byname
<tbody> </tbody> explicit numpunct_byname( const char* name, std::size_t refs = 0 ); |
||
explicit numpunct_byname( const std::string& name, std::size_t refs = 0 ); |
(C++11以上) | |
名前 name を持つロケールに対する新しい std::numpunct_byname ファセットを構築します。
refs はリソース管理のために使用されます。 refs == 0 の場合、処理系はそれを保持する最後の std::locale オブジェクトが破棄されたときにファセットを破棄します。 そうでなければ、オブジェクトは破棄されません。
引数
| name | - | ロケールの名前 |
| refs | - | ファセットにリンクする参照の数 |
std::numpunct_byname::~numpunct_byname
<tbody> </tbody> protected: ~numpunct_byname(); |
||
ファセットを破棄します。
std::numpunct から継承
メンバ型
| メンバ型 | 定義 |
char_type
|
charT
|
string_type
|
std::basic_string<charT>
|
メンバ関数
do_decimal_point を呼びます ( std::numpunct<CharT>のパブリックメンバ関数)
| |
do_thousands_sep を呼びます ( std::numpunct<CharT>のパブリックメンバ関数)
| |
do_grouping を呼びます ( std::numpunct<CharT>のパブリックメンバ関数)
| |
do_truename または do_falsename を呼びます ( std::numpunct<CharT>のパブリックメンバ関数)
|
プロテクテッドメンバ関数
[仮想] |
小数点として使用する文字を提供します ( std::numpunct<CharT>の仮想プロテクテッドメンバ関数)
|
[仮想] |
桁区切りとして使用される文字を提供します ( std::numpunct<CharT>の仮想プロテクテッドメンバ関数)
|
[仮想] |
それぞれの桁区切り文字間の桁数を提供します ( std::numpunct<CharT>の仮想プロテクテッドメンバ関数)
|
ブーリアン true および false の名前として使用する文字列を提供します ( std::numpunct<CharT>の仮想プロテクテッドメンバ関数)
|
メンバオブジェクト
static std::locale::id id |
ロケールの id (パブリックメンバオブジェクト) |
例
この例はロケールの残りを変更せずに別の言語の数値の句読点のルールを適用する方法をデモンストレーションします。
Run this code
#include <iostream>
#include <locale>
int main()
{
const double number = 1000.25;
std::wcout << L"default locale: " << number << L'\n';
std::wcout.imbue(std::locale(std::wcout.getloc(),
new std::numpunct_byname<wchar_t>("ru_RU.UTF8")));
std::wcout << L"default locale with russian numpunct: " << number << L'\n';
}
出力:
default locale: 1000.25
default locale with russian numpunct: 1 000,25
関連項目
| 数値の区切り文字の規則を定義します (クラステンプレート) |