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 _FXCRT_EXTENSION_
8 #define _FXCRT_EXTENSION_
12 #ifndef _FXCRT_COORDINATES_
13 #include "fx_coordinates.h"
29 FX_FLOAT FXSYS_tan(FX_FLOAT a);
30 FX_FLOAT FXSYS_logb(FX_FLOAT b, FX_FLOAT x);
31 FX_FLOAT FXSYS_strtof(FX_LPCSTR pcsStr, FX_INT32 iLength = -1, FX_INT32 *pUsedLen = NULL);
32 FX_FLOAT FXSYS_wcstof(FX_LPCWSTR pwsStr, FX_INT32 iLength = -1, FX_INT32 *pUsedLen = NULL);
33 FX_LPWSTR FXSYS_wcsncpy(FX_LPWSTR dstStr, FX_LPCWSTR srcStr, size_t count);
34 FX_INT32 FXSYS_wcsnicmp(FX_LPCWSTR s1, FX_LPCWSTR s2, size_t count);
35 FX_INT32 FXSYS_strnicmp(FX_LPCSTR s1, FX_LPCSTR s2, size_t count);
36 inline FX_BOOL FXSYS_islower(FX_INT32 ch)
38 return ch >= 'a' && ch <= 'z';
40 inline FX_BOOL FXSYS_isupper(FX_INT32 ch)
42 return ch >= 'A' && ch <= 'Z';
44 inline FX_INT32 FXSYS_tolower(FX_INT32 ch)
46 return ch < 'A' || ch > 'Z' ? ch : (ch + 0x20);
48 inline FX_INT32 FXSYS_toupper(FX_INT32 ch)
50 return ch < 'a' || ch > 'z' ? ch : (ch - 0x20);
55 FX_DWORD FX_HashCode_String_GetA(FX_LPCSTR pStr, FX_INT32 iLength, FX_BOOL bIgnoreCase = FALSE);
56 FX_DWORD FX_HashCode_String_GetW(FX_LPCWSTR pStr, FX_INT32 iLength, FX_BOOL bIgnoreCase = FALSE);
65 FX_LPVOID FX_Random_MT_Start(FX_DWORD dwSeed);
67 FX_DWORD FX_Random_MT_Generate(FX_LPVOID pContext);
69 void FX_Random_MT_Close(FX_LPVOID pContext);
71 void FX_Random_GenerateBase(FX_LPDWORD pBuffer, FX_INT32 iCount);
73 void FX_Random_GenerateMT(FX_LPDWORD pBuffer, FX_INT32 iCount);
75 void FX_Random_GenerateCrypto(FX_LPDWORD pBuffer, FX_INT32 iCount);
83 typedef struct FX_GUID {
88 } FX_GUID, * FX_LPGUID;
89 typedef FX_GUID const * FX_LPCGUID;
91 void FX_GUID_CreateV4(FX_LPGUID pGUID);
93 void FX_GUID_ToString(FX_LPCGUID pGUID, CFX_ByteString &bsStr, FX_BOOL bSeparator = TRUE);
97 template<class baseType>
98 class CFX_SSortTemplate
101 void ShellSort(baseType *pArray, FX_INT32 iCount)
103 FXSYS_assert(pArray != NULL && iCount > 0);
108 for (i = gap; i < iCount; i ++) {
111 while (j > -1 && (v2 = pArray[j]) > v1) {
112 pArray[j + gap] = v2;
115 pArray[j + gap] = v1;