Lines Matching refs:Text
10 /// Contains functions for text encoding manipulation. Supports UTF-8,
32 /// Detects encoding of the Text. If the Text can be decoded using UTF-8,
34 inline Encoding detectEncoding(StringRef Text) {
35 const llvm::UTF8 *Ptr = reinterpret_cast<const llvm::UTF8 *>(Text.begin());
36 const llvm::UTF8 *BufEnd = reinterpret_cast<const llvm::UTF8 *>(Text.end());
42 /// Returns the number of columns required to display the \p Text on a
43 /// generic Unicode-capable terminal. Text is assumed to use the specified
45 inline unsigned columnWidth(StringRef Text, Encoding Encoding) {
47 int ContentWidth = llvm::sys::unicode::columnWidthUTF8(Text);
55 return Text.size();
58 /// Returns the number of columns required to display the \p Text,
60 /// text is assumed to use the specified \p Encoding.
61 inline unsigned columnWidthWithTabs(StringRef Text, unsigned StartColumn,
64 StringRef Tail = Text;
95 /// Text should span from the beginning of the escape sequence (starting with a
97 inline unsigned getEscapeSequenceLength(StringRef Text) {
98 assert(Text[0] == '\\');
99 if (Text.size() < 2)
102 switch (Text[1]) {
109 while (I < Text.size() && isHexDigit(Text[I]))
114 if (isOctDigit(Text[1])) {
116 while (I < Text.size() && I < 4 && isOctDigit(Text[I]))
120 return 1 + llvm::getNumBytesForUTF8(Text[1]);