From 591ed144f8dfe4b2915f01f1cc725f584d498a3f Mon Sep 17 00:00:00 2001 From: tsepez Date: Fri, 6 Jan 2017 10:29:49 -0800 Subject: Remove CFX_MapPtrToPtr and templates. All usage is now replaced with stl equivalents. Move one definition from fx_basic.h to where it's actually needed. Review-Url: https://codereview.chromium.org/2612773007 --- core/fxcrt/fx_basic.h | 102 -------------------------------------------------- 1 file changed, 102 deletions(-) (limited to 'core/fxcrt/fx_basic.h') diff --git a/core/fxcrt/fx_basic.h b/core/fxcrt/fx_basic.h index 3b09489d71..5adcf701c5 100644 --- a/core/fxcrt/fx_basic.h +++ b/core/fxcrt/fx_basic.h @@ -335,108 +335,6 @@ class CFX_FixedBufGrow { std::unique_ptr m_pGrowData; }; -#ifdef PDF_ENABLE_XFA -class CFX_MapPtrToPtr { - protected: - struct CAssoc { - CAssoc* pNext; - void* key; - void* value; - }; - - public: - explicit CFX_MapPtrToPtr(int nBlockSize = 10); - ~CFX_MapPtrToPtr(); - - int GetCount() const { return m_nCount; } - bool IsEmpty() const { return m_nCount == 0; } - - bool Lookup(void* key, void*& rValue) const; - - void* GetValueAt(void* key) const; - - void*& operator[](void* key); - - void SetAt(void* key, void* newValue) { (*this)[key] = newValue; } - - bool RemoveKey(void* key); - - void RemoveAll(); - - FX_POSITION GetStartPosition() const { - return m_nCount == 0 ? nullptr : (FX_POSITION)-1; - } - - void GetNextAssoc(FX_POSITION& rNextPosition, - void*& rKey, - void*& rValue) const; - - uint32_t GetHashTableSize() const { return m_nHashTableSize; } - - void InitHashTable(uint32_t hashSize, bool bAllocNow = true); - - protected: - CAssoc** m_pHashTable; - - uint32_t m_nHashTableSize; - - int m_nCount; - - CAssoc* m_pFreeList; - - struct CFX_Plex* m_pBlocks; - - int m_nBlockSize; - - uint32_t HashKey(void* key) const; - - CAssoc* NewAssoc(); - - void FreeAssoc(CAssoc* pAssoc); - - CAssoc* GetAssocAt(void* key, uint32_t& hash) const; -}; - -template -class CFX_MapPtrTemplate : public CFX_MapPtrToPtr { - public: - CFX_MapPtrTemplate() : CFX_MapPtrToPtr(10) {} - - bool Lookup(KeyType key, ValueType& rValue) const { - void* pValue = nullptr; - if (!CFX_MapPtrToPtr::Lookup((void*)(uintptr_t)key, pValue)) { - return false; - } - rValue = (ValueType)(uintptr_t)pValue; - return true; - } - - ValueType& operator[](KeyType key) { - return (ValueType&)CFX_MapPtrToPtr::operator[]((void*)(uintptr_t)key); - } - - void SetAt(KeyType key, ValueType newValue) { - CFX_MapPtrToPtr::SetAt((void*)(uintptr_t)key, (void*)(uintptr_t)newValue); - } - - bool RemoveKey(KeyType key) { - return CFX_MapPtrToPtr::RemoveKey((void*)(uintptr_t)key); - } - - void GetNextAssoc(FX_POSITION& rNextPosition, - KeyType& rKey, - ValueType& rValue) const { - void* pKey = nullptr; - void* pValue = nullptr; - CFX_MapPtrToPtr::GetNextAssoc(rNextPosition, pKey, pValue); - rKey = (KeyType)(uintptr_t)pKey; - rValue = (ValueType)(uintptr_t)pValue; - } -}; - -typedef void (*PD_CALLBACK_FREEDATA)(void* pData); -#endif // PDF_ENABLE_XFA - class CFX_BitStream { public: void Init(const uint8_t* pData, uint32_t dwSize); -- cgit v1.2.3