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_FX_STRING_H_ |
8 #define CORE_FXCRT_INCLUDE_FX_STRING_H_ | 8 #define CORE_FXCRT_FX_STRING_H_ |
9 | 9 |
10 #include <stdint.h> // For intptr_t. | 10 #include <stdint.h> // For intptr_t. |
11 | 11 |
12 #include <algorithm> | 12 #include <algorithm> |
13 #include <functional> | 13 #include <functional> |
14 | 14 |
| 15 #include "core/fxcrt/cfx_retain_ptr.h" |
15 #include "core/fxcrt/cfx_string_c_template.h" | 16 #include "core/fxcrt/cfx_string_c_template.h" |
16 #include "core/fxcrt/cfx_string_data_template.h" | 17 #include "core/fxcrt/cfx_string_data_template.h" |
17 #include "core/fxcrt/include/cfx_retain_ptr.h" | 18 #include "core/fxcrt/fx_memory.h" |
18 #include "core/fxcrt/include/fx_memory.h" | 19 #include "core/fxcrt/fx_system.h" |
19 #include "core/fxcrt/include/fx_system.h" | |
20 | 20 |
21 class CFX_ByteString; | 21 class CFX_ByteString; |
22 class CFX_WideString; | 22 class CFX_WideString; |
23 | 23 |
24 using CFX_ByteStringC = CFX_StringCTemplate<FX_CHAR>; | 24 using CFX_ByteStringC = CFX_StringCTemplate<FX_CHAR>; |
25 using CFX_WideStringC = CFX_StringCTemplate<FX_WCHAR>; | 25 using CFX_WideStringC = CFX_StringCTemplate<FX_WCHAR>; |
26 | 26 |
27 #define FXBSTR_ID(c1, c2, c3, c4) \ | 27 #define FXBSTR_ID(c1, c2, c3, c4) \ |
28 (((uint32_t)c1 << 24) | ((uint32_t)c2 << 16) | ((uint32_t)c3 << 8) | \ | 28 (((uint32_t)c1 << 24) | ((uint32_t)c2 << 16) | ((uint32_t)c3 << 8) | \ |
29 ((uint32_t)c4)) | 29 ((uint32_t)c4)) |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 FX_WCHAR operator[](FX_STRSIZE nIndex) const { | 304 FX_WCHAR operator[](FX_STRSIZE nIndex) const { |
305 return m_pData ? m_pData->m_String[nIndex] : 0; | 305 return m_pData ? m_pData->m_String[nIndex] : 0; |
306 } | 306 } |
307 | 307 |
308 void SetAt(FX_STRSIZE nIndex, FX_WCHAR ch); | 308 void SetAt(FX_STRSIZE nIndex, FX_WCHAR ch); |
309 | 309 |
310 int Compare(const FX_WCHAR* str) const; | 310 int Compare(const FX_WCHAR* str) const; |
311 int Compare(const CFX_WideString& str) const; | 311 int Compare(const CFX_WideString& str) const; |
312 int CompareNoCase(const FX_WCHAR* str) const; | 312 int CompareNoCase(const FX_WCHAR* str) const; |
313 | 313 |
314 | |
315 CFX_WideString Mid(FX_STRSIZE first) const; | 314 CFX_WideString Mid(FX_STRSIZE first) const; |
316 CFX_WideString Mid(FX_STRSIZE first, FX_STRSIZE count) const; | 315 CFX_WideString Mid(FX_STRSIZE first, FX_STRSIZE count) const; |
317 CFX_WideString Left(FX_STRSIZE count) const; | 316 CFX_WideString Left(FX_STRSIZE count) const; |
318 CFX_WideString Right(FX_STRSIZE count) const; | 317 CFX_WideString Right(FX_STRSIZE count) const; |
319 | 318 |
320 FX_STRSIZE Insert(FX_STRSIZE index, FX_WCHAR ch); | 319 FX_STRSIZE Insert(FX_STRSIZE index, FX_WCHAR ch); |
321 FX_STRSIZE Delete(FX_STRSIZE index, FX_STRSIZE count = 1); | 320 FX_STRSIZE Delete(FX_STRSIZE index, FX_STRSIZE count = 1); |
322 | 321 |
323 void Format(const FX_WCHAR* lpszFormat, ...); | 322 void Format(const FX_WCHAR* lpszFormat, ...); |
324 void FormatV(const FX_WCHAR* lpszFormat, va_list argList); | 323 void FormatV(const FX_WCHAR* lpszFormat, va_list argList); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 std::size_t operator()(const CFX_WideString& str) const { | 454 std::size_t operator()(const CFX_WideString& str) const { |
456 return FX_HashCode_GetW(str.AsStringC(), false); | 455 return FX_HashCode_GetW(str.AsStringC(), false); |
457 } | 456 } |
458 }; | 457 }; |
459 | 458 |
460 } // namespace std | 459 } // namespace std |
461 | 460 |
462 extern template struct std::hash<CFX_ByteString>; | 461 extern template struct std::hash<CFX_ByteString>; |
463 extern template struct std::hash<CFX_WideString>; | 462 extern template struct std::hash<CFX_WideString>; |
464 | 463 |
465 #endif // CORE_FXCRT_INCLUDE_FX_STRING_H_ | 464 #endif // CORE_FXCRT_FX_STRING_H_ |
OLD | NEW |