名前空間
変種
操作

std::locale

提供: cppreference.com
< cpp‎ | locale

 
 
 
std::locale
メンバータイプ
Original:
Member types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
メンバ関数
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.
静的メンバ関数
Original:
Static member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
 
ヘッダ <locale> で定義
class locale;
クラスstd::localeの目的は、ファセットの参照カウントポインタのインデックス付きのセットです。 C + +入力/出力ライブラリの各ストリームオブジェクトはstd::localeに関連付けられており、すべてのデータを解析して、書式設定するためのファセットを使用しています。さらに、ロケールオブジェクトが各basic_regexオブジェクトに関連付けられています。 Localeオブジェクトはまた、標準的なコンテナとアルゴリズムを使用して文字列の照合を行い、それらが保持するファセットを取得または変更するには、直接アクセスすることができる述部として使用することができます.
Original:
An object of class std::locale is an indexed set of reference-counted pointers to facets. Each stream object of the C++ input/output library is associated with an std::locale and uses its facets for parsing and formatting of all data. In addition, a locale object is associated with each basic_regex object. Locale objects can also be used as predicates that perform string collation with the standard containers and algorithms and can be accessed directly to obtain or modify the facets they hold.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
C + +プログラムで構成される各ロケールには、少なくとも以下の標準ファセットを保持していますが、プログラムでは、追加の特殊化したり、まったく新しい面を定義し、既存のロケールオブジェクトに追加することもでき.
Original:
Each locale constructed in a C++ program holds at least the following standard facets, but a program may define additional specializations or completely new facets and add them to any existing locale object.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Supported facets
std::collate<char> std::collate<wchar_t>
std::ctype<char> std::ctype<wchar_t>
std::codecvt<char,char,mbstate_t>
std::codecvt<char16_t,char,mbstate_t>
std::codecvt<char32_t,char,mbstate_t>
std::codecvt<wchar_t,char,mbstate_t>
std::moneypunct<char>
std::moneypunct<char,true>
std::moneypunct<wchar_t>
std::moneypunct<wchar_t,true>
std::money_get<char> std::money_get<wchar_t>
std::money_put<char> std::money_put<wchar_t>
std::numpunct<char> std::numpunct<wchar_t>
std::num_get<char> std::num_get<wchar_t>
std::num_put<char> std::num_put<wchar_t>
std::time_get<char> std::time_get<wchar_t>
std::time_put<char> std::time_put<wchar_t>
std::messages<char> std::messages<wchar_t>

目次

[編集] メンバータイプ

ファセットインデックスタイプ:各ファセットクラスでは、この型のpublic staticメンバを宣言または継承する必要があります
Original:
the facet index type: each facet class must declare or inherit a public static member of this type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(クラス) [edit]
すべてのファセットカテゴリの基底クラス:いずれかのカテゴリの各ファセットは、この型から派生しています
Original:
the base class for all facet categories: each facet of any category is derived from this type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(クラス) [edit]
category
int
(typedef)

[編集] メンバーオブジェクト

none
[static]
型のゼロ値categoryないファセットカテゴリがないことを示す
Original:
a zero value of type category indicating no facet category
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(パブリック静的メンバ定数)
collate
[static]
照合ファセットカテゴリを示すタイプcategoryのビットマスク値
Original:
a bitmask value of type category indicating the collate facet category
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(パブリック静的メンバ定数)
ctype
[static]
のctypeファセットカテゴリを示すタイプcategoryのビットマスク値
Original:
a bitmask value of type category indicating the ctype facet category
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(パブリック静的メンバ定数)
monetary
[static]
金銭面のカテゴリを示すタイプcategoryのビットマスク値
Original:
a bitmask value of type category indicating the monetary facet category
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(パブリック静的メンバ定数)
numeric
[static]
数値ファセットカテゴリを示すタイプcategoryのビットマスク値
Original:
a bitmask value of type category indicating the numeric facet category
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(パブリック静的メンバ定数)
time
[static]
時間ファセットカテゴリを示すタイプcategoryのビットマスク値
Original:
a bitmask value of type category indicating the time facet category
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(パブリック静的メンバ定数)
messages
[static]
メッセージファセットカテゴリを示すタイプcategoryのビットマスク値
Original:
a bitmask value of type category indicating the messages facet category
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(パブリック静的メンバ定数)
all
[static]
collate | ctype | monetary | numeric | time | messages
(パブリック静的メンバ定数)

[編集] メンバ関数

新しいロケールを構築します
Original:
constructs a new locale
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(パブリックメンバ関数) [edit]
ロケールおよびその参照カウントがゼロになるのファセットを破棄します
Original:
destructs the locale and the facets whose reference count becomes zero
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(パブリックメンバ関数) [edit]
ロケールを置き換えます
Original:
replaces a locale
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(パブリックメンバ関数) [edit]
別のロケールからコピーし、コンパイル時に識別されたファセットのロケールを構築します
Original:
constructs a locale with compile-time identified facet copied from another locale
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(パブリックメンバ関数) [edit]
ロケールまたは "*"名前をつけない場合の名前を返します
Original:
returns the name of the locale or "*" if unnamed
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(パブリックメンバ関数) [edit]
ロケールオブジェクト間の等価比較
Original:
equality comparison between locale objects
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(パブリックメンバ関数) [edit]
lexicographically compares two strings using this locale's collate facet
(パブリックメンバ関数) [edit]
[static]
グローバルロケールを変更します
Original:
changes the global locale
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(パブリック静的メンバ関数) [edit]
[static]
"C"ロケールへの参照を取得します
Original:
obtains a reference to the "C" locale
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(パブリック静的メンバ関数) [edit]

[編集]

ロケールに依存するプログラム(クロスプラットフォーム)の典型的なプロローグを示しています
Original:
Demonstrates the typical prologue of a locale-sensitive program (cross-platform)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

#include <iostream>
#include <locale>
 
int main()
{
    std::wcout << "User-preferred locale setting is " << std::locale("").name().c_str() << '\n';
    // on startup, the global locale is the "C" locale
    std::wcout << 1000.01 << '\n';
    // replace the C++ global locale as well as the C locale with the user-preferred locale
    std::locale::global(std::locale("") );
    // use the new global locale for future wide character output
    std::wcout.imbue(std::locale());
    // output the same number again
    std::wcout << 1000.01 << '\n';
}

出力:

User-preferred locale setting is en_US.UTF8
1000.01
1,000.01

[編集] 参照

ロケールからファセットを取得します
(関数テンプレート) [edit]
ロケールが特定のファセットを実装しているかどうか調べます
(関数テンプレート) [edit]
ロケールを設定します
(std::ios_baseのパブリックメンバ関数) [edit]
現在のロケールを返します
(std::ios_baseのパブリックメンバ関数) [edit]