| 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_BASIC_H_ | 7 #ifndef CORE_INCLUDE_FXCRT_FX_BASIC_H_ |
| 8 #define CORE_INCLUDE_FXCRT_FX_BASIC_H_ | 8 #define CORE_INCLUDE_FXCRT_FX_BASIC_H_ |
| 9 | 9 |
| 10 #include "fx_memory.h" | 10 #include "fx_memory.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 123 |
| 124 FX_WCHAR* GetBuffer() const { return (FX_WCHAR*)m_pBuffer; } | 124 FX_WCHAR* GetBuffer() const { return (FX_WCHAR*)m_pBuffer; } |
| 125 | 125 |
| 126 void Delete(int start_index, int count) { | 126 void Delete(int start_index, int count) { |
| 127 CFX_BinaryBuf::Delete(start_index * sizeof(FX_WCHAR), | 127 CFX_BinaryBuf::Delete(start_index * sizeof(FX_WCHAR), |
| 128 count * sizeof(FX_WCHAR)); | 128 count * sizeof(FX_WCHAR)); |
| 129 } | 129 } |
| 130 | 130 |
| 131 CFX_WideStringC GetWideString() const; | 131 CFX_WideStringC GetWideString() const; |
| 132 }; | 132 }; |
| 133 #ifdef PDF_ENABLE_XFA |
| 133 class CFX_ArchiveSaver { | 134 class CFX_ArchiveSaver { |
| 134 public: | 135 public: |
| 135 CFX_ArchiveSaver() : m_pStream(NULL) {} | 136 CFX_ArchiveSaver() : m_pStream(NULL) {} |
| 136 | 137 |
| 137 CFX_ArchiveSaver& operator<<(uint8_t i); | 138 CFX_ArchiveSaver& operator<<(uint8_t i); |
| 138 | 139 |
| 139 CFX_ArchiveSaver& operator<<(int i); | 140 CFX_ArchiveSaver& operator<<(int i); |
| 140 | 141 |
| 141 CFX_ArchiveSaver& operator<<(FX_DWORD i); | 142 CFX_ArchiveSaver& operator<<(FX_DWORD i); |
| 142 | 143 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 | 186 |
| 186 FX_BOOL Read(void* pBuf, FX_DWORD dwSize); | 187 FX_BOOL Read(void* pBuf, FX_DWORD dwSize); |
| 187 | 188 |
| 188 protected: | 189 protected: |
| 189 FX_DWORD m_LoadingPos; | 190 FX_DWORD m_LoadingPos; |
| 190 | 191 |
| 191 const uint8_t* m_pLoadingBuf; | 192 const uint8_t* m_pLoadingBuf; |
| 192 | 193 |
| 193 FX_DWORD m_LoadingSize; | 194 FX_DWORD m_LoadingSize; |
| 194 }; | 195 }; |
| 196 #endif |
| 195 | 197 |
| 196 class IFX_BufferArchive { | 198 class IFX_BufferArchive { |
| 197 public: | 199 public: |
| 198 IFX_BufferArchive(FX_STRSIZE size); | 200 IFX_BufferArchive(FX_STRSIZE size); |
| 199 virtual ~IFX_BufferArchive() {} | 201 virtual ~IFX_BufferArchive() {} |
| 200 | 202 |
| 201 virtual void Clear(); | 203 virtual void Clear(); |
| 202 | 204 |
| 203 FX_BOOL Flush(); | 205 FX_BOOL Flush(); |
| 204 | 206 |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 return iStart; | 431 return iStart; |
| 430 } | 432 } |
| 431 return -1; | 433 return -1; |
| 432 } | 434 } |
| 433 }; | 435 }; |
| 434 typedef CFX_ArrayTemplate<uint8_t> CFX_ByteArray; | 436 typedef CFX_ArrayTemplate<uint8_t> CFX_ByteArray; |
| 435 typedef CFX_ArrayTemplate<FX_WORD> CFX_WordArray; | 437 typedef CFX_ArrayTemplate<FX_WORD> CFX_WordArray; |
| 436 typedef CFX_ArrayTemplate<FX_DWORD> CFX_DWordArray; | 438 typedef CFX_ArrayTemplate<FX_DWORD> CFX_DWordArray; |
| 437 typedef CFX_ArrayTemplate<void*> CFX_PtrArray; | 439 typedef CFX_ArrayTemplate<void*> CFX_PtrArray; |
| 438 typedef CFX_ArrayTemplate<FX_FILESIZE> CFX_FileSizeArray; | 440 typedef CFX_ArrayTemplate<FX_FILESIZE> CFX_FileSizeArray; |
| 441 #ifdef PDF_ENABLE_XFA |
| 439 typedef CFX_ArrayTemplate<FX_FLOAT> CFX_FloatArray; | 442 typedef CFX_ArrayTemplate<FX_FLOAT> CFX_FloatArray; |
| 440 typedef CFX_ArrayTemplate<int32_t> CFX_Int32Array; | 443 typedef CFX_ArrayTemplate<int32_t> CFX_Int32Array; |
| 444 #endif |
| 441 | 445 |
| 442 template <class ObjectClass> | 446 template <class ObjectClass> |
| 443 class CFX_ObjectArray : public CFX_BasicArray { | 447 class CFX_ObjectArray : public CFX_BasicArray { |
| 444 public: | 448 public: |
| 445 CFX_ObjectArray() : CFX_BasicArray(sizeof(ObjectClass)) {} | 449 CFX_ObjectArray() : CFX_BasicArray(sizeof(ObjectClass)) {} |
| 446 | 450 |
| 447 ~CFX_ObjectArray() { RemoveAll(); } | 451 ~CFX_ObjectArray() { RemoveAll(); } |
| 448 | 452 |
| 449 void Add(const ObjectClass& data) { | 453 void Add(const ObjectClass& data) { |
| 450 new ((void*)InsertSpaceAt(m_nSize, 1)) ObjectClass(data); | 454 new ((void*)InsertSpaceAt(m_nSize, 1)) ObjectClass(data); |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 int m_nBlockSize; | 695 int m_nBlockSize; |
| 692 | 696 |
| 693 FX_DWORD HashKey(void* key) const; | 697 FX_DWORD HashKey(void* key) const; |
| 694 | 698 |
| 695 CAssoc* NewAssoc(); | 699 CAssoc* NewAssoc(); |
| 696 | 700 |
| 697 void FreeAssoc(CAssoc* pAssoc); | 701 void FreeAssoc(CAssoc* pAssoc); |
| 698 | 702 |
| 699 CAssoc* GetAssocAt(void* key, FX_DWORD& hash) const; | 703 CAssoc* GetAssocAt(void* key, FX_DWORD& hash) const; |
| 700 }; | 704 }; |
| 705 #ifdef PDF_ENABLE_XFA |
| 701 template <class KeyType, class ValueType> | 706 template <class KeyType, class ValueType> |
| 702 class CFX_MapPtrTemplate : public CFX_MapPtrToPtr { | 707 class CFX_MapPtrTemplate : public CFX_MapPtrToPtr { |
| 703 public: | 708 public: |
| 704 CFX_MapPtrTemplate() : CFX_MapPtrToPtr(10) {} | 709 CFX_MapPtrTemplate() : CFX_MapPtrToPtr(10) {} |
| 705 | 710 |
| 706 FX_BOOL Lookup(KeyType key, ValueType& rValue) const { | 711 FX_BOOL Lookup(KeyType key, ValueType& rValue) const { |
| 707 void* pValue = NULL; | 712 void* pValue = NULL; |
| 708 if (!CFX_MapPtrToPtr::Lookup((void*)(uintptr_t)key, pValue)) { | 713 if (!CFX_MapPtrToPtr::Lookup((void*)(uintptr_t)key, pValue)) { |
| 709 return FALSE; | 714 return FALSE; |
| 710 } | 715 } |
| 711 rValue = (ValueType)(uintptr_t)pValue; | 716 rValue = (ValueType)(uintptr_t)pValue; |
| 712 return TRUE; | 717 return TRUE; |
| 713 } | 718 } |
| 714 | 719 |
| 715 ValueType& operator[](KeyType key) { | 720 ValueType& operator[](KeyType key) { |
| 716 return (ValueType&)CFX_MapPtrToPtr::operator[]((void*)(uintptr_t)key); | 721 return (ValueType&)CFX_MapPtrToPtr::operator[]((void*)(uintptr_t)key); |
| 717 } | 722 } |
| 718 | 723 |
| 719 void SetAt(KeyType key, ValueType newValue) { | 724 void SetAt(KeyType key, ValueType newValue) { |
| 720 CFX_MapPtrToPtr::SetAt((void*)(uintptr_t)key, (void*)(uintptr_t)newValue); | 725 CFX_MapPtrToPtr::SetAt((void*)(uintptr_t)key, (void*)(uintptr_t)newValue); |
| 721 } | 726 } |
| 722 | 727 |
| 723 FX_BOOL RemoveKey(KeyType key) { | 728 FX_BOOL RemoveKey(KeyType key) { |
| 724 return CFX_MapPtrToPtr::RemoveKey((void*)(uintptr_t)key); | 729 return CFX_MapPtrToPtr::RemoveKey((void*)(uintptr_t)key); |
| 725 } | 730 } |
| 731 #endif |
| 726 | 732 |
| 733 #ifdef PDF_ENABLE_XFA |
| 727 void GetNextAssoc(FX_POSITION& rNextPosition, | 734 void GetNextAssoc(FX_POSITION& rNextPosition, |
| 728 KeyType& rKey, | 735 KeyType& rKey, |
| 729 ValueType& rValue) const { | 736 ValueType& rValue) const { |
| 730 void* pKey = NULL; | 737 void* pKey = NULL; |
| 731 void* pValue = NULL; | 738 void* pValue = NULL; |
| 732 CFX_MapPtrToPtr::GetNextAssoc(rNextPosition, pKey, pValue); | 739 CFX_MapPtrToPtr::GetNextAssoc(rNextPosition, pKey, pValue); |
| 733 rKey = (KeyType)(uintptr_t)pKey; | 740 rKey = (KeyType)(uintptr_t)pKey; |
| 734 rValue = (ValueType)(uintptr_t)pValue; | 741 rValue = (ValueType)(uintptr_t)pValue; |
| 735 } | 742 } |
| 736 }; | 743 }; |
| 744 #endif |
| 737 class CFX_CMapByteStringToPtr { | 745 class CFX_CMapByteStringToPtr { |
| 738 public: | 746 public: |
| 739 CFX_CMapByteStringToPtr(); | 747 CFX_CMapByteStringToPtr(); |
| 740 | 748 |
| 741 ~CFX_CMapByteStringToPtr(); | 749 ~CFX_CMapByteStringToPtr(); |
| 742 | 750 |
| 743 void RemoveAll(); | 751 void RemoveAll(); |
| 744 | 752 |
| 745 FX_POSITION GetStartPosition() const; | 753 FX_POSITION GetStartPosition() const; |
| 746 | 754 |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1180 typedef enum { | 1188 typedef enum { |
| 1181 Ready, | 1189 Ready, |
| 1182 ToBeContinued, | 1190 ToBeContinued, |
| 1183 Found, | 1191 Found, |
| 1184 NotFound, | 1192 NotFound, |
| 1185 Failed, | 1193 Failed, |
| 1186 Done | 1194 Done |
| 1187 } FX_ProgressiveStatus; | 1195 } FX_ProgressiveStatus; |
| 1188 #define ProgressiveStatus FX_ProgressiveStatus | 1196 #define ProgressiveStatus FX_ProgressiveStatus |
| 1189 #define FX_NAMESPACE_DECLARE(namespace, type) namespace ::type | 1197 #define FX_NAMESPACE_DECLARE(namespace, type) namespace ::type |
| 1198 #ifdef PDF_ENABLE_XFA |
| 1190 class IFX_Unknown { | 1199 class IFX_Unknown { |
| 1191 public: | 1200 public: |
| 1192 virtual ~IFX_Unknown() {} | 1201 virtual ~IFX_Unknown() {} |
| 1193 virtual FX_DWORD Release() = 0; | 1202 virtual FX_DWORD Release() = 0; |
| 1194 virtual FX_DWORD AddRef() = 0; | 1203 virtual FX_DWORD AddRef() = 0; |
| 1195 }; | 1204 }; |
| 1196 #define FX_IsOdd(a) ((a)&1) | 1205 #define FX_IsOdd(a) ((a)&1) |
| 1206 #endif |
| 1197 | 1207 |
| 1198 class CFX_Vector_3by1 { | 1208 class CFX_Vector_3by1 { |
| 1199 public: | 1209 public: |
| 1200 CFX_Vector_3by1() : a(0.0f), b(0.0f), c(0.0f) {} | 1210 CFX_Vector_3by1() : a(0.0f), b(0.0f), c(0.0f) {} |
| 1201 | 1211 |
| 1202 CFX_Vector_3by1(FX_FLOAT a1, FX_FLOAT b1, FX_FLOAT c1) | 1212 CFX_Vector_3by1(FX_FLOAT a1, FX_FLOAT b1, FX_FLOAT c1) |
| 1203 : a(a1), b(b1), c(c1) {} | 1213 : a(a1), b(b1), c(c1) {} |
| 1204 | 1214 |
| 1205 FX_FLOAT a; | 1215 FX_FLOAT a; |
| 1206 FX_FLOAT b; | 1216 FX_FLOAT b; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1241 FX_FLOAT c; | 1251 FX_FLOAT c; |
| 1242 FX_FLOAT d; | 1252 FX_FLOAT d; |
| 1243 FX_FLOAT e; | 1253 FX_FLOAT e; |
| 1244 FX_FLOAT f; | 1254 FX_FLOAT f; |
| 1245 FX_FLOAT g; | 1255 FX_FLOAT g; |
| 1246 FX_FLOAT h; | 1256 FX_FLOAT h; |
| 1247 FX_FLOAT i; | 1257 FX_FLOAT i; |
| 1248 }; | 1258 }; |
| 1249 | 1259 |
| 1250 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_ | 1260 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_ |
| OLD | NEW |