diff options
author | Tom Sepez <tsepez@chromium.org> | 2017-03-28 11:33:37 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-03-28 19:55:43 +0000 |
commit | 022ded02d2c23a8d043bbcb3d3f37dab12636759 (patch) | |
tree | d3f88dfcc6a130f405dfeb5fc249cfa46eaa8108 /core/fxcrt/fx_basic.h | |
parent | fa171d263d0b7ec409f4af333d65b0f8c0d0dc47 (diff) | |
download | pdfium-022ded02d2c23a8d043bbcb3d3f37dab12636759.tar.xz |
Remove unused CFX_ArrayTemplate and CFX_BasicArray.
Change-Id: I10040b6504cf237f2e3e1f6075ae6a0612570461
Reviewed-on: https://pdfium-review.googlesource.com/3249
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxcrt/fx_basic.h')
-rw-r--r-- | core/fxcrt/fx_basic.h | 141 |
1 files changed, 0 insertions, 141 deletions
diff --git a/core/fxcrt/fx_basic.h b/core/fxcrt/fx_basic.h index 076766a0a2..77df71e125 100644 --- a/core/fxcrt/fx_basic.h +++ b/core/fxcrt/fx_basic.h @@ -176,147 +176,6 @@ class CFX_UTF8Encoder { CFX_ByteTextBuf m_Buffer; }; -class CFX_BasicArray { - protected: - explicit CFX_BasicArray(int unit_size); - CFX_BasicArray(const CFX_BasicArray&) = delete; - ~CFX_BasicArray(); - - bool SetSize(int nNewSize); - bool Append(const CFX_BasicArray& src); - bool Copy(const CFX_BasicArray& src); - uint8_t* InsertSpaceAt(int nIndex, int nCount); - bool RemoveAt(int nIndex, int nCount); - bool InsertAt(int nStartIndex, const CFX_BasicArray* pNewArray); - const void* GetDataPtr(int index) const; - - protected: - uint8_t* m_pData; - int m_nSize; - int m_nMaxSize; - int m_nUnitSize; -}; - -template <class TYPE> -class CFX_ArrayTemplate : public CFX_BasicArray { - public: - CFX_ArrayTemplate() : CFX_BasicArray(sizeof(TYPE)) {} - - int GetSize() const { return m_nSize; } - - int GetUpperBound() const { return m_nSize - 1; } - - bool SetSize(int nNewSize) { return CFX_BasicArray::SetSize(nNewSize); } - - void RemoveAll() { SetSize(0); } - - const TYPE GetAt(int nIndex) const { - if (nIndex < 0 || nIndex >= m_nSize) { - PDFIUM_IMMEDIATE_CRASH(); - } - return ((const TYPE*)m_pData)[nIndex]; - } - - bool SetAt(int nIndex, TYPE newElement) { - if (nIndex < 0 || nIndex >= m_nSize) { - return false; - } - ((TYPE*)m_pData)[nIndex] = newElement; - return true; - } - - TYPE& ElementAt(int nIndex) { - if (nIndex < 0 || nIndex >= m_nSize) { - PDFIUM_IMMEDIATE_CRASH(); - } - return ((TYPE*)m_pData)[nIndex]; - } - - const TYPE* GetData() const { return (const TYPE*)m_pData; } - - TYPE* GetData() { return (TYPE*)m_pData; } - - bool SetAtGrow(int nIndex, TYPE newElement) { - if (nIndex < 0) - return false; - - if (nIndex >= m_nSize && !SetSize(nIndex + 1)) - return false; - - ((TYPE*)m_pData)[nIndex] = newElement; - return true; - } - - bool Add(TYPE newElement) { - if (m_nSize < m_nMaxSize) { - m_nSize++; - } else if (!SetSize(m_nSize + 1)) { - return false; - } - ((TYPE*)m_pData)[m_nSize - 1] = newElement; - return true; - } - - bool Append(const CFX_ArrayTemplate& src) { - return CFX_BasicArray::Append(src); - } - - bool Copy(const CFX_ArrayTemplate& src) { return CFX_BasicArray::Copy(src); } - - TYPE* GetDataPtr(int index) { - return (TYPE*)CFX_BasicArray::GetDataPtr(index); - } - - TYPE* AddSpace() { return (TYPE*)CFX_BasicArray::InsertSpaceAt(m_nSize, 1); } - - TYPE* InsertSpaceAt(int nIndex, int nCount) { - return (TYPE*)CFX_BasicArray::InsertSpaceAt(nIndex, nCount); - } - - const TYPE operator[](int nIndex) const { - if (nIndex < 0 || nIndex >= m_nSize) { - *(volatile char*)0 = '\0'; - } - return ((const TYPE*)m_pData)[nIndex]; - } - - TYPE& operator[](int nIndex) { - if (nIndex < 0 || nIndex >= m_nSize) { - *(volatile char*)0 = '\0'; - } - return ((TYPE*)m_pData)[nIndex]; - } - - bool InsertAt(int nIndex, TYPE newElement, int nCount = 1) { - if (!InsertSpaceAt(nIndex, nCount)) { - return false; - } - while (nCount--) { - ((TYPE*)m_pData)[nIndex++] = newElement; - } - return true; - } - - bool RemoveAt(int nIndex, int nCount = 1) { - return CFX_BasicArray::RemoveAt(nIndex, nCount); - } - - bool InsertAt(int nStartIndex, const CFX_BasicArray* pNewArray) { - return CFX_BasicArray::InsertAt(nStartIndex, pNewArray); - } - - int Find(TYPE data, int iStart = 0) const { - if (iStart < 0) { - return -1; - } - for (; iStart < (int)m_nSize; iStart++) - if (((TYPE*)m_pData)[iStart] == data) { - return iStart; - } - return -1; - } -}; - template <class DataType, int FixedSize> class CFX_FixedBufGrow { public: |