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

Unicode code points and their names, see UnicodeNames.h. More...

#include "UnicodeNames.h"
#include "../data/UnicodeData.h"
#include <mutex>
#include <wx/mstream.h>
#include <wx/tokenzr.h>
#include <wx/txtstrm.h>
#include <wx/zstream.h>
Include dependency graph for UnicodeNames.cpp:

Functions

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

Detailed Description

Unicode code points and their names, see UnicodeNames.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.