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_STRING_H_ | 7 #ifndef CORE_FXCRT_INCLUDE_FX_STRING_H_ |
8 #define CORE_FXCRT_INCLUDE_FX_STRING_H_ | 8 #define CORE_FXCRT_INCLUDE_FX_STRING_H_ |
9 | 9 |
10 #include <stdint.h> // For intptr_t. | 10 #include <stdint.h> // For intptr_t. |
11 #include <algorithm> | 11 #include <algorithm> |
12 | 12 |
13 #include "core/fxcrt/cfx_string_data_template.h" | 13 #include "core/fxcrt/cfx_string_data_template.h" |
14 #include "core/fxcrt/include/cfx_retain_ptr.h" | 14 #include "core/fxcrt/include/cfx_retain_ptr.h" |
15 #include "core/fxcrt/include/fx_memory.h" | 15 #include "core/fxcrt/include/fx_memory.h" |
16 #include "core/fxcrt/include/fx_system.h" | 16 #include "core/fxcrt/include/fx_system.h" |
17 | 17 |
18 class CFX_ByteString; | 18 class CFX_ByteString; |
19 class CFX_WideString; | 19 class CFX_WideString; |
20 | 20 |
21 // An immutable string with caller-provided storage which must outlive the | 21 // An immutable string with caller-provided storage which must outlive the |
22 // string itself. | 22 // string itself. These are not necessarily nul-terminated, so that substring |
| 23 // extraction (via the Mid() method) is copy-free. |
23 class CFX_ByteStringC { | 24 class CFX_ByteStringC { |
24 public: | 25 public: |
25 typedef FX_CHAR value_type; | 26 typedef FX_CHAR value_type; |
26 | 27 |
27 CFX_ByteStringC() { | 28 CFX_ByteStringC() { |
28 m_Ptr = NULL; | 29 m_Ptr = NULL; |
29 m_Length = 0; | 30 m_Length = 0; |
30 } | 31 } |
31 | 32 |
32 CFX_ByteStringC(const uint8_t* ptr, FX_STRSIZE size) { | 33 CFX_ByteStringC(const uint8_t* ptr, FX_STRSIZE size) { |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 } | 668 } |
668 | 669 |
669 FX_FLOAT FX_atof(const CFX_ByteStringC& str); | 670 FX_FLOAT FX_atof(const CFX_ByteStringC& str); |
670 inline FX_FLOAT FX_atof(const CFX_WideStringC& wsStr) { | 671 inline FX_FLOAT FX_atof(const CFX_WideStringC& wsStr) { |
671 return FX_atof(FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength()).c_str()); | 672 return FX_atof(FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength()).c_str()); |
672 } | 673 } |
673 void FX_atonum(const CFX_ByteStringC& str, FX_BOOL& bInteger, void* pData); | 674 void FX_atonum(const CFX_ByteStringC& str, FX_BOOL& bInteger, void* pData); |
674 FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf); | 675 FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf); |
675 | 676 |
676 #endif // CORE_FXCRT_INCLUDE_FX_STRING_H_ | 677 #endif // CORE_FXCRT_INCLUDE_FX_STRING_H_ |
OLD | NEW |