| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #ifndef XFA_FGAS_CRT_FGAS_UTILS_H_ | 7 #ifndef XFA_FGAS_CRT_FGAS_UTILS_H_ |
| 8 #define XFA_FGAS_CRT_FGAS_UTILS_H_ | 8 #define XFA_FGAS_CRT_FGAS_UTILS_H_ |
| 9 | 9 |
| 10 #include "core/fxcrt/include/fx_coordinates.h" | 10 #include "core/fxcrt/include/fx_coordinates.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 return CFX_BaseArray::Copy(src, iStart, iCount); | 77 return CFX_BaseArray::Copy(src, iStart, iCount); |
| 78 } | 78 } |
| 79 int32_t RemoveLast(int32_t iCount = -1) { | 79 int32_t RemoveLast(int32_t iCount = -1) { |
| 80 return CFX_BaseArray::RemoveLast(iCount); | 80 return CFX_BaseArray::RemoveLast(iCount); |
| 81 } | 81 } |
| 82 void RemoveAll(FX_BOOL bLeaveMemory = FALSE) { | 82 void RemoveAll(FX_BOOL bLeaveMemory = FALSE) { |
| 83 CFX_BaseArray::RemoveAll(bLeaveMemory); | 83 CFX_BaseArray::RemoveAll(bLeaveMemory); |
| 84 } | 84 } |
| 85 }; | 85 }; |
| 86 typedef CFX_BaseArrayTemplate<void*> CFDE_PtrArray; | 86 typedef CFX_BaseArrayTemplate<void*> CFDE_PtrArray; |
| 87 typedef CFX_BaseArrayTemplate<FX_DWORD> CFDE_DWordArray; | 87 typedef CFX_BaseArrayTemplate<uint32_t> CFDE_DWordArray; |
| 88 typedef CFX_BaseArrayTemplate<uint16_t> CFDE_WordArray; | 88 typedef CFX_BaseArrayTemplate<uint16_t> CFDE_WordArray; |
| 89 | 89 |
| 90 template <class baseType> | 90 template <class baseType> |
| 91 class CFX_ObjectBaseArrayTemplate : public CFX_BaseArray { | 91 class CFX_ObjectBaseArrayTemplate : public CFX_BaseArray { |
| 92 public: | 92 public: |
| 93 CFX_ObjectBaseArrayTemplate(int32_t iGrowSize = 100) | 93 CFX_ObjectBaseArrayTemplate(int32_t iGrowSize = 100) |
| 94 : CFX_BaseArray(iGrowSize, sizeof(baseType)) {} | 94 : CFX_BaseArray(iGrowSize, sizeof(baseType)) {} |
| 95 ~CFX_ObjectBaseArrayTemplate() { RemoveAll(FALSE); } | 95 ~CFX_ObjectBaseArrayTemplate() { RemoveAll(FALSE); } |
| 96 int32_t GetSize() const { return CFX_BaseArray::GetSize(); } | 96 int32_t GetSize() const { return CFX_BaseArray::GetSize(); } |
| 97 int32_t GetBlockSize() const { return CFX_BaseArray::GetBlockSize(); } | 97 int32_t GetBlockSize() const { return CFX_BaseArray::GetBlockSize(); } |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 } | 274 } |
| 275 int32_t RemoveLast(int32_t iCount = -1) { | 275 int32_t RemoveLast(int32_t iCount = -1) { |
| 276 return CFX_BaseMassArray::RemoveLast(iCount); | 276 return CFX_BaseMassArray::RemoveLast(iCount); |
| 277 } | 277 } |
| 278 void RemoveAll(FX_BOOL bLeaveMemory = FALSE) { | 278 void RemoveAll(FX_BOOL bLeaveMemory = FALSE) { |
| 279 CFX_BaseMassArray::RemoveAll(bLeaveMemory); | 279 CFX_BaseMassArray::RemoveAll(bLeaveMemory); |
| 280 } | 280 } |
| 281 }; | 281 }; |
| 282 typedef CFX_MassArrayTemplate<void*> CFX_PtrMassArray; | 282 typedef CFX_MassArrayTemplate<void*> CFX_PtrMassArray; |
| 283 typedef CFX_MassArrayTemplate<int32_t> CFX_Int32MassArray; | 283 typedef CFX_MassArrayTemplate<int32_t> CFX_Int32MassArray; |
| 284 typedef CFX_MassArrayTemplate<FX_DWORD> CFX_DWordMassArray; | 284 typedef CFX_MassArrayTemplate<uint32_t> CFX_DWordMassArray; |
| 285 typedef CFX_MassArrayTemplate<uint16_t> CFX_WordMassArray; | 285 typedef CFX_MassArrayTemplate<uint16_t> CFX_WordMassArray; |
| 286 typedef CFX_MassArrayTemplate<CFX_Rect> CFX_RectMassArray; | 286 typedef CFX_MassArrayTemplate<CFX_Rect> CFX_RectMassArray; |
| 287 typedef CFX_MassArrayTemplate<CFX_RectF> CFX_RectFMassArray; | 287 typedef CFX_MassArrayTemplate<CFX_RectF> CFX_RectFMassArray; |
| 288 | 288 |
| 289 template <class baseType> | 289 template <class baseType> |
| 290 class CFX_ObjectMassArrayTemplate : public CFX_BaseMassArray { | 290 class CFX_ObjectMassArrayTemplate : public CFX_BaseMassArray { |
| 291 public: | 291 public: |
| 292 CFX_ObjectMassArrayTemplate(int32_t iChunkSize = 100) | 292 CFX_ObjectMassArrayTemplate(int32_t iChunkSize = 100) |
| 293 : CFX_BaseMassArray(iChunkSize, sizeof(baseType)) {} | 293 : CFX_BaseMassArray(iChunkSize, sizeof(baseType)) {} |
| 294 ~CFX_ObjectMassArrayTemplate() { RemoveAll(FALSE); } | 294 ~CFX_ObjectMassArrayTemplate() { RemoveAll(FALSE); } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 } | 389 } |
| 390 baseType* GetPtrAt(int32_t index) const { | 390 baseType* GetPtrAt(int32_t index) const { |
| 391 return (baseType*)CFX_BaseDiscreteArray::GetAt(index); | 391 return (baseType*)CFX_BaseDiscreteArray::GetAt(index); |
| 392 } | 392 } |
| 393 void SetAtGrow(int32_t index, const baseType& element) { | 393 void SetAtGrow(int32_t index, const baseType& element) { |
| 394 *(baseType*)CFX_BaseDiscreteArray::AddSpaceTo(index) = element; | 394 *(baseType*)CFX_BaseDiscreteArray::AddSpaceTo(index) = element; |
| 395 } | 395 } |
| 396 void RemoveAll() { CFX_BaseDiscreteArray::RemoveAll(); } | 396 void RemoveAll() { CFX_BaseDiscreteArray::RemoveAll(); } |
| 397 }; | 397 }; |
| 398 typedef CFX_DiscreteArrayTemplate<void*> CFX_PtrDiscreteArray; | 398 typedef CFX_DiscreteArrayTemplate<void*> CFX_PtrDiscreteArray; |
| 399 typedef CFX_DiscreteArrayTemplate<FX_DWORD> CFX_DWordDiscreteArray; | 399 typedef CFX_DiscreteArrayTemplate<uint32_t> CFX_DWordDiscreteArray; |
| 400 typedef CFX_DiscreteArrayTemplate<uint16_t> CFX_WordDiscreteArray; | 400 typedef CFX_DiscreteArrayTemplate<uint16_t> CFX_WordDiscreteArray; |
| 401 | 401 |
| 402 class CFX_BaseStack : public CFX_Target { | 402 class CFX_BaseStack : public CFX_Target { |
| 403 protected: | 403 protected: |
| 404 CFX_BaseStack(int32_t iChunkSize, int32_t iBlockSize); | 404 CFX_BaseStack(int32_t iChunkSize, int32_t iBlockSize); |
| 405 ~CFX_BaseStack(); | 405 ~CFX_BaseStack(); |
| 406 uint8_t* Push(); | 406 uint8_t* Push(); |
| 407 void Pop(); | 407 void Pop(); |
| 408 uint8_t* GetTopElement() const; | 408 uint8_t* GetTopElement() const; |
| 409 int32_t GetSize() const; | 409 int32_t GetSize() const; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 428 } | 428 } |
| 429 int32_t GetSize() const { return CFX_BaseStack::GetSize(); } | 429 int32_t GetSize() const { return CFX_BaseStack::GetSize(); } |
| 430 baseType* GetAt(int32_t index) const { | 430 baseType* GetAt(int32_t index) const { |
| 431 return (baseType*)CFX_BaseStack::GetAt(index); | 431 return (baseType*)CFX_BaseStack::GetAt(index); |
| 432 } | 432 } |
| 433 void RemoveAll(FX_BOOL bLeaveMemory = FALSE) { | 433 void RemoveAll(FX_BOOL bLeaveMemory = FALSE) { |
| 434 CFX_BaseStack::RemoveAll(bLeaveMemory); | 434 CFX_BaseStack::RemoveAll(bLeaveMemory); |
| 435 } | 435 } |
| 436 }; | 436 }; |
| 437 typedef CFX_StackTemplate<void*> CFX_PtrStack; | 437 typedef CFX_StackTemplate<void*> CFX_PtrStack; |
| 438 typedef CFX_StackTemplate<FX_DWORD> CFX_DWordStack; | 438 typedef CFX_StackTemplate<uint32_t> CFX_DWordStack; |
| 439 typedef CFX_StackTemplate<uint16_t> CFX_WordStack; | 439 typedef CFX_StackTemplate<uint16_t> CFX_WordStack; |
| 440 typedef CFX_StackTemplate<int32_t> CFX_Int32Stack; | 440 typedef CFX_StackTemplate<int32_t> CFX_Int32Stack; |
| 441 | 441 |
| 442 template <class baseType> | 442 template <class baseType> |
| 443 class CFX_ObjectStackTemplate : public CFX_BaseStack { | 443 class CFX_ObjectStackTemplate : public CFX_BaseStack { |
| 444 public: | 444 public: |
| 445 CFX_ObjectStackTemplate(int32_t iChunkSize = 100) | 445 CFX_ObjectStackTemplate(int32_t iChunkSize = 100) |
| 446 : CFX_BaseStack(iChunkSize, sizeof(baseType)) {} | 446 : CFX_BaseStack(iChunkSize, sizeof(baseType)) {} |
| 447 ~CFX_ObjectStackTemplate() { RemoveAll(); } | 447 ~CFX_ObjectStackTemplate() { RemoveAll(); } |
| 448 int32_t Push(const baseType& element) { | 448 int32_t Push(const baseType& element) { |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 pLast->SetNextNode(pChild); | 728 pLast->SetNextNode(pChild); |
| 729 } | 729 } |
| 730 return pChild; | 730 return pChild; |
| 731 } | 731 } |
| 732 | 732 |
| 733 protected: | 733 protected: |
| 734 CPLTreeNode m_Root; | 734 CPLTreeNode m_Root; |
| 735 }; | 735 }; |
| 736 | 736 |
| 737 #endif // XFA_FGAS_CRT_FGAS_UTILS_H_ | 737 #endif // XFA_FGAS_CRT_FGAS_UTILS_H_ |
| OLD | NEW |