Lumino
ln::TextDecoder Class Referenceabstract

エンコード済みバイトシーケンスから内部文字コード (UTF16) への変換を行うクラス More...

#include <Encoding.hpp>

Public Member Functions

TextEncodingencoding () const
 この Decoder に対応する TextEncoding を取得します。
 
virtual bool canRemain ()=0
 変換状態を保持できるかを確認します。
 
virtual bool convertToUTF16 (const byte_t *input, size_t inputByteSize, UTF16 *output, size_t outputElementSize, TextDecodeResult *outResult)=0
 このエンコーディングで表現される文字列バッファを、UTF16 に変換します。 More...
 
virtual int usedDefaultCharCount ()=0
 一連の convertToUTF16() の呼び出しの中で、変換できない文字を規定文字に変換した文字数を取得します。
 
virtual bool completed ()=0
 最後の convertToUTF16() で、バッファ末尾でマルチバイト文字が途切れていなければ true を返します。
 
virtual void reset ()=0
 変換ステータスをクリアし、初期状態に戻します。
 

Detailed Description

エンコード済みバイトシーケンスから内部文字コード (UTF16) への変換を行うクラス

TextDecoder は1つの文字列ストリームの変換中、任意の回数 convertToUTF16() を呼び出すことができます。 その間、変換ステータスを保存します。 つまり、バッファリングIO等で長大な文章を複数のメモリバッファに分割して読み取る場合に、 バッファの境界でマルチバイト文字が分かれてしまっても、継続して変換を行うことができます。

ただし、このステータス保存は canRemain() が true を返す場合のみ使用可能です。 false を返す場合はあらかじめ全てのソース文字列を1つの連続したメモリバッファに読み込み、convertToUTF16() に渡す必要があります。

参考:.NET TextDecoder.convert() http://msdn.microsoft.com/ja-jp/library/twte1yfs(v=vs.110).aspx

Member Function Documentation

◆ convertToUTF16()

virtual bool ln::TextDecoder::convertToUTF16 ( const byte_t *  input,
size_t  inputByteSize,
UTF16 *  output,
size_t  outputElementSize,
TextDecodeResult outResult 
)
pure virtual

このエンコーディングで表現される文字列バッファを、UTF16 に変換します。

Parameters
[in]input: このエンコーディングで表現される文字列バッファ
[in]inputByteSize: input バッファのバイト数 (NULL 文字は含まない)
[out]output: 変換結果の格納先バッファ
[in]outputElementSize: output バッファのサイズ (文字数単位)
[out]outResult: 変換結果を格納する変数

The documentation for this class was generated from the following file: