Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2913)

Unified Diff: core/fxcrt/fx_basic.h

Issue 2558373002: Remove last usage of CFX_ObjectArray. (Closed)
Patch Set: disallow copy and assign Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfapi/parser/cpdf_stream_acc.h ('k') | xfa/fxfa/app/xfa_ffapp.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fxcrt/fx_basic.h
diff --git a/core/fxcrt/fx_basic.h b/core/fxcrt/fx_basic.h
index 2b8f6b6afef39bc76636e34cdd44c450aa24cc16..30673f6525e086956f54175234da875d1ae35e9c 100644
--- a/core/fxcrt/fx_basic.h
+++ b/core/fxcrt/fx_basic.h
@@ -321,108 +321,6 @@ typedef CFX_ArrayTemplate<CFX_WideStringC> CFX_WideStringCArray;
typedef CFX_ArrayTemplate<FX_FLOAT> CFX_FloatArray;
typedef CFX_ArrayTemplate<uint8_t> CFX_ByteArray;
typedef CFX_ArrayTemplate<int32_t> CFX_Int32Array;
-
-template <class ObjectClass>
-class CFX_ObjectArray : public CFX_BasicArray {
- public:
- CFX_ObjectArray() : CFX_BasicArray(sizeof(ObjectClass)) {}
-
- ~CFX_ObjectArray() { RemoveAll(); }
-
- void Add(const ObjectClass& data) {
- new ((void*)InsertSpaceAt(m_nSize, 1)) ObjectClass(data);
- }
-
- ObjectClass& Add() {
- return *(ObjectClass*)new ((void*)InsertSpaceAt(m_nSize, 1)) ObjectClass();
- }
-
- void* AddSpace() { return InsertSpaceAt(m_nSize, 1); }
-
- int32_t Append(const CFX_ObjectArray& src,
- int32_t nStart = 0,
- int32_t nCount = -1) {
- if (nCount == 0) {
- return 0;
- }
- int32_t nSize = src.GetSize();
- if (!nSize) {
- return 0;
- }
- ASSERT(nStart > -1 && nStart < nSize);
- if (nCount < 0) {
- nCount = nSize;
- }
- if (nStart + nCount > nSize) {
- nCount = nSize - nStart;
- }
- if (nCount < 1) {
- return 0;
- }
- nSize = m_nSize;
- InsertSpaceAt(m_nSize, nCount);
- ObjectClass* pStartObj = (ObjectClass*)GetDataPtr(nSize);
- nSize = nStart + nCount;
- for (int32_t i = nStart; i < nSize; i++, pStartObj++) {
- new ((void*)pStartObj) ObjectClass(src[i]);
- }
- return nCount;
- }
-
- int32_t Copy(const CFX_ObjectArray& src,
- int32_t nStart = 0,
- int32_t nCount = -1) {
- if (nCount == 0) {
- return 0;
- }
- int32_t nSize = src.GetSize();
- if (!nSize) {
- return 0;
- }
- ASSERT(nStart > -1 && nStart < nSize);
- if (nCount < 0) {
- nCount = nSize;
- }
- if (nStart + nCount > nSize) {
- nCount = nSize - nStart;
- }
- if (nCount < 1) {
- return 0;
- }
- RemoveAll();
- SetSize(nCount);
- ObjectClass* pStartObj = (ObjectClass*)m_pData;
- nSize = nStart + nCount;
- for (int32_t i = nStart; i < nSize; i++, pStartObj++) {
- new ((void*)pStartObj) ObjectClass(src[i]);
- }
- return nCount;
- }
-
- int GetSize() const { return m_nSize; }
-
- ObjectClass& operator[](int index) const {
- ASSERT(index < m_nSize);
- return *(ObjectClass*)CFX_BasicArray::GetDataPtr(index);
- }
-
- ObjectClass* GetDataPtr(int index) {
- return (ObjectClass*)CFX_BasicArray::GetDataPtr(index);
- }
-
- void RemoveAt(int index) {
- ASSERT(index < m_nSize);
- ((ObjectClass*)GetDataPtr(index))->~ObjectClass();
- CFX_BasicArray::RemoveAt(index, 1);
- }
-
- void RemoveAll() {
- for (int i = 0; i < m_nSize; i++) {
- ((ObjectClass*)GetDataPtr(i))->~ObjectClass();
- }
- CFX_BasicArray::SetSize(0);
- }
-};
#endif // PDF_ENABLE_XFA
template <class DataType, int FixedSize>
« no previous file with comments | « core/fpdfapi/parser/cpdf_stream_acc.h ('k') | xfa/fxfa/app/xfa_ffapp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698