LLVM
8.0.1
|
Enumerations | |
enum | ColumnWidthErrors { ErrorInvalidUTF8 = -2, ErrorNonPrintableCharacter = -1 } |
Functions | |
bool | isPrintable (int UCS) |
Determines if a character is likely to be displayed correctly on the terminal. More... | |
int | columnWidthUTF8 (StringRef Text) |
Gets the number of positions the UTF8-encoded Text is likely to occupy when output on a terminal ("character width"). More... | |
int | foldCharSimple (int C) |
Fold input unicode character according the Simple unicode case folding rules. More... | |
static int | charWidth (int UCS) |
Gets the number of positions a character is likely to occupy when output on a terminal ("character width"). More... | |
|
inlinestatic |
Gets the number of positions a character is likely to occupy when output on a terminal ("character width").
This depends on the implementation of the terminal, and there's no standard definition of character width. The implementation defines it in a way that is expected to be compatible with a generic Unicode-capable terminal.
Definition at line 227 of file Unicode.cpp.
References llvm::sys::UnicodeCharSet::contains(), ErrorNonPrintableCharacter, and isPrintable().
int llvm::sys::unicode::columnWidthUTF8 | ( | StringRef | Text | ) |
Gets the number of positions the UTF8-encoded Text
is likely to occupy when output on a terminal ("character width").
This depends on the implementation of the terminal, and there's no standard definition of character width.
The implementation defines it in a way that is expected to be compatible with a generic Unicode-capable terminal.
Text
contains non-printable characters (as identified by isPrintable);Definition at line 343 of file Unicode.cpp.
References ErrorInvalidUTF8, llvm::getNumBytesForUTF8(), and llvm::StringRef::size().
Referenced by llvm::sys::locale::columnWidth().
int llvm::sys::unicode::foldCharSimple | ( | int | C | ) |
Fold input unicode character according the Simple unicode case folding rules.
Definition at line 16 of file UnicodeCaseFold.cpp.
References C.
Referenced by foldCharDwarf().
bool llvm::sys::unicode::isPrintable | ( | int | UCS | ) |
Determines if a character is likely to be displayed correctly on the terminal.
Exact implementation would have to depend on the specific terminal, so we define the semantic that should be suitable for generic case of a terminal capable to output Unicode characters.
All characters from the Unicode code point range are considered printable except for:
Definition at line 23 of file Unicode.cpp.
References llvm::sys::UnicodeCharSet::contains().
Referenced by charWidth(), llvm::yaml::escape(), and llvm::sys::locale::isPrint().