Add some functions to handle supplementary characters

The added functions are:

- wxUniChar::IsBMP()
- wxUniChar::IsSupplementary()
- wxUniChar::HighSurrogate()
- wxUniChar::LowSurrogate()
This commit is contained in:
ARATA Mizuki
2017-05-01 01:47:28 +09:00
parent 61f0e0ce22
commit 90c990cf83
2 changed files with 113 additions and 0 deletions

View File

@@ -83,6 +83,82 @@ public:
*/
bool GetAsChar(char *c) const;
/**
Returns true if the character is a BMP character (i.e.\ if its value is less than 0x10000).
@since 3.1.1
*/
bool IsBMP() const;
/**
Returns true if the character is a BMP character (i.e.\ if its value is less than 0x10000).
@param value
The Unicode code point of the character.
@since 3.1.1
*/
static bool IsBMP(wxUint32 value);
/**
Returns true if the character is a supplementary character (i.e.\ between 0x10000 and 0x10FFFF).
@since 3.1.1
*/
bool IsSupplementary() const;
/**
Returns true if the character is a supplementary character (i.e.\ between 0x10000 and 0x10FFFF).
@param value
The Unicode code point of the character.
@since 3.1.1
*/
static bool IsSupplementary(wxUint32 value);
/**
Returns the high surrogate code unit for the supplementary character.
@pre IsSupplementary() const
@since 3.1.1
*/
wxUint16 HighSurrogate() const;
/**
Returns the high surrogate code unit for the supplementary character.
@param value
The Unicode code point of the character.
@pre IsSupplementary(wxUint32 value)
@since 3.1.1
*/
static wxUint16 HighSurrogate(wxUint32 value);
/**
Returns the low surrogate code unit for the supplementary character.
@pre IsSupplementary() const
@since 3.1.1
*/
wxUint16 LowSurrogate() const;
/**
Returns the low surrogate code unit for the supplementary character.
@param value
The Unicode code point of the character.
@pre IsSupplementary(wxUint32 value)
@since 3.1.1
*/
static wxUint16 LowSurrogate(wxUint32 value);
//@{
/**
Conversions to char and wchar_t types: all of those are needed to be