UnicodeUtils Class Reference

#include <unicodeutils.h>

Detailed Description

This class handles unicode decompositions and correct string comparison using decomposition informations.

Public Types

using DecompositionArray = BaseArray< Utf32Char, 1, BASEARRAYFLAGS::MOVEANDCOPYOBJECTS, FixedBufferAllocator< Utf32Char, 8, DefaultAllocator > >
 
using DecompositionHfsArray = BaseArray< Utf16Char, 1, BASEARRAYFLAGS::MOVEANDCOPYOBJECTS, FixedBufferAllocator< Utf16Char, 8, DefaultAllocator > >
 

Static Public Member Functions

static MAXON_METHOD Result< StringDecomposeStringHfs (const String &str)
 
static MAXON_METHOD Result< StringDecomposeString (const String &str)
 
static MAXON_METHOD String GetUnicodeVersion ()
 
static MAXON_METHOD Result< StringNormalizeString (NORMALIZATION form, const String &str)
 
static MAXON_METHOD Bool UniCharDecomposition (Utf32Char chr, DecompositionArray &res_decomp)
 
static MAXON_METHOD Bool UniCharHfsDecomposition (Utf16Char chr, DecompositionHfsArray &res_decomp)
 
static MAXON_METHOD COMPARERESULT UniCodeCompare (Utf32Char a, Utf32Char b)
 
static MAXON_METHOD CHARACTERTYPE GetCharacterType (Utf32Char chr)
 
static MAXON_METHOD Utf32Char UpperCase (Utf32Char chr)
 
static MAXON_METHOD Utf32Char TitleCase (Utf32Char chr)
 
static MAXON_METHOD Utf32Char LowerCase (Utf32Char chr)
 

Private Member Functions

 MAXON_INTERFACE_NONVIRTUAL (UnicodeUtils, MAXON_REFERENCE_NONE, "net.maxon.interface.unicodeutils")
 

Member Typedef Documentation

◆ DecompositionArray

Decomposed representation of a unicode character.

◆ DecompositionHfsArray

Member Function Documentation

◆ MAXON_INTERFACE_NONVIRTUAL()

MAXON_INTERFACE_NONVIRTUAL ( UnicodeUtils  ,
MAXON_REFERENCE_NONE  ,
"net.maxon.interface.unicodeutils"   
)
private

◆ DecomposeStringHfs()

static MAXON_METHOD Result<String> DecomposeStringHfs ( const String str)
static

Normalize a string to HFS+ decomposition.

◆ DecomposeString()

static MAXON_METHOD Result<String> DecomposeString ( const String str)
static

Normalize a string to HFS+ decomposition.

◆ GetUnicodeVersion()

static MAXON_METHOD String GetUnicodeVersion ( )
static

Returns the version of Unicode database used internally.

Returns
The version, e.g: String("8.0.0")

◆ NormalizeString()

static MAXON_METHOD Result<String> NormalizeString ( NORMALIZATION  form,
const String str 
)
static

Normalize a string.

◆ UniCharDecomposition()

static MAXON_METHOD Bool UniCharDecomposition ( Utf32Char  chr,
DecompositionArray res_decomp 
)
static

Breaks a unicode character into the decomposited properties. This is e.g. useful for sorting algorithms. A german 'A' umlaut will be decomposed to 'A' and '..'

Parameters
[in]chrUnicode character to be decomposited.
[out]res_decompArray with the decomposited character elements.
Returns
True if the operation was successful.

◆ UniCharHfsDecomposition()

static MAXON_METHOD Bool UniCharHfsDecomposition ( Utf16Char  chr,
DecompositionHfsArray res_decomp 
)
static

Breaks a unicode character into the decomposited properties. This is e.g. useful for sorting algorithms. A german 'A' umlaut will be decomposed to 'A' and '..'

Parameters
[in]chrUnicode character to be decomposited.
[out]res_decompArray with the decomposited character elements.
Returns
True if the operation was successful.

◆ UniCodeCompare()

static MAXON_METHOD COMPARERESULT UniCodeCompare ( Utf32Char  a,
Utf32Char  b 
)
static

Compares two unicode characters. this function uses the decomposition properties to do advanced unicode sorting.

See also
UniCharDecomposition().
Parameters
[in]aFirst character to compare.
[in]bSecond character to compare.
Returns
COMPARERESULT of the operation.

◆ GetCharacterType()

static MAXON_METHOD CHARACTERTYPE GetCharacterType ( Utf32Char  chr)
static

Returns the type of a given unicode char. This can be used to determine if a character is a letter, number or symbol

Parameters
[in]chrCharacter to find.
Returns
CHARACTERTYPE of the character.

◆ UpperCase()

static MAXON_METHOD Utf32Char UpperCase ( Utf32Char  chr)
static

Returns the uppercase of a given unicode char.

Parameters
[in]chrCharacter to convert to uppercase.
Returns
Uppercase character of chr.

◆ TitleCase()

static MAXON_METHOD Utf32Char TitleCase ( Utf32Char  chr)
static

Returns the titlecase version of a given unicode char.

Parameters
[in]chrCharacter to convert to titlecase.
Returns
Titlecase character of chr.

◆ LowerCase()

static MAXON_METHOD Utf32Char LowerCase ( Utf32Char  chr)
static

Returns the lowercase version of a given unicode char.

Parameters
[in]chrCharacter to convert to lowercase.
Returns
Lowercase character of chr.