That Terminal
A terminal emulator designed for video making purposes.
ctype.cc File Reference

Functions for identifying and converting unicode characters and representation forms. More...

#include <bitset>
#include <algorithm>
#include <cstring>
#include <array>
#include "data/unidata.cc"
#include "ctype.hh"
#include "log2.hh"
Include dependency graph for ctype.cc:

Classes

class  constexpr_bitset< N >
 
class  bitval_array< nwords, bits_per_elem >
 
class  compressed_bitset< N, maxdim, maxdim2 >
 

Macros

#define USE_MAP2
 
#define B(c)   /*std::pair<const std::pair<char32_t,unsigned>*, std::size_t>*/{&c##_table[0],std::size(c##_table)}
 

Functions

bool isupper (char32_t c)
 
bool islower (char32_t c)
 
bool isalpha (char32_t c)
 
bool isalnum (char32_t c)
 
bool isalnum_ (char32_t c)
 
bool isdigit (char32_t c)
 
bool isxdigit (char32_t c)
 
bool ispunct (char32_t c)
 
bool isspace (char32_t c)
 
bool isspace_punct (char32_t c)
 
bool isblank (char32_t c)
 
bool isctrl (char32_t c)
 
bool isprint (char32_t c)
 
bool isgraph (char32_t c)
 
bool isnotword (char32_t c)
 
bool isdouble (char32_t c)
 
char32_t tolower (char32_t c)
 
char32_t toupper (char32_t c)
 
char32_t totitle (char32_t c)
 
std::u32string FromUTF8 (std::string_view s)
 
std::string ToUTF8 (std::u32string_view s)
 
std::size_t CountIndent (std::u32string_view text, std::size_t begin)
 
std::u32string FromCP437 (std::string_view s)
 

Variables

constexpr unsigned cap = 0x10FFFE
 

Detailed Description

Functions for identifying and converting unicode characters and representation forms.

Function Documentation

◆ CountIndent()

std::size_t CountIndent ( std::u32string_view  s,
std::size_t  begin = 0 
)

Calculates and returns the number of spaces in the beginning of the given string.

Parameters
sThe string to be searched.
beginAn optional beginning index from which to count the spaces.

◆ FromCP437()

std::u32string FromCP437 ( std::string_view  s)

Converts given text, assumed to be CP437 encoded, into a sequence of unicode codepoints

◆ FromUTF8()

std::u32string FromUTF8 ( std::string_view  s)

This function is optimized for performance. A simple (but incomplete) implementation is shown in if-0. Surrogate pairs are detected and parsed properly, if they appear within a single string.

◆ isalnum()

bool isalnum ( char32_t  c)
Returns
true if given code index represents an alphabet or a numeric digit

◆ isalnum_()

bool isalnum_ ( char32_t  c)
Returns
true if given code index represents an alphabet or a numeric digit or the underscore

◆ isalpha()

bool isalpha ( char32_t  c)
Returns
true if given code index represents an alphabet

◆ isblank()

bool isblank ( char32_t  c)
Returns
true if given code index represents whitespace

◆ isctrl()

bool isctrl ( char32_t  c)
Returns
true if given code index represents a control character

◆ isdigit()

bool isdigit ( char32_t  c)
Returns
true if given code index represents a numeric digit

◆ isdouble()

bool isdouble ( char32_t  c)
Returns
true if given code index is double-wide

◆ isgraph()

bool isgraph ( char32_t  c)
Returns
true if given code index is graphics symbol

◆ islower()

bool islower ( char32_t  c)
Returns
true if given code index is lowercase

◆ isnotword()

bool isnotword ( char32_t  c)
Returns
true if given code index is graphics symbol

◆ isprint()

bool isprint ( char32_t  c)
Returns
true if given code index is printable

◆ ispunct()

bool ispunct ( char32_t  c)
Returns
true if given code index represents punctuation

◆ isspace()

bool isspace ( char32_t  c)
Returns
true if given code index represents whitespace

◆ isspace_punct()

bool isspace_punct ( char32_t  c)
Returns
true if given code index represents whitespace or punctuation

◆ isupper()

bool isupper ( char32_t  c)
Returns
true if given code index is uppercase

◆ isxdigit()

bool isxdigit ( char32_t  c)
Returns
true if given code index represents a hexadecimal digit

◆ tolower()

char32_t tolower ( char32_t  c)

Converts the given code index to its corresponding lowercase version

◆ totitle()

char32_t totitle ( char32_t  c)

Converts the given code index to its corresponding titlecase version

◆ toupper()

char32_t toupper ( char32_t  c)

Converts the given code index to its corresponding uppercase version

◆ ToUTF8()

std::string ToUTF8 ( std::u32string_view  s)

This function is optimized for performance.