Lines Matching defs:Text
31 /// Detects encoding of the Text. If the Text can be decoded using UTF-8,
33 inline Encoding detectEncoding(StringRef Text) {
34 const llvm::UTF8 *Ptr = reinterpret_cast<const llvm::UTF8 *>(Text.begin());
35 const llvm::UTF8 *BufEnd = reinterpret_cast<const llvm::UTF8 *>(Text.end());
41 /// Returns the number of columns required to display the \p Text on a
42 /// generic Unicode-capable terminal. Text is assumed to use the specified
44 inline unsigned columnWidth(StringRef Text, Encoding Encoding) {
46 int ContentWidth = llvm::sys::unicode::columnWidthUTF8(Text);
54 return Text.size();
57 /// Returns the number of columns required to display the \p Text,
60 inline unsigned columnWidthWithTabs(StringRef Text, unsigned StartColumn,
63 StringRef Tail = Text;
94 /// Text should span from the beginning of the escape sequence (starting with a
96 inline unsigned getEscapeSequenceLength(StringRef Text) {
97 assert(Text[0] == '\\');
98 if (Text.size() < 2)
101 switch (Text[1]) {
108 while (I < Text.size() && isHexDigit(Text[I]))
113 if (isOctDigit(Text[1])) {
115 while (I < Text.size() && I < 4 && isOctDigit(Text[I]))
119 return 1 + llvm::getNumBytesForUTF8(Text[1]);