| 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. | 
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 140 // A mutable string with shared buffers using copy-on-write semantics that | 140 // A mutable string with shared buffers using copy-on-write semantics that | 
| 141 // avoids the cost of std::string's iterator stability guarantees. | 141 // avoids the cost of std::string's iterator stability guarantees. | 
| 142 class CFX_ByteString { | 142 class CFX_ByteString { | 
| 143  public: | 143  public: | 
| 144   typedef FX_CHAR value_type; | 144   typedef FX_CHAR value_type; | 
| 145 | 145 | 
| 146   CFX_ByteString() {} | 146   CFX_ByteString() {} | 
| 147   CFX_ByteString(const CFX_ByteString& other) : m_pData(other.m_pData) {} | 147   CFX_ByteString(const CFX_ByteString& other) : m_pData(other.m_pData) {} | 
| 148   CFX_ByteString(CFX_ByteString&& other) { m_pData.Swap(other.m_pData); } | 148   CFX_ByteString(CFX_ByteString&& other) { m_pData.Swap(other.m_pData); } | 
| 149 | 149 | 
|  | 150   // Deliberately implicit to avoid calling on every string literal. | 
| 150   CFX_ByteString(char ch); | 151   CFX_ByteString(char ch); | 
| 151   CFX_ByteString(const FX_CHAR* ptr) | 152   CFX_ByteString(const FX_CHAR* ptr) | 
| 152       : CFX_ByteString(ptr, ptr ? FXSYS_strlen(ptr) : 0) {} | 153       : CFX_ByteString(ptr, ptr ? FXSYS_strlen(ptr) : 0) {} | 
| 153 | 154 | 
| 154   CFX_ByteString(const FX_CHAR* ptr, FX_STRSIZE len); | 155   CFX_ByteString(const FX_CHAR* ptr, FX_STRSIZE len); | 
| 155   CFX_ByteString(const uint8_t* ptr, FX_STRSIZE len); | 156   CFX_ByteString(const uint8_t* ptr, FX_STRSIZE len); | 
| 156 | 157 | 
|  | 158   // TODO(tsepez): mark constructor as explicit. | 
| 157   CFX_ByteString(const CFX_ByteStringC& bstrc); | 159   CFX_ByteString(const CFX_ByteStringC& bstrc); | 
| 158   CFX_ByteString(const CFX_ByteStringC& bstrc1, const CFX_ByteStringC& bstrc2); | 160   CFX_ByteString(const CFX_ByteStringC& bstrc1, const CFX_ByteStringC& bstrc2); | 
| 159 | 161 | 
| 160   ~CFX_ByteString(); | 162   ~CFX_ByteString(); | 
| 161 | 163 | 
| 162   void clear() { m_pData.Reset(); } | 164   void clear() { m_pData.Reset(); } | 
| 163 | 165 | 
| 164   static CFX_ByteString FromUnicode(const FX_WCHAR* ptr, FX_STRSIZE len = -1); | 166   static CFX_ByteString FromUnicode(const FX_WCHAR* ptr, FX_STRSIZE len = -1); | 
| 165   static CFX_ByteString FromUnicode(const CFX_WideString& str); | 167   static CFX_ByteString FromUnicode(const CFX_WideString& str); | 
| 166 | 168 | 
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 464 // A mutable string with shared buffers using copy-on-write semantics that | 466 // A mutable string with shared buffers using copy-on-write semantics that | 
| 465 // avoids the cost of std::string's iterator stability guarantees. | 467 // avoids the cost of std::string's iterator stability guarantees. | 
| 466 class CFX_WideString { | 468 class CFX_WideString { | 
| 467  public: | 469  public: | 
| 468   typedef FX_WCHAR value_type; | 470   typedef FX_WCHAR value_type; | 
| 469 | 471 | 
| 470   CFX_WideString() {} | 472   CFX_WideString() {} | 
| 471   CFX_WideString(const CFX_WideString& other) : m_pData(other.m_pData) {} | 473   CFX_WideString(const CFX_WideString& other) : m_pData(other.m_pData) {} | 
| 472   CFX_WideString(CFX_WideString&& other) { m_pData.Swap(other.m_pData); } | 474   CFX_WideString(CFX_WideString&& other) { m_pData.Swap(other.m_pData); } | 
| 473 | 475 | 
|  | 476   // Deliberately implicit to avoid calling on every string literal. | 
|  | 477   CFX_WideString(FX_WCHAR ch); | 
| 474   CFX_WideString(const FX_WCHAR* ptr) | 478   CFX_WideString(const FX_WCHAR* ptr) | 
| 475       : CFX_WideString(ptr, ptr ? FXSYS_wcslen(ptr) : 0) {} | 479       : CFX_WideString(ptr, ptr ? FXSYS_wcslen(ptr) : 0) {} | 
| 476 | 480 | 
| 477   CFX_WideString(const FX_WCHAR* ptr, FX_STRSIZE len); | 481   CFX_WideString(const FX_WCHAR* ptr, FX_STRSIZE len); | 
| 478   CFX_WideString(FX_WCHAR ch); |  | 
| 479 | 482 | 
|  | 483   // TODO(tsepez): mark constructor as explicit. | 
| 480   CFX_WideString(const CFX_WideStringC& str); | 484   CFX_WideString(const CFX_WideStringC& str); | 
| 481   CFX_WideString(const CFX_WideStringC& str1, const CFX_WideStringC& str2); | 485   CFX_WideString(const CFX_WideStringC& str1, const CFX_WideStringC& str2); | 
| 482 | 486 | 
| 483   ~CFX_WideString(); | 487   ~CFX_WideString(); | 
| 484 | 488 | 
| 485   static CFX_WideString FromLocal(const CFX_ByteStringC& str); | 489   static CFX_WideString FromLocal(const CFX_ByteStringC& str); | 
| 486   static CFX_WideString FromCodePage(const CFX_ByteStringC& str, | 490   static CFX_WideString FromCodePage(const CFX_ByteStringC& str, | 
| 487                                      uint16_t codepage); | 491                                      uint16_t codepage); | 
| 488 | 492 | 
| 489   static CFX_WideString FromUTF8(const CFX_ByteStringC& str); | 493   static CFX_WideString FromUTF8(const CFX_ByteStringC& str); | 
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 670 } | 674 } | 
| 671 | 675 | 
| 672 FX_FLOAT FX_atof(const CFX_ByteStringC& str); | 676 FX_FLOAT FX_atof(const CFX_ByteStringC& str); | 
| 673 inline FX_FLOAT FX_atof(const CFX_WideStringC& wsStr) { | 677 inline FX_FLOAT FX_atof(const CFX_WideStringC& wsStr) { | 
| 674   return FX_atof(FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength()).c_str()); | 678   return FX_atof(FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength()).c_str()); | 
| 675 } | 679 } | 
| 676 void FX_atonum(const CFX_ByteStringC& str, FX_BOOL& bInteger, void* pData); | 680 void FX_atonum(const CFX_ByteStringC& str, FX_BOOL& bInteger, void* pData); | 
| 677 FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf); | 681 FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf); | 
| 678 | 682 | 
| 679 #endif  // CORE_FXCRT_INCLUDE_FX_STRING_H_ | 683 #endif  // CORE_FXCRT_INCLUDE_FX_STRING_H_ | 
| OLD | NEW | 
|---|