diff options
-rw-r--r-- | xfa/fgas/crt/fgas_utils.cpp | 31 | ||||
-rw-r--r-- | xfa/fgas/crt/fgas_utils.h | 146 |
2 files changed, 0 insertions, 177 deletions
diff --git a/xfa/fgas/crt/fgas_utils.cpp b/xfa/fgas/crt/fgas_utils.cpp index 1e86c6c16a..c09198f6e0 100644 --- a/xfa/fgas/crt/fgas_utils.cpp +++ b/xfa/fgas/crt/fgas_utils.cpp @@ -301,37 +301,6 @@ void CFX_BaseMassArrayImp::RemoveAll(bool bLeaveMemory) { m_iChunkCount = 0; m_iBlockCount = 0; } -CFX_BaseMassArray::CFX_BaseMassArray(int32_t iChunkSize, int32_t iBlockSize) { - m_pData = new CFX_BaseMassArrayImp(iChunkSize, iBlockSize); -} -CFX_BaseMassArray::~CFX_BaseMassArray() { - delete m_pData; -} -int32_t CFX_BaseMassArray::GetSize() const { - return m_pData->m_iBlockCount; -} -uint8_t* CFX_BaseMassArray::AddSpaceTo(int32_t index) { - return m_pData->AddSpaceTo(index); -} -uint8_t* CFX_BaseMassArray::GetAt(int32_t index) const { - return m_pData->GetAt(index); -} -int32_t CFX_BaseMassArray::Append(const CFX_BaseMassArray& src, - int32_t iStart, - int32_t iCount) { - return m_pData->Append(*(CFX_BaseMassArrayImp*)src.m_pData, iStart, iCount); -} -int32_t CFX_BaseMassArray::Copy(const CFX_BaseMassArray& src, - int32_t iStart, - int32_t iCount) { - return m_pData->Copy(*(CFX_BaseMassArrayImp*)src.m_pData, iStart, iCount); -} -int32_t CFX_BaseMassArray::RemoveLast(int32_t iCount) { - return m_pData->RemoveLast(iCount); -} -void CFX_BaseMassArray::RemoveAll(bool bLeaveMemory) { - m_pData->RemoveAll(bLeaveMemory); -} struct FX_BASEDISCRETEARRAYDATA { int32_t iBlockSize; diff --git a/xfa/fgas/crt/fgas_utils.h b/xfa/fgas/crt/fgas_utils.h index 465601149b..18bc6fcd6e 100644 --- a/xfa/fgas/crt/fgas_utils.h +++ b/xfa/fgas/crt/fgas_utils.h @@ -104,152 +104,6 @@ class CFX_BaseMassArrayImp { int32_t iSrcCount); }; -class CFX_BaseMassArray { - protected: - CFX_BaseMassArray(int32_t iChunkSize, int32_t iBlockSize); - ~CFX_BaseMassArray(); - - int32_t GetSize() const; - uint8_t* AddSpaceTo(int32_t index); - uint8_t* GetAt(int32_t index) const; - int32_t Append(const CFX_BaseMassArray& src, int32_t iStart, int32_t iCount); - int32_t Copy(const CFX_BaseMassArray& src, int32_t iStart, int32_t iCount); - int32_t RemoveLast(int32_t iCount); - void RemoveAll(bool bLeaveMemory); - CFX_BaseMassArrayImp* m_pData; -}; - -template <class baseType> -class CFX_MassArrayTemplate : public CFX_BaseMassArray { - public: - explicit CFX_MassArrayTemplate(int32_t iChunkSize) - : CFX_BaseMassArray(iChunkSize, sizeof(baseType)) {} - CFX_MassArrayTemplate(int32_t iChunkSize, int32_t iBlockSize) - : CFX_BaseMassArray(iChunkSize, iBlockSize) {} - - int32_t GetSize() const { return CFX_BaseMassArray::GetSize(); } - baseType* AddSpace() { - return (baseType*)CFX_BaseMassArray::AddSpaceTo( - CFX_BaseMassArray::GetSize()); - } - int32_t Add(const baseType& element) { - int32_t index = CFX_BaseMassArray::GetSize(); - *(baseType*)CFX_BaseMassArray::AddSpaceTo(index) = element; - return index; - } - baseType& GetAt(int32_t index) const { - return *(baseType*)CFX_BaseMassArray::GetAt(index); - } - baseType* GetPtrAt(int32_t index) const { - return (baseType*)CFX_BaseMassArray::GetAt(index); - } - void SetAt(int32_t index, const baseType& element) { - *(baseType*)CFX_BaseMassArray::GetAt(index) = element; - } - void SetAtGrow(int32_t index, const baseType& element) { - *(baseType*)CFX_BaseMassArray::AddSpaceTo(index) = element; - } - int32_t Append(const CFX_MassArrayTemplate& src, - int32_t iStart, - int32_t iCount) { - return CFX_BaseMassArray::Append(src, iStart, iCount); - } - int32_t Copy(const CFX_MassArrayTemplate& src, - int32_t iStart, - int32_t iCount) { - return CFX_BaseMassArray::Copy(src, iStart, iCount); - } - int32_t RemoveLast(int32_t iCount) { - return CFX_BaseMassArray::RemoveLast(iCount); - } - void RemoveAll(bool bLeaveMemory) { - CFX_BaseMassArray::RemoveAll(bLeaveMemory); - } -}; - -template <class baseType> -class CFX_ObjectMassArrayTemplate : public CFX_BaseMassArray { - public: - explicit CFX_ObjectMassArrayTemplate(int32_t iChunkSize) - : CFX_BaseMassArray(iChunkSize, sizeof(baseType)) {} - ~CFX_ObjectMassArrayTemplate() { RemoveAll(false); } - - int32_t GetSize() const { return CFX_BaseMassArray::GetSize(); } - int32_t Add(const baseType& element) { - int32_t index = CFX_BaseMassArray::GetSize(); - baseType* p = (baseType*)CFX_BaseMassArray::AddSpaceTo(index); - new ((void*)p) baseType(element); - return index; - } - baseType& GetAt(int32_t index) const { - return *(baseType*)CFX_BaseMassArray::GetAt(index); - } - baseType* GetPtrAt(int32_t index) const { - return (baseType*)CFX_BaseMassArray::GetAt(index); - } - int32_t Append(const CFX_ObjectMassArrayTemplate& src, - int32_t iStart, - int32_t iCount) { - if (iCount == 0) { - return CFX_BaseMassArray::GetSize(); - } - int32_t iSize = src.GetSize(); - ASSERT(iStart > -1 && iStart < iSize); - if (iCount < 0) { - iCount = iSize; - } - int32_t iEnd = iStart + iCount; - if (iEnd > iSize) { - iEnd = iSize; - } - for (int32_t i = iStart; i < iEnd; i++) { - Add(src.GetAt(i)); - } - return CFX_BaseMassArray::GetSize(); - } - int32_t Copy(const CFX_ObjectMassArrayTemplate& src, - int32_t iStart, - int32_t iCount) { - if (iCount == 0) { - return CFX_BaseMassArray::GetSize(); - } - int32_t iSize = src.GetSize(); - ASSERT(iStart > -1 && iStart < iSize); - if (iCount < 0) { - iCount = iSize; - } - int32_t iEnd = iStart + iCount; - if (iEnd > iSize) { - iEnd = iSize; - } - RemoveAll(true); - for (int32_t i = iStart; i < iEnd; i++) { - Add(src.GetAt(i)); - } - return CFX_BaseMassArray::GetSize(); - } - int32_t RemoveLast(int32_t iCount) { - int32_t iSize = CFX_BaseMassArray::GetSize(); - if (iCount < 0 || iCount > iSize) { - iCount = iSize; - } - if (iCount == 0) { - return iSize; - } - for (int32_t i = iSize - iCount; i < iSize; i++) { - ((baseType*)GetPtrAt(i))->~baseType(); - } - return CFX_BaseMassArray::RemoveLast(iCount); - } - void RemoveAll(bool bLeaveMemory) { - int32_t iSize = CFX_BaseMassArray::GetSize(); - for (int32_t i = 0; i < iSize; i++) { - ((baseType*)GetPtrAt(i))->~baseType(); - } - CFX_BaseMassArray::RemoveAll(bLeaveMemory); - } -}; - class CFX_BaseDiscreteArray { protected: CFX_BaseDiscreteArray(int32_t iChunkSize, int32_t iBlockSize); |