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 CORE_INCLUDE_FXCRT_FX_BASIC_H_ | 7 #ifndef CORE_INCLUDE_FXCRT_FX_BASIC_H_ |
8 #define CORE_INCLUDE_FXCRT_FX_BASIC_H_ | 8 #define CORE_INCLUDE_FXCRT_FX_BASIC_H_ |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 | 541 |
542 void RemoveAll() { | 542 void RemoveAll() { |
543 for (int i = 0; i < m_nSize; i++) { | 543 for (int i = 0; i < m_nSize; i++) { |
544 ((ObjectClass*)GetDataPtr(i))->~ObjectClass(); | 544 ((ObjectClass*)GetDataPtr(i))->~ObjectClass(); |
545 } | 545 } |
546 CFX_BasicArray::SetSize(0); | 546 CFX_BasicArray::SetSize(0); |
547 } | 547 } |
548 }; | 548 }; |
549 typedef CFX_ObjectArray<CFX_ByteString> CFX_ByteStringArray; | 549 typedef CFX_ObjectArray<CFX_ByteString> CFX_ByteStringArray; |
550 typedef CFX_ObjectArray<CFX_WideString> CFX_WideStringArray; | 550 typedef CFX_ObjectArray<CFX_WideString> CFX_WideStringArray; |
| 551 #ifdef PDF_ENABLE_XFA |
551 class CFX_BaseSegmentedArray { | 552 class CFX_BaseSegmentedArray { |
552 public: | 553 public: |
553 CFX_BaseSegmentedArray(int unit_size = 1, | 554 CFX_BaseSegmentedArray(int unit_size = 1, |
554 int segment_units = 512, | 555 int segment_units = 512, |
555 int index_size = 8); | 556 int index_size = 8); |
556 | 557 |
557 ~CFX_BaseSegmentedArray(); | 558 ~CFX_BaseSegmentedArray(); |
558 | 559 |
559 void SetUnitSize(int unit_size, int segment_units, int index_size = 8); | 560 void SetUnitSize(int unit_size, int segment_units, int index_size = 8); |
560 | 561 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 } | 607 } |
607 | 608 |
608 void Add(ElementType data) { | 609 void Add(ElementType data) { |
609 *(ElementType*)CFX_BaseSegmentedArray::Add() = data; | 610 *(ElementType*)CFX_BaseSegmentedArray::Add() = data; |
610 } | 611 } |
611 | 612 |
612 ElementType& operator[](int index) { | 613 ElementType& operator[](int index) { |
613 return *(ElementType*)CFX_BaseSegmentedArray::GetAt(index); | 614 return *(ElementType*)CFX_BaseSegmentedArray::GetAt(index); |
614 } | 615 } |
615 }; | 616 }; |
| 617 #endif // PDF_ENABLE_XFA |
616 template <class DataType, int FixedSize> | 618 template <class DataType, int FixedSize> |
617 class CFX_FixedBufGrow { | 619 class CFX_FixedBufGrow { |
618 public: | 620 public: |
619 CFX_FixedBufGrow() : m_pData(NULL) {} | 621 CFX_FixedBufGrow() : m_pData(NULL) {} |
620 CFX_FixedBufGrow(int data_size) : m_pData(NULL) { | 622 CFX_FixedBufGrow(int data_size) : m_pData(NULL) { |
621 if (data_size > FixedSize) { | 623 if (data_size > FixedSize) { |
622 m_pData = FX_Alloc(DataType, data_size); | 624 m_pData = FX_Alloc(DataType, data_size); |
623 } else { | 625 } else { |
624 FXSYS_memset(m_Data, 0, sizeof(DataType) * FixedSize); | 626 FXSYS_memset(m_Data, 0, sizeof(DataType) * FixedSize); |
625 } | 627 } |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1218 FX_FLOAT c; | 1220 FX_FLOAT c; |
1219 FX_FLOAT d; | 1221 FX_FLOAT d; |
1220 FX_FLOAT e; | 1222 FX_FLOAT e; |
1221 FX_FLOAT f; | 1223 FX_FLOAT f; |
1222 FX_FLOAT g; | 1224 FX_FLOAT g; |
1223 FX_FLOAT h; | 1225 FX_FLOAT h; |
1224 FX_FLOAT i; | 1226 FX_FLOAT i; |
1225 }; | 1227 }; |
1226 | 1228 |
1227 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_ | 1229 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_ |
OLD | NEW |