Unicode Char
Typedefs | Enumerations | Functions
unicode_char.h File Reference

The data file that stores the information. More...

#include <iostream>
#include <vector>
#include <string>
#include <cstdint>
#include <utility>

Go to the source code of this file.

Typedefs

using unicode::UChar = int32_t
 

Enumerations

enum  unicode::GeneralCategory {
  Cc, Cf, Co, Cs,
  Ll, Lm, Lo, Lt,
  Lu, Mc, Me, Mn,
  Nd, Nl, No, Pc,
  Pd, Pe, Pf, Pi,
  Po, Ps, Sc, Sk,
  Sm, So, Zl, Zp,
  Zs
}
 
enum  unicode::BaseGeneralCategory {
  C, L, M, N,
  P, S, Z
}
 
enum  BidirectionalCategory {
  AL, AN, B, BN,
  CS, EN, ES, ET,
  FSI, L, LRE, LRI,
  LRO, NSM, ON, PDF,
  PDI, R, RLE, RLI,
  RLO, S, WS
}
 
enum  unicode::DecompositionMappingTag {
  NO_MAPPING, CANONICAL, CIRCLE, COMPAT,
  FINAL, FONT, FRACTION, INITIAL,
  ISOLATED, MEDIAL, NARROW, NOBREAK,
  SMALL, SQUARE, SUB, SUPER,
  VERTICAL, WIDE
}
 

Functions

std::ostream & unicode::operator<< (std::ostream &, GeneralCategory)
 
std::ostream & unicode::operator<< (std::ostream &, BaseGeneralCategory)
 
std::ostream & unicode::operator<< (std::ostream &, BidirectionalCategory)
 
std::ostream & unicode::operator<< (std::ostream &, DecompositionMappingTag)
 
GeneralCategory unicode::getGeneralCategory (UChar code)
 
BaseGeneralCategory unicode::getBaseGeneralCategory (UChar code)
 
int32_t unicode::getCanonicalCombiningClass (UChar code)
 
BidirectionalCategory unicode::getBidirectionalCategory (UChar code)
 
DecompositionMappingTag unicode::getDecompositionMappingTag (UChar code)
 
std::vector< UChar > unicode::getDecompositionMapping (UChar code)
 
void unicode::getDecompositionMapping (UChar code, UChar buffer[])
 
int32_t unicode::getDecimalDigitValue (UChar code)
 
int32_t unicode::getDigitValue (UChar code)
 
double unicode::getNumericValue (UChar code)
 
std::pair< int64_t, int64_t > unicode::getNumericFraction (UChar code)
 
bool unicode::isMirrored (UChar code)
 
UChar unicode::getUpperCase (UChar code)
 
UChar unicode::getLowerCase (UChar code)
 
UChar unicode::getTitleCase (UChar code)
 
std::string unicode::toUTF8 (UChar code)
 
std::string unicode::toUTF8 (const std::vector< UChar > codes)
 
UChar unicode::fromUTF8Char (const std::string &str)
 
std::vector< UChar > unicode::fromUTF8 (const std::string &str)
 
std::u16string unicode::toUTF16 (const std::vector< UChar > codes)
 
std::vector< UChar > unicode::fromUTF16 (const std::u16string &str)
 

Detailed Description

The data file that stores the information.

Enumeration Type Documentation

◆ BaseGeneralCategory

The types of base general category.

◆ DecompositionMappingTag

The tags of decomposition mappingy.

◆ GeneralCategory

The types of general category.

Function Documentation

◆ fromUTF16()

std::vector< UChar > unicode::fromUTF16 ( const std::u16string &  str)

Convert UTF-16 string to code points.

◆ fromUTF8()

std::vector< UChar > unicode::fromUTF8 ( const std::string &  str)

Convert a UTF-8 string to code points.

◆ fromUTF8Char()

UChar unicode::fromUTF8Char ( const std::string &  str)

Convert a UTF-8 string to a code point.

◆ getBaseGeneralCategory()

BaseGeneralCategory unicode::getBaseGeneralCategory ( UChar  code)

Get the base general category of a code point.

◆ getBidirectionalCategory()

BidirectionalCategory unicode::getBidirectionalCategory ( UChar  code)

Get the bidirectional category of a code point.

◆ getCanonicalCombiningClass()

int32_t unicode::getCanonicalCombiningClass ( UChar  code)

Get the canonical combining class of a code point.

◆ getDecimalDigitValue()

int32_t unicode::getDecimalDigitValue ( UChar  code)

Get the decimal digit value of a code point.

Returns
-1 will be returned if it is not a decimal digit.

◆ getDecompositionMapping() [1/2]

std::vector< UChar > unicode::getDecompositionMapping ( UChar  code)

Get the mapped decomposition of a code point.

◆ getDecompositionMapping() [2/2]

void unicode::getDecompositionMapping ( UChar  code,
UChar  buffer[] 
)

Get the mapped decomposition of a code point.

◆ getDecompositionMappingTag()

DecompositionMappingTag unicode::getDecompositionMappingTag ( UChar  code)

Get the decomposition mapping tag of a code point.

◆ getDigitValue()

int32_t unicode::getDigitValue ( UChar  code)

Get the digit value of a code point.

Returns
-1 will be returned if it is not a digit.

◆ getGeneralCategory()

GeneralCategory unicode::getGeneralCategory ( UChar  code)

Get the general category of a code point.

◆ getLowerCase()

UChar unicode::getLowerCase ( UChar  code)

Get the lower case of a code point.

Returns
The original code point will be returned if it doesn't have a lower case.

◆ getNumericFraction()

std::pair< int64_t, int64_t > unicode::getNumericFraction ( UChar  code)

Get the numeric value of a code point in fraction form.

Returns
{-1, 0} will be returned if it is not a numeric.

◆ getNumericValue()

double unicode::getNumericValue ( UChar  code)

Get the numeric value of a code point.

Returns
nan will be returned if it is not a numeric.

◆ getTitleCase()

UChar unicode::getTitleCase ( UChar  code)

Get the title case of a code point.

Returns
The original code point will be returned if it doesn't have a title case.

◆ getUpperCase()

UChar unicode::getUpperCase ( UChar  code)

Get the upper case of a code point.

Returns
The original code point will be returned if it doesn't have a upper case.

◆ isMirrored()

bool unicode::isMirrored ( UChar  code)

Whether the code point is mirrored.

◆ operator<<() [1/4]

std::ostream & unicode::operator<< ( std::ostream &  os,
BaseGeneralCategory  c 
)

Outputs the base general category with its name.

◆ operator<<() [2/4]

std::ostream & unicode::operator<< ( std::ostream &  os,
BidirectionalCategory  c 
)

Outputs the bidirectional category with its name.

◆ operator<<() [3/4]

std::ostream & unicode::operator<< ( std::ostream &  os,
DecompositionMappingTag  tag 
)

Outputs the decomposition mapping tag with its name.

◆ operator<<() [4/4]

std::ostream & unicode::operator<< ( std::ostream &  os,
GeneralCategory  c 
)

Outputs the general category with its name.

◆ toUTF16()

std::u16string unicode::toUTF16 ( const std::vector< UChar >  codes)

Convert code points to UTF-16 string.

◆ toUTF8() [1/2]

std::string unicode::toUTF8 ( const std::vector< UChar >  codes)

Convert code points to UTF-8 string.

◆ toUTF8() [2/2]

std::string unicode::toUTF8 ( UChar  code)

Convert a code point to UTF-8 string.