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_FXCRT_INCLUDE_FX_BASIC_H_ | 7 #ifndef CORE_FXCRT_INCLUDE_FX_BASIC_H_ |
8 #define CORE_FXCRT_INCLUDE_FX_BASIC_H_ | 8 #define CORE_FXCRT_INCLUDE_FX_BASIC_H_ |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 void AppendStr(const CFX_ByteStringC& str) { m_Buffer << str; } | 224 void AppendStr(const CFX_ByteStringC& str) { m_Buffer << str; } |
225 CFX_ByteStringC GetResult() const { return m_Buffer.AsStringC(); } | 225 CFX_ByteStringC GetResult() const { return m_Buffer.AsStringC(); } |
226 | 226 |
227 protected: | 227 protected: |
228 CFX_ByteTextBuf m_Buffer; | 228 CFX_ByteTextBuf m_Buffer; |
229 }; | 229 }; |
230 | 230 |
231 class CFX_BasicArray { | 231 class CFX_BasicArray { |
232 protected: | 232 protected: |
233 CFX_BasicArray(int unit_size); | 233 CFX_BasicArray(int unit_size); |
234 | 234 CFX_BasicArray(const CFX_BasicArray&) = delete; |
235 ~CFX_BasicArray(); | 235 ~CFX_BasicArray(); |
236 | 236 |
237 FX_BOOL SetSize(int nNewSize); | 237 FX_BOOL SetSize(int nNewSize); |
238 | |
239 FX_BOOL Append(const CFX_BasicArray& src); | 238 FX_BOOL Append(const CFX_BasicArray& src); |
240 | |
241 FX_BOOL Copy(const CFX_BasicArray& src); | 239 FX_BOOL Copy(const CFX_BasicArray& src); |
242 | |
243 uint8_t* InsertSpaceAt(int nIndex, int nCount); | 240 uint8_t* InsertSpaceAt(int nIndex, int nCount); |
244 | |
245 FX_BOOL RemoveAt(int nIndex, int nCount); | 241 FX_BOOL RemoveAt(int nIndex, int nCount); |
246 | |
247 FX_BOOL InsertAt(int nStartIndex, const CFX_BasicArray* pNewArray); | 242 FX_BOOL InsertAt(int nStartIndex, const CFX_BasicArray* pNewArray); |
248 | |
249 const void* GetDataPtr(int index) const; | 243 const void* GetDataPtr(int index) const; |
250 | 244 |
251 protected: | 245 protected: |
252 uint8_t* m_pData; | 246 uint8_t* m_pData; |
253 | |
254 int m_nSize; | 247 int m_nSize; |
255 | |
256 int m_nMaxSize; | 248 int m_nMaxSize; |
257 | |
258 int m_nUnitSize; | 249 int m_nUnitSize; |
259 }; | 250 }; |
| 251 |
260 template <class TYPE> | 252 template <class TYPE> |
261 class CFX_ArrayTemplate : public CFX_BasicArray { | 253 class CFX_ArrayTemplate : public CFX_BasicArray { |
262 public: | 254 public: |
263 CFX_ArrayTemplate() : CFX_BasicArray(sizeof(TYPE)) {} | 255 CFX_ArrayTemplate() : CFX_BasicArray(sizeof(TYPE)) {} |
264 | 256 |
265 int GetSize() const { return m_nSize; } | 257 int GetSize() const { return m_nSize; } |
266 | 258 |
267 int GetUpperBound() const { return m_nSize - 1; } | 259 int GetUpperBound() const { return m_nSize - 1; } |
268 | 260 |
269 FX_BOOL SetSize(int nNewSize) { return CFX_BasicArray::SetSize(nNewSize); } | 261 FX_BOOL SetSize(int nNewSize) { return CFX_BasicArray::SetSize(nNewSize); } |
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1058 FX_FLOAT c; | 1050 FX_FLOAT c; |
1059 FX_FLOAT d; | 1051 FX_FLOAT d; |
1060 FX_FLOAT e; | 1052 FX_FLOAT e; |
1061 FX_FLOAT f; | 1053 FX_FLOAT f; |
1062 FX_FLOAT g; | 1054 FX_FLOAT g; |
1063 FX_FLOAT h; | 1055 FX_FLOAT h; |
1064 FX_FLOAT i; | 1056 FX_FLOAT i; |
1065 }; | 1057 }; |
1066 | 1058 |
1067 #endif // CORE_FXCRT_INCLUDE_FX_BASIC_H_ | 1059 #endif // CORE_FXCRT_INCLUDE_FX_BASIC_H_ |
OLD | NEW |