| 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_FXCRT_INCLUDE_FX_BASIC_H_ | 7 #ifndef CORE_FXCRT_INCLUDE_FX_BASIC_H_ |
| 8 #define CORE_FXCRT_INCLUDE_FX_BASIC_H_ | 8 #define CORE_FXCRT_INCLUDE_FX_BASIC_H_ |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 } | 317 } |
| 318 return -1; | 318 return -1; |
| 319 } | 319 } |
| 320 }; | 320 }; |
| 321 | 321 |
| 322 #ifdef PDF_ENABLE_XFA | 322 #ifdef PDF_ENABLE_XFA |
| 323 typedef CFX_ArrayTemplate<CFX_WideStringC> CFX_WideStringCArray; | 323 typedef CFX_ArrayTemplate<CFX_WideStringC> CFX_WideStringCArray; |
| 324 typedef CFX_ArrayTemplate<FX_FLOAT> CFX_FloatArray; | 324 typedef CFX_ArrayTemplate<FX_FLOAT> CFX_FloatArray; |
| 325 typedef CFX_ArrayTemplate<uint8_t> CFX_ByteArray; | 325 typedef CFX_ArrayTemplate<uint8_t> CFX_ByteArray; |
| 326 typedef CFX_ArrayTemplate<int32_t> CFX_Int32Array; | 326 typedef CFX_ArrayTemplate<int32_t> CFX_Int32Array; |
| 327 #endif // PDF_ENABLE_XFA | |
| 328 | 327 |
| 329 #ifdef PDF_ENABLE_XFA | |
| 330 template <class ObjectClass> | 328 template <class ObjectClass> |
| 331 class CFX_ObjectArray : public CFX_BasicArray { | 329 class CFX_ObjectArray : public CFX_BasicArray { |
| 332 public: | 330 public: |
| 333 CFX_ObjectArray() : CFX_BasicArray(sizeof(ObjectClass)) {} | 331 CFX_ObjectArray() : CFX_BasicArray(sizeof(ObjectClass)) {} |
| 334 | 332 |
| 335 ~CFX_ObjectArray() { RemoveAll(); } | 333 ~CFX_ObjectArray() { RemoveAll(); } |
| 336 | 334 |
| 337 void Add(const ObjectClass& data) { | 335 void Add(const ObjectClass& data) { |
| 338 new ((void*)InsertSpaceAt(m_nSize, 1)) ObjectClass(data); | 336 new ((void*)InsertSpaceAt(m_nSize, 1)) ObjectClass(data); |
| 339 } | 337 } |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 | 612 |
| 615 CNode* NewNode(CNode* pPrev, CNode* pNext); | 613 CNode* NewNode(CNode* pPrev, CNode* pNext); |
| 616 void FreeNode(CNode* pNode); | 614 void FreeNode(CNode* pNode); |
| 617 | 615 |
| 618 public: | 616 public: |
| 619 ~CFX_PtrList(); | 617 ~CFX_PtrList(); |
| 620 }; | 618 }; |
| 621 | 619 |
| 622 #ifdef PDF_ENABLE_XFA | 620 #ifdef PDF_ENABLE_XFA |
| 623 typedef void (*PD_CALLBACK_FREEDATA)(void* pData); | 621 typedef void (*PD_CALLBACK_FREEDATA)(void* pData); |
| 624 struct FX_PRIVATEDATA { | |
| 625 void FreeData(); | |
| 626 | |
| 627 void* m_pModuleId; | |
| 628 void* m_pData; | |
| 629 PD_CALLBACK_FREEDATA m_pCallback; | |
| 630 FX_BOOL m_bSelfDestruct; | |
| 631 }; | |
| 632 | |
| 633 class CFX_PrivateData { | |
| 634 public: | |
| 635 CFX_PrivateData(); | |
| 636 ~CFX_PrivateData(); | |
| 637 | |
| 638 void ClearAll(); | |
| 639 | |
| 640 void SetPrivateData(void* module_id, | |
| 641 void* pData, | |
| 642 PD_CALLBACK_FREEDATA callback); | |
| 643 void SetPrivateObj(void* module_id, CFX_Deletable* pObj); | |
| 644 | |
| 645 void* GetPrivateData(void* module_id); | |
| 646 FX_BOOL LookupPrivateData(void* module_id, void*& pData) const { | |
| 647 if (!module_id) { | |
| 648 return FALSE; | |
| 649 } | |
| 650 uint32_t nCount = m_DataList.GetSize(); | |
| 651 for (uint32_t n = 0; n < nCount; n++) { | |
| 652 if (m_DataList[n].m_pModuleId == module_id) { | |
| 653 pData = m_DataList[n].m_pData; | |
| 654 return TRUE; | |
| 655 } | |
| 656 } | |
| 657 return FALSE; | |
| 658 } | |
| 659 | |
| 660 FX_BOOL RemovePrivateData(void* module_id); | |
| 661 | |
| 662 protected: | |
| 663 CFX_ArrayTemplate<FX_PRIVATEDATA> m_DataList; | |
| 664 | |
| 665 void AddData(void* module_id, | |
| 666 void* pData, | |
| 667 PD_CALLBACK_FREEDATA callback, | |
| 668 FX_BOOL bSelfDestruct); | |
| 669 }; | |
| 670 #endif // PDF_ENABLE_XFA | 622 #endif // PDF_ENABLE_XFA |
| 671 | 623 |
| 672 class CFX_BitStream { | 624 class CFX_BitStream { |
| 673 public: | 625 public: |
| 674 void Init(const uint8_t* pData, uint32_t dwSize); | 626 void Init(const uint8_t* pData, uint32_t dwSize); |
| 675 | 627 |
| 676 uint32_t GetBits(uint32_t nBits); | 628 uint32_t GetBits(uint32_t nBits); |
| 677 | 629 |
| 678 void ByteAlign(); | 630 void ByteAlign(); |
| 679 | 631 |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 FX_FLOAT e; | 924 FX_FLOAT e; |
| 973 FX_FLOAT f; | 925 FX_FLOAT f; |
| 974 FX_FLOAT g; | 926 FX_FLOAT g; |
| 975 FX_FLOAT h; | 927 FX_FLOAT h; |
| 976 FX_FLOAT i; | 928 FX_FLOAT i; |
| 977 }; | 929 }; |
| 978 | 930 |
| 979 uint32_t GetBits32(const uint8_t* pData, int bitpos, int nbits); | 931 uint32_t GetBits32(const uint8_t* pData, int bitpos, int nbits); |
| 980 | 932 |
| 981 #endif // CORE_FXCRT_INCLUDE_FX_BASIC_H_ | 933 #endif // CORE_FXCRT_INCLUDE_FX_BASIC_H_ |
| OLD | NEW |