| 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 _FX_STRING_H_ | 7 #ifndef _FX_STRING_H_ |
| 8 #define _FX_STRING_H_ | 8 #define _FX_STRING_H_ |
| 9 | 9 |
| 10 #include "fx_memory.h" | 10 #include "fx_memory.h" |
| 11 | 11 |
| 12 class CFX_ByteStringC; | 12 class CFX_ByteStringC; |
| 13 class CFX_ByteString; | 13 class CFX_ByteString; |
| 14 class CFX_WideStringC; | 14 class CFX_WideStringC; |
| 15 class CFX_WideString; | 15 class CFX_WideString; |
| 16 struct CFX_CharMap; | 16 struct CFX_CharMap; |
| 17 class CFX_BinaryBuf; | 17 class CFX_BinaryBuf; |
| 18 typedef int FX_STRSIZE; | 18 typedef int FX_STRSIZE; |
| 19 class CFX_ByteStringL; | 19 class CFX_ByteStringL; |
| 20 class CFX_WideStringL; | 20 class CFX_WideStringL; |
| 21 | 21 |
| 22 // An immutable string with caller-provided storage which must outlive the | 22 // An immutable string with caller-provided storage which must outlive the |
| 23 // string itself. | 23 // string itself. |
| 24 class CFX_ByteStringC : public CFX_Object | 24 class CFX_ByteStringC |
| 25 { | 25 { |
| 26 public: | 26 public: |
| 27 typedef FX_CHAR value_type; | 27 typedef FX_CHAR value_type; |
| 28 | 28 |
| 29 CFX_ByteStringC() | 29 CFX_ByteStringC() |
| 30 { | 30 { |
| 31 m_Ptr = NULL; | 31 m_Ptr = NULL; |
| 32 m_Length = 0; | 32 m_Length = 0; |
| 33 } | 33 } |
| 34 | 34 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 struct CFX_StringData { | 164 struct CFX_StringData { |
| 165 | 165 |
| 166 long m_nRefs; | 166 long m_nRefs; |
| 167 | 167 |
| 168 FX_STRSIZE m_nDataLength; | 168 FX_STRSIZE m_nDataLength; |
| 169 | 169 |
| 170 FX_STRSIZE m_nAllocLength; | 170 FX_STRSIZE m_nAllocLength; |
| 171 | 171 |
| 172 FX_CHAR m_String[1]; | 172 FX_CHAR m_String[1]; |
| 173 }; | 173 }; |
| 174 class CFX_ByteString : public CFX_Object | 174 class CFX_ByteString |
| 175 { | 175 { |
| 176 public: | 176 public: |
| 177 typedef FX_CHAR value_type; | 177 typedef FX_CHAR value_type; |
| 178 | 178 |
| 179 CFX_ByteString() | 179 CFX_ByteString() |
| 180 { | 180 { |
| 181 m_pData = NULL; | 181 m_pData = NULL; |
| 182 } | 182 } |
| 183 | 183 |
| 184 CFX_ByteString(const CFX_ByteString& str); | 184 CFX_ByteString(const CFX_ByteString& str); |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 return CFX_ByteString(str1, str2); | 421 return CFX_ByteString(str1, str2); |
| 422 } | 422 } |
| 423 inline CFX_ByteString operator + (const CFX_ByteString& str1, FX_BSTR str2) | 423 inline CFX_ByteString operator + (const CFX_ByteString& str1, FX_BSTR str2) |
| 424 { | 424 { |
| 425 return CFX_ByteString(str1, str2); | 425 return CFX_ByteString(str1, str2); |
| 426 } | 426 } |
| 427 inline CFX_ByteString operator + (FX_BSTR str1, const CFX_ByteString& str2) | 427 inline CFX_ByteString operator + (FX_BSTR str1, const CFX_ByteString& str2) |
| 428 { | 428 { |
| 429 return CFX_ByteString(str1, str2); | 429 return CFX_ByteString(str1, str2); |
| 430 } | 430 } |
| 431 class CFX_StringBufBase : public CFX_Object | 431 class CFX_StringBufBase |
| 432 { | 432 { |
| 433 public: | 433 public: |
| 434 | 434 |
| 435 CFX_StringBufBase(FX_STRSIZE limit) | 435 CFX_StringBufBase(FX_STRSIZE limit) |
| 436 { | 436 { |
| 437 m_Size = 0; | 437 m_Size = 0; |
| 438 m_Limit = limit; | 438 m_Limit = limit; |
| 439 } | 439 } |
| 440 | 440 |
| 441 FX_CHAR* GetPtr() const | 441 FX_CHAR* GetPtr() const |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 template<FX_STRSIZE limit> | 477 template<FX_STRSIZE limit> |
| 478 class CFX_StringBufTemplate : public CFX_StringBufBase | 478 class CFX_StringBufTemplate : public CFX_StringBufBase |
| 479 { | 479 { |
| 480 public: | 480 public: |
| 481 | 481 |
| 482 CFX_StringBufTemplate() : CFX_StringBufBase(limit) {} | 482 CFX_StringBufTemplate() : CFX_StringBufBase(limit) {} |
| 483 | 483 |
| 484 FX_CHAR m_Buffer[limit]; | 484 FX_CHAR m_Buffer[limit]; |
| 485 }; | 485 }; |
| 486 typedef CFX_StringBufTemplate<256> CFX_StringBuf256; | 486 typedef CFX_StringBufTemplate<256> CFX_StringBuf256; |
| 487 class CFX_WideStringC : public CFX_Object | 487 class CFX_WideStringC |
| 488 { | 488 { |
| 489 public: | 489 public: |
| 490 typedef FX_WCHAR value_type; | 490 typedef FX_WCHAR value_type; |
| 491 | 491 |
| 492 CFX_WideStringC() | 492 CFX_WideStringC() |
| 493 { | 493 { |
| 494 m_Ptr = NULL; | 494 m_Ptr = NULL; |
| 495 m_Length = 0; | 495 m_Length = 0; |
| 496 } | 496 } |
| 497 | 497 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 struct CFX_StringDataW { | 623 struct CFX_StringDataW { |
| 624 | 624 |
| 625 long m_nRefs; | 625 long m_nRefs; |
| 626 | 626 |
| 627 FX_STRSIZE m_nDataLength; | 627 FX_STRSIZE m_nDataLength; |
| 628 | 628 |
| 629 FX_STRSIZE m_nAllocLength; | 629 FX_STRSIZE m_nAllocLength; |
| 630 | 630 |
| 631 FX_WCHAR m_String[1]; | 631 FX_WCHAR m_String[1]; |
| 632 }; | 632 }; |
| 633 class CFX_WideString : public CFX_Object | 633 class CFX_WideString |
| 634 { | 634 { |
| 635 public: | 635 public: |
| 636 typedef FX_WCHAR value_type; | 636 typedef FX_WCHAR value_type; |
| 637 | 637 |
| 638 CFX_WideString() | 638 CFX_WideString() |
| 639 { | 639 { |
| 640 m_pData = NULL; | 640 m_pData = NULL; |
| 641 } | 641 } |
| 642 | 642 |
| 643 CFX_WideString(const CFX_WideString& str); | 643 CFX_WideString(const CFX_WideString& str); |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 CFX_ByteString FX_UTF8Encode(FX_LPCWSTR pwsStr, FX_STRSIZE len); | 867 CFX_ByteString FX_UTF8Encode(FX_LPCWSTR pwsStr, FX_STRSIZE len); |
| 868 inline CFX_ByteString FX_UTF8Encode(FX_WSTR wsStr) | 868 inline CFX_ByteString FX_UTF8Encode(FX_WSTR wsStr) |
| 869 { | 869 { |
| 870 return FX_UTF8Encode(wsStr.GetPtr(), wsStr.GetLength()); | 870 return FX_UTF8Encode(wsStr.GetPtr(), wsStr.GetLength()); |
| 871 } | 871 } |
| 872 inline CFX_ByteString FX_UTF8Encode(const CFX_WideString &wsStr) | 872 inline CFX_ByteString FX_UTF8Encode(const CFX_WideString &wsStr) |
| 873 { | 873 { |
| 874 return FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength()); | 874 return FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength()); |
| 875 } | 875 } |
| 876 #endif | 876 #endif |
| OLD | NEW |