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 12 matching lines...) Expand all Loading... |
23 FX_FLOAT FXSYS_strtof(const FX_CHAR* pcsStr, | 23 FX_FLOAT FXSYS_strtof(const FX_CHAR* pcsStr, |
24 int32_t iLength = -1, | 24 int32_t iLength = -1, |
25 int32_t* pUsedLen = NULL); | 25 int32_t* pUsedLen = NULL); |
26 FX_FLOAT FXSYS_wcstof(const FX_WCHAR* pwsStr, | 26 FX_FLOAT FXSYS_wcstof(const FX_WCHAR* pwsStr, |
27 int32_t iLength = -1, | 27 int32_t iLength = -1, |
28 int32_t* pUsedLen = NULL); | 28 int32_t* pUsedLen = NULL); |
29 FX_WCHAR* FXSYS_wcsncpy(FX_WCHAR* dstStr, const FX_WCHAR* srcStr, size_t count); | 29 FX_WCHAR* FXSYS_wcsncpy(FX_WCHAR* dstStr, const FX_WCHAR* srcStr, size_t count); |
30 int32_t FXSYS_wcsnicmp(const FX_WCHAR* s1, const FX_WCHAR* s2, size_t count); | 30 int32_t FXSYS_wcsnicmp(const FX_WCHAR* s1, const FX_WCHAR* s2, size_t count); |
31 int32_t FXSYS_strnicmp(const FX_CHAR* s1, const FX_CHAR* s2, size_t count); | 31 int32_t FXSYS_strnicmp(const FX_CHAR* s1, const FX_CHAR* s2, size_t count); |
32 | 32 |
33 inline FX_BOOL FXSYS_islower(int32_t ch) { | 33 inline bool FXSYS_islower(int32_t ch) { |
34 return ch >= 'a' && ch <= 'z'; | 34 return ch >= 'a' && ch <= 'z'; |
35 } | 35 } |
36 inline FX_BOOL FXSYS_isupper(int32_t ch) { | 36 inline bool FXSYS_isupper(int32_t ch) { |
37 return ch >= 'A' && ch <= 'Z'; | 37 return ch >= 'A' && ch <= 'Z'; |
38 } | 38 } |
39 inline int32_t FXSYS_tolower(int32_t ch) { | 39 inline int32_t FXSYS_tolower(int32_t ch) { |
40 return ch < 'A' || ch > 'Z' ? ch : (ch + 0x20); | 40 return ch < 'A' || ch > 'Z' ? ch : (ch + 0x20); |
41 } | 41 } |
42 inline int32_t FXSYS_toupper(int32_t ch) { | 42 inline int32_t FXSYS_toupper(int32_t ch) { |
43 return ch < 'a' || ch > 'z' ? ch : (ch - 0x20); | 43 return ch < 'a' || ch > 'z' ? ch : (ch - 0x20); |
44 } | 44 } |
45 inline FX_BOOL FXSYS_iswalpha(wchar_t wch) { | 45 inline bool FXSYS_iswalpha(wchar_t wch) { |
46 return (wch >= L'A' && wch <= L'Z') || (wch >= L'a' && wch <= L'z'); | 46 return (wch >= L'A' && wch <= L'Z') || (wch >= L'a' && wch <= L'z'); |
47 } | 47 } |
48 inline FX_BOOL FXSYS_iswdigit(wchar_t wch) { | 48 inline bool FXSYS_iswdigit(wchar_t wch) { |
49 return wch >= L'0' && wch <= L'9'; | 49 return wch >= L'0' && wch <= L'9'; |
50 } | 50 } |
51 inline FX_BOOL FXSYS_iswalnum(wchar_t wch) { | 51 inline bool FXSYS_iswalnum(wchar_t wch) { |
52 return FXSYS_iswalpha(wch) || FXSYS_iswdigit(wch); | 52 return FXSYS_iswalpha(wch) || FXSYS_iswdigit(wch); |
53 } | 53 } |
54 | 54 |
55 inline int FXSYS_toHexDigit(const FX_CHAR c) { | 55 inline int FXSYS_toHexDigit(const FX_CHAR c) { |
56 if (!std::isxdigit(c)) | 56 if (!std::isxdigit(c)) |
57 return 0; | 57 return 0; |
58 char upchar = std::toupper(c); | 58 char upchar = std::toupper(c); |
59 return upchar > '9' ? upchar - 'A' + 10 : upchar - '0'; | 59 return upchar > '9' ? upchar - 'A' + 10 : upchar - '0'; |
60 } | 60 } |
61 | 61 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 j -= gap; | 125 j -= gap; |
126 } | 126 } |
127 pArray[j + gap] = v1; | 127 pArray[j + gap] = v1; |
128 } | 128 } |
129 gap >>= 1; | 129 gap >>= 1; |
130 } | 130 } |
131 } | 131 } |
132 }; | 132 }; |
133 | 133 |
134 #endif // CORE_INCLUDE_FXCRT_FX_EXT_H_ | 134 #endif // CORE_INCLUDE_FXCRT_FX_EXT_H_ |
OLD | NEW |