| 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 <algorithm> | 10 #include <algorithm> |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 struct CFX_StringData { | 171 struct CFX_StringData { |
| 172 | 172 |
| 173 long m_nRefs; | 173 long m_nRefs; |
| 174 | 174 |
| 175 FX_STRSIZE m_nDataLength; | 175 FX_STRSIZE m_nDataLength; |
| 176 | 176 |
| 177 FX_STRSIZE m_nAllocLength; | 177 FX_STRSIZE m_nAllocLength; |
| 178 | 178 |
| 179 FX_CHAR m_String[1]; | 179 FX_CHAR m_String[1]; |
| 180 }; | 180 }; |
| 181 class CFX_ByteString | 181 |
| 182 // A mutable string with shared buffers using copy-on-write semantics that |
| 183 // avoids the cost of std::string's iterator stability guarantees. |
| 184 class CFX_ByteString |
| 182 { | 185 { |
| 183 public: | 186 public: |
| 184 typedef FX_CHAR value_type; | 187 typedef FX_CHAR value_type; |
| 185 | 188 |
| 186 CFX_ByteString() | 189 CFX_ByteString() |
| 187 { | 190 { |
| 188 m_pData = NULL; | 191 m_pData = NULL; |
| 189 } | 192 } |
| 190 | 193 |
| 191 CFX_ByteString(const CFX_ByteString& str); | 194 CFX_ByteString(const CFX_ByteString& str); |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 struct CFX_StringDataW { | 591 struct CFX_StringDataW { |
| 589 | 592 |
| 590 long m_nRefs; | 593 long m_nRefs; |
| 591 | 594 |
| 592 FX_STRSIZE m_nDataLength; | 595 FX_STRSIZE m_nDataLength; |
| 593 | 596 |
| 594 FX_STRSIZE m_nAllocLength; | 597 FX_STRSIZE m_nAllocLength; |
| 595 | 598 |
| 596 FX_WCHAR m_String[1]; | 599 FX_WCHAR m_String[1]; |
| 597 }; | 600 }; |
| 598 class CFX_WideString | 601 |
| 602 // A mutable string with shared buffers using copy-on-write semantics that |
| 603 // avoids the cost of std::string's iterator stability guarantees. |
| 604 class CFX_WideString |
| 599 { | 605 { |
| 600 public: | 606 public: |
| 601 typedef FX_WCHAR value_type; | 607 typedef FX_WCHAR value_type; |
| 602 | 608 |
| 603 CFX_WideString() | 609 CFX_WideString() |
| 604 { | 610 { |
| 605 m_pData = NULL; | 611 m_pData = NULL; |
| 606 } | 612 } |
| 607 | 613 |
| 608 CFX_WideString(const CFX_WideString& str); | 614 CFX_WideString(const CFX_WideString& str); |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 CFX_ByteString FX_UTF8Encode(FX_LPCWSTR pwsStr, FX_STRSIZE len); | 841 CFX_ByteString FX_UTF8Encode(FX_LPCWSTR pwsStr, FX_STRSIZE len); |
| 836 inline CFX_ByteString FX_UTF8Encode(FX_WSTR wsStr) | 842 inline CFX_ByteString FX_UTF8Encode(FX_WSTR wsStr) |
| 837 { | 843 { |
| 838 return FX_UTF8Encode(wsStr.GetPtr(), wsStr.GetLength()); | 844 return FX_UTF8Encode(wsStr.GetPtr(), wsStr.GetLength()); |
| 839 } | 845 } |
| 840 inline CFX_ByteString FX_UTF8Encode(const CFX_WideString &wsStr) | 846 inline CFX_ByteString FX_UTF8Encode(const CFX_WideString &wsStr) |
| 841 { | 847 { |
| 842 return FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength()); | 848 return FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength()); |
| 843 } | 849 } |
| 844 #endif | 850 #endif |
| OLD | NEW |