| 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 <algorithm> | 10 #include <algorithm> |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 FXSYS_memset(m_Data, 0, sizeof(DataType) * FixedSize); | 565 FXSYS_memset(m_Data, 0, sizeof(DataType) * FixedSize); |
| 566 } | 566 } |
| 567 } | 567 } |
| 568 ~CFX_FixedBufGrow() { FX_Free(m_pData); } | 568 ~CFX_FixedBufGrow() { FX_Free(m_pData); } |
| 569 operator DataType*() { return m_pData ? m_pData : m_Data; } | 569 operator DataType*() { return m_pData ? m_pData : m_Data; } |
| 570 | 570 |
| 571 private: | 571 private: |
| 572 DataType m_Data[FixedSize]; | 572 DataType m_Data[FixedSize]; |
| 573 DataType* m_pData; | 573 DataType* m_pData; |
| 574 }; | 574 }; |
| 575 class CFX_MapPtrToPtr { | |
| 576 protected: | |
| 577 struct CAssoc { | |
| 578 CAssoc* pNext; | |
| 579 | |
| 580 void* key; | |
| 581 | |
| 582 void* value; | |
| 583 }; | |
| 584 | |
| 585 public: | |
| 586 CFX_MapPtrToPtr(int nBlockSize = 10); | |
| 587 | |
| 588 ~CFX_MapPtrToPtr(); | |
| 589 | |
| 590 int GetCount() const { return m_nCount; } | |
| 591 | |
| 592 FX_BOOL IsEmpty() const { return m_nCount == 0; } | |
| 593 | |
| 594 FX_BOOL Lookup(void* key, void*& rValue) const; | |
| 595 | |
| 596 void* GetValueAt(void* key) const; | |
| 597 | |
| 598 void*& operator[](void* key); | |
| 599 | |
| 600 void SetAt(void* key, void* newValue) { (*this)[key] = newValue; } | |
| 601 | |
| 602 FX_BOOL RemoveKey(void* key); | |
| 603 | |
| 604 void RemoveAll(); | |
| 605 | |
| 606 FX_POSITION GetStartPosition() const { | |
| 607 return (m_nCount == 0) ? NULL : (FX_POSITION)-1; | |
| 608 } | |
| 609 | |
| 610 void GetNextAssoc(FX_POSITION& rNextPosition, | |
| 611 void*& rKey, | |
| 612 void*& rValue) const; | |
| 613 | |
| 614 FX_DWORD GetHashTableSize() const { return m_nHashTableSize; } | |
| 615 | |
| 616 void InitHashTable(FX_DWORD hashSize, FX_BOOL bAllocNow = TRUE); | |
| 617 | |
| 618 protected: | |
| 619 CAssoc** m_pHashTable; | |
| 620 | |
| 621 FX_DWORD m_nHashTableSize; | |
| 622 | |
| 623 int m_nCount; | |
| 624 | |
| 625 CAssoc* m_pFreeList; | |
| 626 | |
| 627 struct CFX_Plex* m_pBlocks; | |
| 628 | |
| 629 int m_nBlockSize; | |
| 630 | |
| 631 FX_DWORD HashKey(void* key) const; | |
| 632 | |
| 633 CAssoc* NewAssoc(); | |
| 634 | |
| 635 void FreeAssoc(CAssoc* pAssoc); | |
| 636 | |
| 637 CAssoc* GetAssocAt(void* key, FX_DWORD& hash) const; | |
| 638 }; | |
| 639 | 575 |
| 640 class CFX_PtrList { | 576 class CFX_PtrList { |
| 641 protected: | 577 protected: |
| 642 struct CNode { | 578 struct CNode { |
| 643 CNode* pNext; | 579 CNode* pNext; |
| 644 | 580 |
| 645 CNode* pPrev; | 581 CNode* pPrev; |
| 646 | 582 |
| 647 void* data; | 583 void* data; |
| 648 }; | 584 }; |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1112 FX_FLOAT c; | 1048 FX_FLOAT c; |
| 1113 FX_FLOAT d; | 1049 FX_FLOAT d; |
| 1114 FX_FLOAT e; | 1050 FX_FLOAT e; |
| 1115 FX_FLOAT f; | 1051 FX_FLOAT f; |
| 1116 FX_FLOAT g; | 1052 FX_FLOAT g; |
| 1117 FX_FLOAT h; | 1053 FX_FLOAT h; |
| 1118 FX_FLOAT i; | 1054 FX_FLOAT i; |
| 1119 }; | 1055 }; |
| 1120 | 1056 |
| 1121 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_ | 1057 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_ |
| OLD | NEW |