LLVM API Documentation

Locale.cpp
Go to the documentation of this file.
00001 #include "llvm/Support/Locale.h"
00002 #include "llvm/Support/Unicode.h"
00003 
00004 namespace llvm {
00005 namespace sys {
00006 namespace locale {
00007 
00008 int columnWidth(StringRef Text) {
00009 #if LLVM_ON_WIN32
00010   return Text.size();
00011 #else
00012   return llvm::sys::unicode::columnWidthUTF8(Text);
00013 #endif
00014 }
00015 
00016 bool isPrint(int UCS) {
00017 #if LLVM_ON_WIN32
00018   // Restrict characters that we'll try to print to the the lower part of ASCII
00019   // except for the control characters (0x20 - 0x7E). In general one can not
00020   // reliably output code points U+0080 and higher using narrow character C/C++
00021   // output functions in Windows, because the meaning of the upper 128 codes is
00022   // determined by the active code page in the console.
00023   return ' ' <= UCS && UCS <= '~';
00024 #else
00025   return llvm::sys::unicode::isPrintable(UCS);
00026 #endif
00027 }
00028 
00029 } // namespace locale
00030 } // namespace sys
00031 } // namespace llvm