Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(308)

Side by Side Diff: core/fxcrt/include/fx_ext.h

Issue 2094453004: Use some FXSYS methods instead of duplicating (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Review cleanup Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/fxcrt/fx_basic_util.cpp ('k') | xfa/fgas/localization/fgas_locale.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_FXCRT_INCLUDE_FX_EXT_H_ 7 #ifndef CORE_FXCRT_INCLUDE_FX_EXT_H_
8 #define CORE_FXCRT_INCLUDE_FX_EXT_H_ 8 #define CORE_FXCRT_INCLUDE_FX_EXT_H_
9 9
10 #include <cctype> 10 #include <cctype>
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 } 46 }
47 inline bool FXSYS_iswalpha(wchar_t wch) { 47 inline bool FXSYS_iswalpha(wchar_t wch) {
48 return (wch >= L'A' && wch <= L'Z') || (wch >= L'a' && wch <= L'z'); 48 return (wch >= L'A' && wch <= L'Z') || (wch >= L'a' && wch <= L'z');
49 } 49 }
50 inline bool FXSYS_iswdigit(wchar_t wch) { 50 inline bool FXSYS_iswdigit(wchar_t wch) {
51 return wch >= L'0' && wch <= L'9'; 51 return wch >= L'0' && wch <= L'9';
52 } 52 }
53 inline bool FXSYS_iswalnum(wchar_t wch) { 53 inline bool FXSYS_iswalnum(wchar_t wch) {
54 return FXSYS_iswalpha(wch) || FXSYS_iswdigit(wch); 54 return FXSYS_iswalpha(wch) || FXSYS_iswdigit(wch);
55 } 55 }
56 inline bool FXSYS_iswspace(FX_WCHAR c) {
57 return (c == 0x20) || (c == 0x0d) || (c == 0x0a) || (c == 0x09);
58 }
56 59
57 inline int FXSYS_toHexDigit(const FX_CHAR c) { 60 inline int FXSYS_toHexDigit(const FX_CHAR c) {
58 if (!std::isxdigit(c)) 61 if (!std::isxdigit(c))
59 return 0; 62 return 0;
60 char upchar = std::toupper(c); 63 char upchar = std::toupper(c);
61 return upchar > '9' ? upchar - 'A' + 10 : upchar - '0'; 64 return upchar > '9' ? upchar - 'A' + 10 : upchar - '0';
62 } 65 }
63 66
64 inline bool FXSYS_isDecimalDigit(const FX_CHAR c) { 67 inline bool FXSYS_isDecimalDigit(const FX_CHAR c) {
65 return !!std::isdigit(c); 68 return !!std::isdigit(c);
66 } 69 }
67 70
68 inline bool FXSYS_isDecimalDigit(const FX_WCHAR c) { 71 inline bool FXSYS_isDecimalDigit(const FX_WCHAR c) {
69 return !!std::iswdigit(c); 72 return !!std::iswdigit(c);
70 } 73 }
71 74
72 inline int FXSYS_toDecimalDigit(const FX_CHAR c) { 75 inline int FXSYS_toDecimalDigit(const FX_CHAR c) {
73 return std::isdigit(c) ? c - '0' : 0; 76 return std::isdigit(c) ? c - '0' : 0;
74 } 77 }
75 78
76 inline int FXSYS_toDecimalDigit(const FX_WCHAR c) { 79 inline int FXSYS_toDecimalDigit(const FX_WCHAR c) {
77 return std::iswdigit(c) ? c - L'0' : 0; 80 return std::iswdigit(c) ? c - L'0' : 0;
78 } 81 }
79 82
83 FX_FLOAT FXSYS_FractionalScale(size_t scale_factor, int value);
84 int FXSYS_FractionalScaleCount();
85
80 uint32_t FX_HashCode_GetA(const CFX_ByteStringC& str, bool bIgnoreCase); 86 uint32_t FX_HashCode_GetA(const CFX_ByteStringC& str, bool bIgnoreCase);
81 uint32_t FX_HashCode_GetW(const CFX_WideStringC& Str, bool bIgnoreCase); 87 uint32_t FX_HashCode_GetW(const CFX_WideStringC& Str, bool bIgnoreCase);
82 88
83 void* FX_Random_MT_Start(uint32_t dwSeed); 89 void* FX_Random_MT_Start(uint32_t dwSeed);
84 90
85 uint32_t FX_Random_MT_Generate(void* pContext); 91 uint32_t FX_Random_MT_Generate(void* pContext);
86 92
87 void FX_Random_MT_Close(void* pContext); 93 void FX_Random_MT_Close(void* pContext);
88 94
89 void FX_Random_GenerateBase(uint32_t* pBuffer, int32_t iCount); 95 void FX_Random_GenerateBase(uint32_t* pBuffer, int32_t iCount);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 j -= gap; 129 j -= gap;
124 } 130 }
125 pArray[j + gap] = v1; 131 pArray[j + gap] = v1;
126 } 132 }
127 gap >>= 1; 133 gap >>= 1;
128 } 134 }
129 } 135 }
130 }; 136 };
131 137
132 #endif // CORE_FXCRT_INCLUDE_FX_EXT_H_ 138 #endif // CORE_FXCRT_INCLUDE_FX_EXT_H_
OLDNEW
« no previous file with comments | « core/fxcrt/fx_basic_util.cpp ('k') | xfa/fgas/localization/fgas_locale.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698