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 "fx_memory.h" | 10 #include "fx_memory.h" |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 | 198 |
199 CFX_WideStringC GetResult() const { return m_Buffer.GetWideString(); } | 199 CFX_WideStringC GetResult() const { return m_Buffer.GetWideString(); } |
200 | 200 |
201 protected: | 201 protected: |
202 int m_PendingBytes; | 202 int m_PendingBytes; |
203 | 203 |
204 FX_DWORD m_PendingChar; | 204 FX_DWORD m_PendingChar; |
205 | 205 |
206 CFX_WideTextBuf m_Buffer; | 206 CFX_WideTextBuf m_Buffer; |
207 }; | 207 }; |
| 208 |
208 class CFX_UTF8Encoder { | 209 class CFX_UTF8Encoder { |
209 public: | 210 public: |
210 CFX_UTF8Encoder() { m_UTF16First = 0; } | 211 CFX_UTF8Encoder() {} |
211 | 212 |
212 void Input(FX_WCHAR unicode); | 213 void Input(FX_WCHAR unicode); |
213 | 214 void AppendStr(const CFX_ByteStringC& str) { m_Buffer << str; } |
214 void AppendStr(const CFX_ByteStringC& str) { | |
215 m_UTF16First = 0; | |
216 m_Buffer << str; | |
217 } | |
218 | |
219 CFX_ByteStringC GetResult() const { return m_Buffer.GetByteString(); } | 215 CFX_ByteStringC GetResult() const { return m_Buffer.GetByteString(); } |
220 | 216 |
221 protected: | 217 protected: |
222 CFX_ByteTextBuf m_Buffer; | 218 CFX_ByteTextBuf m_Buffer; |
| 219 }; |
223 | 220 |
224 FX_DWORD m_UTF16First; | |
225 }; | |
226 CFX_ByteString FX_UrlEncode(const CFX_WideString& wsUrl); | |
227 CFX_WideString FX_UrlDecode(const CFX_ByteString& bsUrl); | |
228 CFX_ByteString FX_EncodeURI(const CFX_WideString& wsURI); | |
229 CFX_WideString FX_DecodeURI(const CFX_ByteString& bsURI); | |
230 class CFX_BasicArray { | 221 class CFX_BasicArray { |
231 protected: | 222 protected: |
232 CFX_BasicArray(int unit_size); | 223 CFX_BasicArray(int unit_size); |
233 | 224 |
234 ~CFX_BasicArray(); | 225 ~CFX_BasicArray(); |
235 | 226 |
236 FX_BOOL SetSize(int nNewSize); | 227 FX_BOOL SetSize(int nNewSize); |
237 | 228 |
238 FX_BOOL Append(const CFX_BasicArray& src); | 229 FX_BOOL Append(const CFX_BasicArray& src); |
239 | 230 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 return iStart; | 367 return iStart; |
377 } | 368 } |
378 return -1; | 369 return -1; |
379 } | 370 } |
380 }; | 371 }; |
381 typedef CFX_ArrayTemplate<uint8_t> CFX_ByteArray; | 372 typedef CFX_ArrayTemplate<uint8_t> CFX_ByteArray; |
382 typedef CFX_ArrayTemplate<FX_WORD> CFX_WordArray; | 373 typedef CFX_ArrayTemplate<FX_WORD> CFX_WordArray; |
383 typedef CFX_ArrayTemplate<FX_DWORD> CFX_DWordArray; | 374 typedef CFX_ArrayTemplate<FX_DWORD> CFX_DWordArray; |
384 typedef CFX_ArrayTemplate<void*> CFX_PtrArray; | 375 typedef CFX_ArrayTemplate<void*> CFX_PtrArray; |
385 typedef CFX_ArrayTemplate<FX_FILESIZE> CFX_FileSizeArray; | 376 typedef CFX_ArrayTemplate<FX_FILESIZE> CFX_FileSizeArray; |
386 typedef CFX_ArrayTemplate<FX_FLOAT> CFX_FloatArray; | 377 |
387 typedef CFX_ArrayTemplate<int32_t> CFX_Int32Array; | |
388 template <class ObjectClass> | 378 template <class ObjectClass> |
389 class CFX_ObjectArray : public CFX_BasicArray { | 379 class CFX_ObjectArray : public CFX_BasicArray { |
390 public: | 380 public: |
391 CFX_ObjectArray() : CFX_BasicArray(sizeof(ObjectClass)) {} | 381 CFX_ObjectArray() : CFX_BasicArray(sizeof(ObjectClass)) {} |
392 | 382 |
393 ~CFX_ObjectArray() { RemoveAll(); } | 383 ~CFX_ObjectArray() { RemoveAll(); } |
394 | 384 |
395 void Add(const ObjectClass& data) { | 385 void Add(const ObjectClass& data) { |
396 new ((void*)InsertSpaceAt(m_nSize, 1)) ObjectClass(data); | 386 new ((void*)InsertSpaceAt(m_nSize, 1)) ObjectClass(data); |
397 } | 387 } |
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1233 FX_FLOAT c; | 1223 FX_FLOAT c; |
1234 FX_FLOAT d; | 1224 FX_FLOAT d; |
1235 FX_FLOAT e; | 1225 FX_FLOAT e; |
1236 FX_FLOAT f; | 1226 FX_FLOAT f; |
1237 FX_FLOAT g; | 1227 FX_FLOAT g; |
1238 FX_FLOAT h; | 1228 FX_FLOAT h; |
1239 FX_FLOAT i; | 1229 FX_FLOAT i; |
1240 }; | 1230 }; |
1241 | 1231 |
1242 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_ | 1232 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_ |
OLD | NEW |