clang  6.0.0svn
Enumerations | Functions
clang::format::encoding Namespace Reference

Enumerations

enum  Encoding { Encoding_UTF8, Encoding_Unknown }
 

Functions

Encoding detectEncoding (StringRef Text)
 Detects encoding of the Text. More...
 
unsigned columnWidth (StringRef Text, Encoding Encoding)
 Returns the number of columns required to display the Text on a generic Unicode-capable terminal. More...
 
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. More...
 
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. More...
 
bool isOctDigit (char c)
 
bool isHexDigit (char c)
 
unsigned getEscapeSequenceLength (StringRef Text)
 Gets the length of an escape sequence inside a C++ string literal. More...
 

Enumeration Type Documentation

◆ Encoding

Enumerator
Encoding_UTF8 
Encoding_Unknown 

Definition at line 28 of file Encoding.h.

Function Documentation

◆ columnWidth()

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 46 of file Encoding.h.

References Encoding_UTF8.

Referenced by byteToColumn(), columnToByte(), columnWidthWithTabs(), and selectInterestingSourceRegion().

◆ columnWidthWithTabs()

unsigned clang::format::encoding::columnWidthWithTabs ( StringRef  Text,
unsigned  StartColumn,
unsigned  TabWidth,
Encoding  Encoding 
)
inline

◆ detectEncoding()

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 35 of file Encoding.h.

References Encoding_Unknown, and Encoding_UTF8.

◆ getCodePointNumBytes()

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 78 of file Encoding.h.

References Encoding_UTF8.

Referenced by clang::format::getCommentSplit(), and clang::format::getStringSplit().

◆ getEscapeSequenceLength()

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 97 of file Encoding.h.

Referenced by clang::format::getStringSplit().

◆ isHexDigit()

bool clang::format::encoding::isHexDigit ( char  c)
inline

Definition at line 89 of file Encoding.h.

◆ isOctDigit()

bool clang::format::encoding::isOctDigit ( char  c)
inline

Definition at line 87 of file Encoding.h.