clang API Documentation
Enumerations | |
enum | Encoding { Encoding_UTF8, Encoding_Unknown } |
Functions | |
Encoding | detectEncoding (StringRef Text) |
Detects encoding of the Text. If the Text can be decoded using UTF-8, it is considered UTF8, otherwise we treat it as some 8-bit encoding. | |
unsigned | getCodePointCountUTF8 (StringRef Text) |
unsigned | getCodePointCount (StringRef Text, Encoding Encoding) |
Gets the number of code points in the Text using the specified Encoding. | |
unsigned | columnWidth (StringRef Text, Encoding Encoding) |
Returns the number of columns required to display the Text on a generic Unicode-capable terminal. Text is assumed to use the specified Encoding . | |
unsigned | columnWidthWithTabs (StringRef Text, unsigned StartColumn, unsigned TabWidth, Encoding Encoding) |
Returns the number of columns required to display the Text , starting from the StartColumn on a terminal with the TabWidth . The text is assumed to use the specified Encoding . | |
unsigned | getCodePointNumBytes (char FirstChar, Encoding Encoding) |
Gets the number of bytes in a sequence representing a single codepoint and starting with FirstChar in the specified Encoding. | |
bool | isOctDigit (char c) |
bool | isHexDigit (char c) |
unsigned | getEscapeSequenceLength (StringRef Text) |
Gets the length of an escape sequence inside a C++ string literal. Text should span from the beginning of the escape sequence (starting with a backslash) to the end of the string literal. |
Definition at line 27 of file Encoding.h.
unsigned clang::format::encoding::columnWidth | ( | StringRef | Text, |
Encoding | Encoding | ||
) | [inline] |
Returns the number of columns required to display the Text
on a generic Unicode-capable terminal. Text is assumed to use the specified Encoding
.
Definition at line 64 of file Encoding.h.
References Encoding_UTF8.
Referenced by buildFixItInsertionLine(), byteToColumn(), columnToByte(), columnWidthWithTabs(), and selectInterestingSourceRegion().
unsigned clang::format::encoding::columnWidthWithTabs | ( | StringRef | Text, |
unsigned | StartColumn, | ||
unsigned | TabWidth, | ||
Encoding | Encoding | ||
) | [inline] |
Returns the number of columns required to display the Text
, starting from the StartColumn
on a terminal with the TabWidth
. The text is assumed to use the specified Encoding
.
Definition at line 80 of file Encoding.h.
References columnWidth().
Referenced by clang::format::getCommentSplit(), clang::format::BreakableSingleLineToken::getLineLengthAfterSplit(), clang::format::BreakableBlockComment::getLineLengthAfterSplit(), and clang::format::getStringSplit().
Encoding clang::format::encoding::detectEncoding | ( | StringRef | Text | ) | [inline] |
Detects encoding of the Text. If the Text can be decoded using UTF-8, it is considered UTF8, otherwise we treat it as some 8-bit encoding.
Definition at line 34 of file Encoding.h.
References Encoding_Unknown, and Encoding_UTF8.
unsigned clang::format::encoding::getCodePointCount | ( | StringRef | Text, |
Encoding | Encoding | ||
) | [inline] |
Gets the number of code points in the Text using the specified Encoding.
Definition at line 52 of file Encoding.h.
References Encoding_UTF8, and getCodePointCountUTF8().
unsigned clang::format::encoding::getCodePointCountUTF8 | ( | StringRef | Text | ) | [inline] |
Definition at line 42 of file Encoding.h.
Referenced by getCodePointCount().
unsigned clang::format::encoding::getCodePointNumBytes | ( | char | FirstChar, |
Encoding | Encoding | ||
) | [inline] |
Gets the number of bytes in a sequence representing a single codepoint and starting with FirstChar in the specified Encoding.
Definition at line 96 of file Encoding.h.
References Encoding_UTF8.
Referenced by clang::format::getCommentSplit(), and clang::format::getStringSplit().
unsigned clang::format::encoding::getEscapeSequenceLength | ( | StringRef | Text | ) | [inline] |
Gets the length of an escape sequence inside a C++ string literal. Text should span from the beginning of the escape sequence (starting with a backslash) to the end of the string literal.
Definition at line 115 of file Encoding.h.
References isHexDigit(), and isOctDigit().
Referenced by clang::format::getStringSplit().
bool clang::format::encoding::isHexDigit | ( | char | c | ) | [inline] |
Definition at line 107 of file Encoding.h.
Referenced by getEscapeSequenceLength().
bool clang::format::encoding::isOctDigit | ( | char | c | ) | [inline] |
Definition at line 105 of file Encoding.h.
Referenced by getEscapeSequenceLength().