diff options
Diffstat (limited to 'xfa/fgas/crt/fgas_utils.h')
-rw-r--r-- | xfa/fgas/crt/fgas_utils.h | 146 |
1 files changed, 0 insertions, 146 deletions
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); |