wxMaxima
Loading...
Searching...
No Matches
Functions
UnicodeNames.h File Reference

Unicode code points typed as hex numbers, and the names Unicode gives them. More...

#include <functional>
#include <optional>
#include <wx/string.h>
Include dependency graph for UnicodeNames.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

std::optional< long > wxm::HexCodePoint (const wxString &text)
 The code point a hexadecimal number names, if it names one.
 
wxString wxm::UnicodeCharName (long codePoint)
 The name UnicodeData.txt gives a code point.
 
void wxm::ForEachUnicodeChar (const std::function< bool(long, const wxString &)> &func)
 Calls func(codePoint, name) for each named character in UnicodeData.txt.
 

Detailed Description

Unicode code points typed as hex numbers, and the names Unicode gives them.

ESC 61 ESC enters an "a": the ESC popup offers the code point it has been typed so far next to the named ESC codes, and needs to know whether the typed text is a code point and what to call it. The names come from the UnicodeData.txt table the Unicode sidebar uses, which is embedded in the binary (data/UnicodeData.h).

Function Documentation

◆ ForEachUnicodeChar()

void wxm::ForEachUnicodeChar ( const std::function< bool(long, const wxString &)> &  func)

Calls func(codePoint, name) for each named character in UnicodeData.txt.

In the table's order, which is ascending code points. Control characters and the private-use planes are skipped; the "<..., First>"/"<..., Last>" markers of the other ranges are not. Stops early if func returns false.

◆ HexCodePoint()

std::optional< long > wxm::HexCodePoint ( const wxString &  text)

The code point a hexadecimal number names, if it names one.

Parameters
textA hex number, optionally preceded by "u+" or "U+" ("61", "00be", "U+1D49C").
Returns
The code point, or nothing if the text isn't a hex number or the number lies outside Unicode's range or among the surrogates, which aren't characters on their own.

◆ UnicodeCharName()

wxString wxm::UnicodeCharName ( long  codePoint)

The name UnicodeData.txt gives a code point.

Returns
The name ("LATIN SMALL LETTER A"), or an empty string if the table has none. Code points the table only covers by a range (the CJK ideographs, Hangul syllables, ...) and control characters have none.

Decompresses and scans the table, stopping at the code point; the result of the last call is cached, as the popup asks for the same code point while the list is redrawn.