1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
7 #ifndef CORE_INCLUDE_FXCRT_FX_EXT_H_
8 #define CORE_INCLUDE_FXCRT_FX_EXT_H_
12 #include "fx_coordinates.h"
20 FX_FLOAT FXSYS_tan(FX_FLOAT a);
21 FX_FLOAT FXSYS_logb(FX_FLOAT b, FX_FLOAT x);
22 FX_FLOAT FXSYS_strtof(const FX_CHAR* pcsStr, int32_t iLength = -1, int32_t *pUsedLen = NULL);
23 FX_FLOAT FXSYS_wcstof(const FX_WCHAR* pwsStr, int32_t iLength = -1, int32_t *pUsedLen = NULL);
24 FX_WCHAR* FXSYS_wcsncpy(FX_WCHAR* dstStr, const FX_WCHAR* srcStr, size_t count);
25 int32_t FXSYS_wcsnicmp(const FX_WCHAR* s1, const FX_WCHAR* s2, size_t count);
26 int32_t FXSYS_strnicmp(const FX_CHAR* s1, const FX_CHAR* s2, size_t count);
28 inline FX_BOOL FXSYS_islower(int32_t ch)
30 return ch >= 'a' && ch <= 'z';
32 inline FX_BOOL FXSYS_isupper(int32_t ch)
34 return ch >= 'A' && ch <= 'Z';
36 inline int32_t FXSYS_tolower(int32_t ch)
38 return ch < 'A' || ch > 'Z' ? ch : (ch + 0x20);
40 inline int32_t FXSYS_toupper(int32_t ch)
42 return ch < 'a' || ch > 'z' ? ch : (ch - 0x20);
45 FX_DWORD FX_HashCode_String_GetA(const FX_CHAR* pStr, int32_t iLength, FX_BOOL bIgnoreCase = FALSE);
46 FX_DWORD FX_HashCode_String_GetW(const FX_WCHAR* pStr, int32_t iLength, FX_BOOL bIgnoreCase = FALSE);
55 void* FX_Random_MT_Start(FX_DWORD dwSeed);
57 FX_DWORD FX_Random_MT_Generate(void* pContext);
59 void FX_Random_MT_Close(void* pContext);
61 void FX_Random_GenerateBase(FX_DWORD* pBuffer, int32_t iCount);
63 void FX_Random_GenerateMT(FX_DWORD* pBuffer, int32_t iCount);
65 void FX_Random_GenerateCrypto(FX_DWORD* pBuffer, int32_t iCount);
69 template<class baseType>
70 class CFX_SSortTemplate
73 void ShellSort(baseType *pArray, int32_t iCount)
75 FXSYS_assert(pArray != NULL && iCount > 0);
80 for (i = gap; i < iCount; i ++) {
83 while (j > -1 && (v2 = pArray[j]) > v1) {
94 #endif // CORE_INCLUDE_FXCRT_FX_EXT_H_