名前空間
変種
操作

std::codecvt::in, std::codecvt::do_in

提供: cppreference.com
< cpp‎ | locale‎ | codecvt

 
 
ローカライゼーションライブラリ
ロケールおよびファセット
Original:
Locales and facets
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
locale
文字分類
Original:
Character classification
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
変換
Original:
Conversions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ファセットカテゴリの基底クラスです
Original:
Facet category base classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ファセットカテゴリ
Original:
Facet categories
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ロケール固有のファセット
Original:
Locale-specific facets
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
コー​​ド変換ファセット
Original:
Code conversion facets
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
codecvt_utf8(C++11)
codecvt_utf16(C++11)
Cロケール
Original:
C locale
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
 
 
Defined in header <locale>
public:

result in( stateT& state,
           const externT* from,
           const externT* from_end,
           const externT*& from_next,
           internT* to,
           internT* to_end,

           internT*& to_next ) const;
(1)
protected:

result do_in( stateT& state,
              const externT* from,
              const externT* from_end,
              const externT*& from_next,
              internT* to,
              internT* to_end,

              internT*& to_next ) const;
(2)
1)
パブリックメンバ関数は、最派生クラスのメンバ関数を呼び出し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.
2)
このcodecvtファセットが変換を定義する場合、[from, from_end)から始まるその後の場所に結果を配置し、内部の文字にソース範囲toから外部の文字を変換します。 from_end - from外部文字以上のものを変換しないとto_end - to内部文字以上のものを書き込みません​​。葉from_nextto_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.
このcodecvtファセットは、変換が定義されていない場合、文字は変換されません。 to_nexttoに等しくなるように設定されている、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.

目次

[編集] 値を返します

次のように、成功のステータスを示すタイプ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.
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.

[編集] ノート

どちら初期シフト状態を表すか、または順番に前の文字を変換して得られること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.
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.

[編集]

#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';
}

Output:

The string in wide encoding: zß水𝄋

[編集] も参照してください

[仮想]
関連付けられたファイルから読み込みます
Original:
reads from the associated file
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(仮想protectedメンバ関数of std::basic_filebuf) [edit]
ワイド文字列にバイト文字列に変換します
Original:
converts a byte string into a wide string
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(パブリックメンバ関数of std::wstring_convert) [edit]
ワイド文字列へのナローマルチバイト文字列、与えられた状態に変換します
Original:
converts a narrow multibyte character string to wide string, given state
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数) [edit]
[仮想]
そのようなファイルに書き込むときのように、internTからexternTに文字列を変換します
Original:
converts a string from internT to externT, such as when writing to file
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(仮想protectedメンバ関数) [edit]