文字クラス
[詳解]
#include <mgl_text_character.h>
|
| constexpr | Character (uint32_t code) noexcept |
| | コンストラクタ
|
| |
| constexpr char32_t | GetCode () const noexcept |
| | 値を取得
|
| |
| constexpr void | SetCode (char32_t code) noexcept |
| | 値を設定
|
| |
|
constexpr void | SetInvalidMarker () noexcept |
| | 不正なコードのマーカーを書き込む
|
| |
| constexpr bool | IsValid () const noexcept |
| | コードが正常かどうかを取得する
|
| |
| constexpr bool | IsNull () const noexcept |
| | Null文字かどうかを判定
|
| |
| constexpr bool | IsNewLine () const noexcept |
| | 改行文字かどうかを取得
|
| |
| constexpr bool | IsSpace () const noexcept |
| | スペースかどうかを取得
|
| |
|
constexpr bool | IsDigit () const noexcept |
| | 数値かどうかを取得
|
| |
| size_t | GetByteSize () const noexcept |
| | 文字をバイトに変換する際に必要なサイズを取得
|
| |
| bool | ToByte (char byteArray[kByteArraySize]) const noexcept |
| | コードをバイト列に変換
|
| |
| char * | ToByte (char *dest, size_t destSize) const noexcept |
| | 文字をバイト列に変換
|
| |
| STL::string | ToString () const noexcept |
| | 文字をSTL::stringに変換
|
| |
|
|
static constexpr uint32_t | kInvalidMarkerBit = 1UL << 31UL |
| | 不正な文字を検出した際に書き込むビット位置
|
| |
|
static constexpr uint32_t | kValidateMask = 0xFFFFFFFF & ~kInvalidMarkerBit |
| | コードの有効範囲
|
| |
|
static constexpr size_t | kByteArraySize = 5 |
| | バイト配列のサイズ
|
| |
◆ Character()
| MGL::Text::Character::Character |
( |
uint32_t | code | ) |
|
|
inlineconstexprnoexcept |
◆ GetByteSize()
| size_t MGL::Text::Character::GetByteSize |
( |
| ) |
const |
|
nodiscardnoexcept |
文字をバイトに変換する際に必要なサイズを取得
- 戻り値
- 必要サイズ.不正な文字の場合は0
◆ GetCode()
| char32_t MGL::Text::Character::GetCode |
( |
| ) |
const |
|
inlinenodiscardconstexprnoexcept |
◆ IsNewLine()
| bool MGL::Text::Character::IsNewLine |
( |
| ) |
const |
|
inlinenodiscardconstexprnoexcept |
◆ IsNull()
| bool MGL::Text::Character::IsNull |
( |
| ) |
const |
|
inlinenodiscardconstexprnoexcept |
Null文字かどうかを判定
- 戻り値
-
| true | Null文字 |
| false | Null文字ではない |
◆ IsSpace()
| bool MGL::Text::Character::IsSpace |
( |
| ) |
const |
|
inlinenodiscardconstexprnoexcept |
スペースかどうかを取得
- 戻り値
-
| true | スペース文字 |
| false | スペース文字ではない |
◆ IsValid()
| bool MGL::Text::Character::IsValid |
( |
| ) |
const |
|
inlinenodiscardconstexprnoexcept |
◆ SetCode()
| void MGL::Text::Character::SetCode |
( |
char32_t | code | ) |
|
|
inlineconstexprnoexcept |
◆ ToByte() [1/2]
| char * MGL::Text::Character::ToByte |
( |
char * | dest, |
|
|
size_t | destSize ) const |
|
noexcept |
文字をバイト列に変換
- 引数
-
| [out] | dest | 書き込み先のアドレス |
| [in] | destSize | 書き込み先バッファのサイズ |
- 戻り値
- 成功した場合は終端記号を書き込んだアドレス.失敗時にはnullptr
◆ ToByte() [2/2]
| bool MGL::Text::Character::ToByte |
( |
char | byteArray[kByteArraySize] | ) |
const |
|
noexcept |
コードをバイト列に変換
- 引数
-
- 戻り値
-
- 覚え書き
- とりあえずUTF-8で返す. 将来は他の他の文字コード(Shift-JISなど)にも対応するかも.
◆ ToString()
文字をSTL::stringに変換
- 戻り値
- 変換した文字
このクラス詳解は次のファイルから抽出されました: