LLVM  4.0.0
Locale.cpp
Go to the documentation of this file.
1 #include "llvm/Support/Locale.h"
2 #include "llvm/ADT/StringRef.h"
3 #include "llvm/Config/llvm-config.h"
4 #include "llvm/Support/Unicode.h"
5 
6 namespace llvm {
7 namespace sys {
8 namespace locale {
9 
11 #if LLVM_ON_WIN32
12  return Text.size();
13 #else
15 #endif
16 }
17 
18 bool isPrint(int UCS) {
19 #if LLVM_ON_WIN32
20  // Restrict characters that we'll try to print to the lower part of ASCII
21  // except for the control characters (0x20 - 0x7E). In general one can not
22  // reliably output code points U+0080 and higher using narrow character C/C++
23  // output functions in Windows, because the meaning of the upper 128 codes is
24  // determined by the active code page in the console.
25  return ' ' <= UCS && UCS <= '~';
26 #else
28 #endif
29 }
30 
31 } // namespace locale
32 } // namespace sys
33 } // namespace llvm
bool isPrint(int c)
Definition: Locale.cpp:18
bool isPrintable(int UCS)
Determines if a character is likely to be displayed correctly on the terminal.
Definition: Unicode.cpp:23
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
Definition: StringRef.h:135
int columnWidth(StringRef s)
Definition: Locale.cpp:10
int columnWidthUTF8(StringRef Text)
Gets the number of positions the UTF8-encoded Text is likely to occupy when output on a terminal ("ch...
Definition: Unicode.cpp:343
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:47