| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #ifndef CORE_INCLUDE_FXCRT_FX_EXT_H_ | 7 #ifndef CORE_INCLUDE_FXCRT_FX_EXT_H_ |
| 8 #define CORE_INCLUDE_FXCRT_FX_EXT_H_ | 8 #define CORE_INCLUDE_FXCRT_FX_EXT_H_ |
| 9 | 9 |
| 10 #include <cctype> | 10 #include <cctype> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 } | 29 } |
| 30 inline FX_BOOL FXSYS_isupper(int32_t ch) { | 30 inline FX_BOOL FXSYS_isupper(int32_t ch) { |
| 31 return ch >= 'A' && ch <= 'Z'; | 31 return ch >= 'A' && ch <= 'Z'; |
| 32 } | 32 } |
| 33 inline int32_t FXSYS_tolower(int32_t ch) { | 33 inline int32_t FXSYS_tolower(int32_t ch) { |
| 34 return ch < 'A' || ch > 'Z' ? ch : (ch + 0x20); | 34 return ch < 'A' || ch > 'Z' ? ch : (ch + 0x20); |
| 35 } | 35 } |
| 36 inline int32_t FXSYS_toupper(int32_t ch) { | 36 inline int32_t FXSYS_toupper(int32_t ch) { |
| 37 return ch < 'a' || ch > 'z' ? ch : (ch - 0x20); | 37 return ch < 'a' || ch > 'z' ? ch : (ch - 0x20); |
| 38 } | 38 } |
| 39 inline FX_BOOL FXSYS_iswalpha(wchar_t wch) { |
| 40 return (wch >= L'A' && wch <= L'Z') || (wch >= L'a' && wch <= L'z'); |
| 41 } |
| 42 inline FX_BOOL FXSYS_iswdigit(wchar_t wch) { |
| 43 return wch >= L'0' && wch <= L'9'; |
| 44 } |
| 45 inline FX_BOOL FXSYS_iswalnum(wchar_t wch) { |
| 46 return FXSYS_iswalpha(wch) || FXSYS_iswdigit(wch); |
| 47 } |
| 39 | 48 |
| 40 inline int FXSYS_toHexDigit(const FX_CHAR c) { | 49 inline int FXSYS_toHexDigit(const FX_CHAR c) { |
| 41 if (!std::isxdigit(c)) | 50 if (!std::isxdigit(c)) |
| 42 return 0; | 51 return 0; |
| 43 char upchar = std::toupper(c); | 52 char upchar = std::toupper(c); |
| 44 return upchar > '9' ? upchar - 'A' + 10 : upchar - '0'; | 53 return upchar > '9' ? upchar - 'A' + 10 : upchar - '0'; |
| 45 } | 54 } |
| 46 | 55 |
| 47 inline int FXSYS_toDecimalDigit(const FX_CHAR c) { | 56 inline int FXSYS_toDecimalDigit(const FX_CHAR c) { |
| 48 if (!std::isdigit(c)) | 57 if (!std::isdigit(c)) |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 j -= gap; | 101 j -= gap; |
| 93 } | 102 } |
| 94 pArray[j + gap] = v1; | 103 pArray[j + gap] = v1; |
| 95 } | 104 } |
| 96 gap >>= 1; | 105 gap >>= 1; |
| 97 } | 106 } |
| 98 } | 107 } |
| 99 }; | 108 }; |
| 100 | 109 |
| 101 #endif // CORE_INCLUDE_FXCRT_FX_EXT_H_ | 110 #endif // CORE_INCLUDE_FXCRT_FX_EXT_H_ |
| OLD | NEW |