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> |
11 #include <cwctype> | 11 #include <cwctype> |
12 | 12 |
13 #ifdef PDF_ENABLE_XFA | 13 #include "core/include/fxcrt/fx_basic.h" |
14 #include "fx_string.h" | |
15 #endif | |
16 #include "fx_system.h" | |
17 | 14 |
18 FX_FLOAT FXSYS_tan(FX_FLOAT a); | 15 FX_FLOAT FXSYS_tan(FX_FLOAT a); |
19 FX_FLOAT FXSYS_logb(FX_FLOAT b, FX_FLOAT x); | 16 FX_FLOAT FXSYS_logb(FX_FLOAT b, FX_FLOAT x); |
20 FX_FLOAT FXSYS_strtof(const FX_CHAR* pcsStr, | 17 FX_FLOAT FXSYS_strtof(const FX_CHAR* pcsStr, |
21 int32_t iLength = -1, | 18 int32_t iLength = -1, |
22 int32_t* pUsedLen = NULL); | 19 int32_t* pUsedLen = NULL); |
23 FX_FLOAT FXSYS_wcstof(const FX_WCHAR* pwsStr, | 20 FX_FLOAT FXSYS_wcstof(const FX_WCHAR* pwsStr, |
24 int32_t iLength = -1, | 21 int32_t iLength = -1, |
25 int32_t* pUsedLen = NULL); | 22 int32_t* pUsedLen = NULL); |
26 FX_WCHAR* FXSYS_wcsncpy(FX_WCHAR* dstStr, const FX_WCHAR* srcStr, size_t count); | 23 FX_WCHAR* FXSYS_wcsncpy(FX_WCHAR* dstStr, const FX_WCHAR* srcStr, size_t count); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 void FX_Random_GenerateCrypto(FX_DWORD* pBuffer, int32_t iCount); | 76 void FX_Random_GenerateCrypto(FX_DWORD* pBuffer, int32_t iCount); |
80 | 77 |
81 #ifdef PDF_ENABLE_XFA | 78 #ifdef PDF_ENABLE_XFA |
82 typedef struct FX_GUID { | 79 typedef struct FX_GUID { |
83 FX_DWORD data1; | 80 FX_DWORD data1; |
84 FX_WORD data2; | 81 FX_WORD data2; |
85 FX_WORD data3; | 82 FX_WORD data3; |
86 uint8_t data4[8]; | 83 uint8_t data4[8]; |
87 } FX_GUID, *FX_LPGUID; | 84 } FX_GUID, *FX_LPGUID; |
88 typedef FX_GUID const* FX_LPCGUID; | 85 typedef FX_GUID const* FX_LPCGUID; |
89 | |
90 void FX_GUID_CreateV4(FX_LPGUID pGUID); | 86 void FX_GUID_CreateV4(FX_LPGUID pGUID); |
91 | |
92 void FX_GUID_ToString(FX_LPCGUID pGUID, | 87 void FX_GUID_ToString(FX_LPCGUID pGUID, |
93 CFX_ByteString& bsStr, | 88 CFX_ByteString& bsStr, |
94 FX_BOOL bSeparator = TRUE); | 89 FX_BOOL bSeparator = TRUE); |
| 90 #endif // PDF_ENABLE_XFA |
95 | 91 |
96 #endif | |
97 template <class baseType> | 92 template <class baseType> |
98 class CFX_SSortTemplate { | 93 class CFX_SSortTemplate { |
99 public: | 94 public: |
100 void ShellSort(baseType* pArray, int32_t iCount) { | 95 void ShellSort(baseType* pArray, int32_t iCount) { |
101 FXSYS_assert(pArray != NULL && iCount > 0); | 96 FXSYS_assert(pArray != NULL && iCount > 0); |
102 int32_t i, j, gap; | 97 int32_t i, j, gap; |
103 baseType v1, v2; | 98 baseType v1, v2; |
104 gap = iCount >> 1; | 99 gap = iCount >> 1; |
105 while (gap > 0) { | 100 while (gap > 0) { |
106 for (i = gap; i < iCount; i++) { | 101 for (i = gap; i < iCount; i++) { |
107 j = i - gap; | 102 j = i - gap; |
108 v1 = pArray[i]; | 103 v1 = pArray[i]; |
109 while (j > -1 && (v2 = pArray[j]) > v1) { | 104 while (j > -1 && (v2 = pArray[j]) > v1) { |
110 pArray[j + gap] = v2; | 105 pArray[j + gap] = v2; |
111 j -= gap; | 106 j -= gap; |
112 } | 107 } |
113 pArray[j + gap] = v1; | 108 pArray[j + gap] = v1; |
114 } | 109 } |
115 gap >>= 1; | 110 gap >>= 1; |
116 } | 111 } |
117 } | 112 } |
118 }; | 113 }; |
119 | 114 |
120 #endif // CORE_INCLUDE_FXCRT_FX_EXT_H_ | 115 #endif // CORE_INCLUDE_FXCRT_FX_EXT_H_ |
OLD | NEW |