sincerely Singaporean

If you have not done so, read this full tutorial on how to use SGEXTN to build an application.

SGXChar

see header file

see source file

class SGXChar;

part of SGEXTN module SG_Core

Unicode character (most of them)

detailed description

list of all including inherited members

implementation details

preprocessor file inclusion directive: #include ‹SGXChar.h›

CMake target for BuildLah: SGEXTN::SG_Core

see this link for more information about BuildLah

parent class: (none)

children classes: (none)

instance member functions

[[nodiscard]] operator char() const;

SGXChar(int unicode);

SGXChar(char c);

[[nodiscard]] SGXChar getLowerLanguageAware() const;

[[nodiscard]] int getUnicode() const;

[[nodiscard]] SGXChar getUpperLanguageAware() const;

[[nodiscard]] int hash() const;

[[nodiscard]] bool isASCII() const;

[[nodiscard]] bool isDigit() const;

[[nodiscard]] bool isDigitBase16() const;

[[nodiscard]] bool isEnglishAlphanumeric() const;

[[nodiscard]] bool isEnglishLetter() const;

[[nodiscard]] bool isEnglishLowercase() const;

[[nodiscard]] bool isEnglishUppercase() const;

[[nodiscard]] bool isWhitespace() const;

[[nodiscard]] bool operator!=(char x) const;

[[nodiscard]] bool operator!=(SGXChar x) const;

[[nodiscard]] bool operator‹(SGXChar x) const;

[[nodiscard]] bool operator‹(char x) const;

[[nodiscard]] bool operator‹=(SGXChar x) const;

[[nodiscard]] bool operator‹=(char x) const;

[[nodiscard]] bool operator==(SGXChar x) const;

[[nodiscard]] bool operator==(char x) const;

[[nodiscard]] bool operator›(char x) const;

[[nodiscard]] bool operator›(SGXChar x) const;

[[nodiscard]] bool operator›=(char x) const;

[[nodiscard]] bool operator›=(SGXChar x) const;

void toLowerLanguageAware();

void toUpperLanguageAware();

Detailed Description

SGXChar stores a Unicode character in the Basic Multilingual Plane. This covers almost all characters that you would need except for emojis. It is not guaranteed that all these characters will display correctly since that depends on the font (SingScript.sg) that you are using. English, Malay, and most common mathematical symbols are guaranteed to display properly.

Implementation Details

SGXChar stores the Unicode value of the character. When language aware features are needed, it uses QChar internally.

[[nodiscard]] operator char() const;

Converts SGXChar to a C++ char.

If the SGXChar is not a ASCII character, this causes undefined behaviour.

SGXChar(int unicode);

Converts Unicode index unicode to its corresponding SGXChar.

If unicode is below 0 or above 65535, this will crash.

SGXChar(char c);

Converts C++ char c to a SGXChar.

[[nodiscard]] SGXChar getLowerLanguageAware() const;

Returns the language aware lowercase version of this SGXChar.

This works for non English languages also.

[[nodiscard]] int getUnicode() const;

Returns the Unicode index of this SGXChar.

[[nodiscard]] SGXChar getUpperLanguageAware() const;

Returns the language aware uppercase version of this SGXChar.

This works for non English languages also.

[[nodiscard]] int hash() const;

Hash function defined for SGLHash.

[[nodiscard]] bool isASCII() const;

Returns if this SGXChar is an ASCII character.

The SGXChar can only be converted to a C++ char safely if this is true.

[[nodiscard]] bool isDigit() const;

Returns if this SGXChar is a digit from 0 to 9.

[[nodiscard]] bool isDigitBase16() const;

Returns if this SGXChar is a digit from 0 to F in base16.

Both uppercase and lowercase letters are fine for base16 numerical representation.

[[nodiscard]] bool isEnglishAlphanumeric() const;

Returns if this SGXChar is an alphanumeric character.

This can be used to validate usernames and file names.

[[nodiscard]] bool isEnglishLetter() const;

Returns if this SGXChar is a English letter, ignoring case.

[[nodiscard]] bool isEnglishLowercase() const;

Returns if this SGXChar is a English lowercase character fron a to z.

[[nodiscard]] bool isEnglishUppercase() const;

Returns if this SGXChar is a English uppercase character from A to Z.

[[nodiscard]] bool isWhitespace() const;

Returns if this SGXChar is a whitespace character, including zero width space, em space, en space, Chinese space, etc.

The Braille character with no dots definitely bypass this check.

The zero width joiner may or may not bypass this check.

[[nodiscard]] bool operator!=(char x) const;

Returns if this SGXChar is a different character from x.

[[nodiscard]] bool operator!=(SGXChar x) const;

Returns if this SGXChar is a different character from x.

[[nodiscard]] bool operator‹(SGXChar x) const;

Returns if this SGXChar has a smaller Unicode index than x.

[[nodiscard]] bool operator‹(char x) const;

Returns if this SGXChar has a smaller Unicode index than x.

[[nodiscard]] bool operator‹=(SGXChar x) const;

Returns if this SGXChar has a Unicode index smaller than or equal to that of x.

[[nodiscard]] bool operator‹=(char x) const;

Returns if this SGXChar has a Unicode index smaller than or equal to that of x.

[[nodiscard]] bool operator==(SGXChar x) const;

Returns if this SGXChar is the same character as x.

[[nodiscard]] bool operator==(char x) const;

Returns if this SGXChar is the same character as x.

[[nodiscard]] bool operator›(char x) const;

Returns if this SGXChar has a greater Unicode index than x.

[[nodiscard]] bool operator›(SGXChar x) const;

Returns if this SGXChar has a greater Unicode index than x.

[[nodiscard]] bool operator›=(char x) const;

Returns if this SGXChar has a Unicode index greater than or equal to that of x.

[[nodiscard]] bool operator›=(SGXChar x) const;

Returns if this SGXChar has a Unicode index greater than or equal to that of x.

void toLowerLanguageAware();

Changes this SGXChar to its language aware lowercase form.

This works for non English languages also.

void toUpperLanguageAware();

Changes this SGXChar to its language aware uppercase form.

This works for non English languages also.

©2025 05524F.sg (Singapore)

contact 05524F / report a bug / make a suggestion

about 05524F SINGAPORE values

list of 05524F projects