| 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_STRING_H_ | 7 #ifndef CORE_INCLUDE_FXCRT_FX_STRING_H_ |
| 8 #define CORE_INCLUDE_FXCRT_FX_STRING_H_ | 8 #define CORE_INCLUDE_FXCRT_FX_STRING_H_ |
| 9 | 9 |
| 10 #include <stdint.h> // For intptr_t. | 10 #include <stdint.h> // For intptr_t. |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 | 282 |
| 283 void TrimLeft(const CFX_ByteStringC& lpszTargets); | 283 void TrimLeft(const CFX_ByteStringC& lpszTargets); |
| 284 | 284 |
| 285 FX_STRSIZE Replace(const CFX_ByteStringC& lpszOld, | 285 FX_STRSIZE Replace(const CFX_ByteStringC& lpszOld, |
| 286 const CFX_ByteStringC& lpszNew); | 286 const CFX_ByteStringC& lpszNew); |
| 287 | 287 |
| 288 FX_STRSIZE Remove(FX_CHAR ch); | 288 FX_STRSIZE Remove(FX_CHAR ch); |
| 289 | 289 |
| 290 CFX_WideString UTF8Decode() const; | 290 CFX_WideString UTF8Decode() const; |
| 291 | 291 |
| 292 void ConvertFrom(const CFX_WideString& str, CFX_CharMap* pCharMap = NULL); | |
| 293 | |
| 294 FX_DWORD GetID(FX_STRSIZE start_pos = 0) const; | 292 FX_DWORD GetID(FX_STRSIZE start_pos = 0) const; |
| 295 | 293 |
| 296 #define FXFORMAT_SIGNED 1 | 294 #define FXFORMAT_SIGNED 1 |
| 297 #define FXFORMAT_HEX 2 | 295 #define FXFORMAT_HEX 2 |
| 298 #define FXFORMAT_CAPITAL 4 | 296 #define FXFORMAT_CAPITAL 4 |
| 299 | 297 |
| 300 static CFX_ByteString FormatInteger(int i, FX_DWORD flags = 0); | 298 static CFX_ByteString FormatInteger(int i, FX_DWORD flags = 0); |
| 301 static CFX_ByteString FormatFloat(FX_FLOAT f, int precision = 0); | 299 static CFX_ByteString FormatFloat(FX_FLOAT f, int precision = 0); |
| 302 | 300 |
| 303 protected: | 301 protected: |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 CFX_WideString(const FX_WCHAR* ptr, FX_STRSIZE len); | 552 CFX_WideString(const FX_WCHAR* ptr, FX_STRSIZE len); |
| 555 | 553 |
| 556 CFX_WideString(FX_WCHAR ch); | 554 CFX_WideString(FX_WCHAR ch); |
| 557 | 555 |
| 558 CFX_WideString(const CFX_WideStringC& str); | 556 CFX_WideString(const CFX_WideStringC& str); |
| 559 | 557 |
| 560 CFX_WideString(const CFX_WideStringC& str1, const CFX_WideStringC& str2); | 558 CFX_WideString(const CFX_WideStringC& str1, const CFX_WideStringC& str2); |
| 561 | 559 |
| 562 ~CFX_WideString(); | 560 ~CFX_WideString(); |
| 563 | 561 |
| 564 static CFX_WideString FromLocal(const char* str, FX_STRSIZE len = -1); | 562 static CFX_WideString FromLocal(const CFX_ByteString& str); |
| 563 |
| 564 static CFX_WideString FromCodePage(const CFX_ByteString& str, |
| 565 FX_WORD codepage); |
| 565 | 566 |
| 566 static CFX_WideString FromUTF8(const char* str, FX_STRSIZE len); | 567 static CFX_WideString FromUTF8(const char* str, FX_STRSIZE len); |
| 567 | 568 |
| 568 static CFX_WideString FromUTF16LE(const unsigned short* str, FX_STRSIZE len); | 569 static CFX_WideString FromUTF16LE(const unsigned short* str, FX_STRSIZE len); |
| 569 | 570 |
| 570 static FX_STRSIZE WStringLength(const unsigned short* str); | 571 static FX_STRSIZE WStringLength(const unsigned short* str); |
| 571 | 572 |
| 572 // Explicit conversion to raw string | 573 // Explicit conversion to raw string |
| 573 const FX_WCHAR* c_str() const { return m_pData ? m_pData->m_String : L""; } | 574 const FX_WCHAR* c_str() const { return m_pData ? m_pData->m_String : L""; } |
| 574 | 575 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 FX_STRSIZE Find(FX_WCHAR ch, FX_STRSIZE start = 0) const; | 679 FX_STRSIZE Find(FX_WCHAR ch, FX_STRSIZE start = 0) const; |
| 679 | 680 |
| 680 FX_STRSIZE Replace(const FX_WCHAR* lpszOld, const FX_WCHAR* lpszNew); | 681 FX_STRSIZE Replace(const FX_WCHAR* lpszOld, const FX_WCHAR* lpszNew); |
| 681 | 682 |
| 682 FX_STRSIZE Remove(FX_WCHAR ch); | 683 FX_STRSIZE Remove(FX_WCHAR ch); |
| 683 | 684 |
| 684 CFX_ByteString UTF8Encode() const; | 685 CFX_ByteString UTF8Encode() const; |
| 685 | 686 |
| 686 CFX_ByteString UTF16LE_Encode() const; | 687 CFX_ByteString UTF16LE_Encode() const; |
| 687 | 688 |
| 688 void ConvertFrom(const CFX_ByteString& str, CFX_CharMap* pCharMap = NULL); | |
| 689 | |
| 690 protected: | 689 protected: |
| 691 class StringData { | 690 class StringData { |
| 692 public: | 691 public: |
| 693 static StringData* Create(int nLen); | 692 static StringData* Create(int nLen); |
| 694 void Retain() { ++m_nRefs; } | 693 void Retain() { ++m_nRefs; } |
| 695 void Release() { | 694 void Release() { |
| 696 if (--m_nRefs <= 0) | 695 if (--m_nRefs <= 0) |
| 697 FX_Free(this); | 696 FX_Free(this); |
| 698 } | 697 } |
| 699 | 698 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 } | 803 } |
| 805 | 804 |
| 806 FX_FLOAT FX_atof(const CFX_ByteStringC& str); | 805 FX_FLOAT FX_atof(const CFX_ByteStringC& str); |
| 807 inline FX_FLOAT FX_atof(const CFX_WideStringC& wsStr) { | 806 inline FX_FLOAT FX_atof(const CFX_WideStringC& wsStr) { |
| 808 return FX_atof(FX_UTF8Encode(wsStr.GetPtr(), wsStr.GetLength())); | 807 return FX_atof(FX_UTF8Encode(wsStr.GetPtr(), wsStr.GetLength())); |
| 809 } | 808 } |
| 810 void FX_atonum(const CFX_ByteStringC& str, FX_BOOL& bInteger, void* pData); | 809 void FX_atonum(const CFX_ByteStringC& str, FX_BOOL& bInteger, void* pData); |
| 811 FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf); | 810 FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf); |
| 812 | 811 |
| 813 #endif // CORE_INCLUDE_FXCRT_FX_STRING_H_ | 812 #endif // CORE_INCLUDE_FXCRT_FX_STRING_H_ |
| OLD | NEW |