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 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 | 653 |
654 void EstimateSize(FX_DWORD size, FX_DWORD grow_by); | 654 void EstimateSize(FX_DWORD size, FX_DWORD grow_by); |
655 | 655 |
656 FX_POSITION GetStartPosition() const; | 656 FX_POSITION GetStartPosition() const; |
657 | 657 |
658 void GetNextAssoc(FX_POSITION& pos, FX_DWORD& key, FX_DWORD& value) const; | 658 void GetNextAssoc(FX_POSITION& pos, FX_DWORD& key, FX_DWORD& value) const; |
659 | 659 |
660 protected: | 660 protected: |
661 CFX_BinaryBuf m_Buffer; | 661 CFX_BinaryBuf m_Buffer; |
662 }; | 662 }; |
663 class CFX_MapByteStringToPtr { | |
664 protected: | |
665 struct CAssoc { | |
666 CAssoc* pNext; | |
667 | |
668 FX_DWORD nHashValue; | |
669 | |
670 CFX_ByteString key; | |
671 | |
672 void* value; | |
673 }; | |
674 | |
675 public: | |
676 CFX_MapByteStringToPtr(int nBlockSize = 10); | |
677 | |
678 int GetCount() const { return m_nCount; } | |
679 | |
680 FX_BOOL IsEmpty() const { return m_nCount == 0; } | |
681 | |
682 FX_BOOL Lookup(const CFX_ByteStringC& key, void*& rValue) const; | |
683 | |
684 void*& operator[](const CFX_ByteStringC& key); | |
685 | |
686 void SetAt(const CFX_ByteStringC& key, void* newValue) { | |
687 (*this)[key] = newValue; | |
688 } | |
689 | |
690 FX_BOOL RemoveKey(const CFX_ByteStringC& key); | |
691 | |
692 void RemoveAll(); | |
693 | |
694 FX_POSITION GetStartPosition() const { | |
695 return (m_nCount == 0) ? NULL : (FX_POSITION)-1; | |
696 } | |
697 | |
698 void GetNextAssoc(FX_POSITION& rNextPosition, | |
699 CFX_ByteString& rKey, | |
700 void*& rValue) const; | |
701 | |
702 void* GetNextValue(FX_POSITION& rNextPosition) const; | |
703 | |
704 FX_DWORD GetHashTableSize() const { return m_nHashTableSize; } | |
705 | |
706 void InitHashTable(FX_DWORD hashSize, FX_BOOL bAllocNow = TRUE); | |
707 | |
708 FX_DWORD HashKey(const CFX_ByteStringC& key) const; | |
709 | |
710 protected: | |
711 CAssoc** m_pHashTable; | |
712 | |
713 FX_DWORD m_nHashTableSize; | |
714 | |
715 int m_nCount; | |
716 | |
717 CAssoc* m_pFreeList; | |
718 | |
719 struct CFX_Plex* m_pBlocks; | |
720 | |
721 int m_nBlockSize; | |
722 | |
723 CAssoc* NewAssoc(); | |
724 | |
725 void FreeAssoc(CAssoc* pAssoc); | |
726 | |
727 CAssoc* GetAssocAt(const CFX_ByteStringC& key, FX_DWORD& hash) const; | |
728 | |
729 public: | |
730 ~CFX_MapByteStringToPtr(); | |
731 }; | |
732 class CFX_CMapByteStringToPtr { | 663 class CFX_CMapByteStringToPtr { |
733 public: | 664 public: |
734 CFX_CMapByteStringToPtr(); | 665 CFX_CMapByteStringToPtr(); |
735 | 666 |
736 ~CFX_CMapByteStringToPtr(); | 667 ~CFX_CMapByteStringToPtr(); |
737 | 668 |
738 void RemoveAll(); | 669 void RemoveAll(); |
739 | 670 |
740 FX_POSITION GetStartPosition() const; | 671 FX_POSITION GetStartPosition() const; |
741 | 672 |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1233 FX_FLOAT c; | 1164 FX_FLOAT c; |
1234 FX_FLOAT d; | 1165 FX_FLOAT d; |
1235 FX_FLOAT e; | 1166 FX_FLOAT e; |
1236 FX_FLOAT f; | 1167 FX_FLOAT f; |
1237 FX_FLOAT g; | 1168 FX_FLOAT g; |
1238 FX_FLOAT h; | 1169 FX_FLOAT h; |
1239 FX_FLOAT i; | 1170 FX_FLOAT i; |
1240 }; | 1171 }; |
1241 | 1172 |
1242 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_ | 1173 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_ |
OLD | NEW |