summaryrefslogtreecommitdiff
path: root/core/fxcrt/fx_basic.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcrt/fx_basic.h')
-rw-r--r--core/fxcrt/fx_basic.h141
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: