std::codecvt<InternT,ExternT,State>::in, std::codecvt<InternT,ExternT,State>::do_in
提供: cppreference.com
![]() |
このページは、Google 翻訳を使って英語版から機械翻訳されました。
翻訳には誤りや奇妙な言い回しがあるかもしれません。文章の上にポインタをおくと、元の文章が見れます。誤りを修正して翻訳を改善する手助けをしてください。翻訳についての説明は、ここをクリックしてください。 |
Defined in header <locale>
|
||
public: result in( stateT& state, |
(1) | |
protected: result do_in( stateT& state, |
(2) | |
パブリックメンバ関数は、最派生クラスのメンバ関数を呼び出し
2) do_in
.Original:
public member function, calls the member function
do_in
of the most derived class.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
この
codecvt
ファセットが変換を定義する場合、[from, from_end)
から始まるその後の場所に結果を配置し、内部の文字にソース範囲to
から外部の文字を変換します。 from_end - from外部文字以上のものを変換しないとto_end - to内部文字以上のものを書き込みません。葉from_next
とto_next
正常に変換最後の要素を超えたものを指している.Original:
If this
codecvt
facet defines a conversion, translates the external characters from the source range [from, from_end)
to internal characters, placing the results in the subsequent locations starting at to
. Converts no more than from_end - from external characters and writes no more than to_end - to internal characters. Leaves from_next
and to_next
pointing one beyond the last element successfully converted.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
この
codecvt
ファセットは、変換が定義されていない場合、文字は変換されません。 to_next
がto
に等しくなるように設定されている、state
変更されず、std::codecvt_base::noconvが返されます。.Original:
If this
codecvt
facet does not define a conversion, no characters are converted. to_next
is set to be equal to to
, state
is unchanged, and std::codecvt_base::noconv is returned.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
目次 |
値を返します
次のように、成功のステータスを示すタイプstd::codecvt_base::resultの値:
Original:
A value of type std::codecvt_base::result, indicating the success status as follows:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
ok
|
変換が完了しました
Original: conversion completed The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
partial
|
しない出力バッファに十分なスペースや、ソース·バッファの予期しない終了
Original: not enough space in the output buffer or unexpected end of source buffer The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
error
|
変換できなかった文字を検出しました
Original: encountered a character that could not be converted The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
noconv
|
このファセットは、書き出される出力非変換ではありません
Original: this facet is non-converting, no output written The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
非変換の専門はstd::codecvt<char, char, std::mbstate_t>常にstd::codecvt_base::noconvを返します
Original:
The non-converting specialization std::codecvt<char, char, std::mbstate_t> always returns std::codecvt_base::noconv
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
ノート
どちら初期シフト状態を表すか、または順番に前の文字を変換して得られることfrom <= from_end && to <= to_endその
state
が必要.Original:
Requires that from <= from_end && to <= to_end and that
state
either representing the initial shift state or obtained by converting the preceding characters in the sequence.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
state
への影響は意図的に特定されていません。標準ファセットでは、std::mbsrtowcsを呼び出すときのようなシフト状態を維持するために使用されるため、最後に処理した外部文字変換後の状態を反映するように更新されますが、ユーザが定義したファセットは、例えば、他の任意の状態を維持するためにそれを使用して自由である遭遇した特殊文字の数をカウント.Original:
The effect on
state
is deliberately unspecified. In standard facets, it is used to maintain shift state like when calling std::mbsrtowcs, and is therefore updated to reflect the conversion state after the last processed external character, but a user-defined facet is free to use it to maintain any other state, e.g. count the number of special characters encountered.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
例
Run this code
#include <iostream> #include <string> #include <locale> int main() { std::locale::global(std::locale("en_US.utf8")); auto& f = std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t>>(std::locale()); std::string external = u8"z\u00df\u6c34\U0001d10b"; // or u8"zß水𝄋" // or "\x7a\xc3\x9f\xe6\xb0\xb4\xf0\x9d\x84\x8b"; // note that the following can be done with wstring_convert std::mbstate_t mb = std::mbstate_t(); // initial shift state std::wstring internal(external.size(), '\0'); const char* from_next; wchar_t* to_next; f.in(mb, &external[0], &external[external.size()], from_next, &internal[0], &internal[internal.size()], to_next); // error checking skipped for brevity internal.resize(to_next - &internal[0]); std::wcout << L"The string in wide encoding: " << internal << '\n'; }
出力:
The string in wide encoding: zß水𝄋