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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 : CFX_ByteString(ptr, ptr ? FXSYS_strlen(ptr) : 0) {} | 152 : CFX_ByteString(ptr, ptr ? FXSYS_strlen(ptr) : 0) {} |
153 | 153 |
154 CFX_ByteString(const FX_CHAR* ptr, FX_STRSIZE len); | 154 CFX_ByteString(const FX_CHAR* ptr, FX_STRSIZE len); |
155 CFX_ByteString(const uint8_t* ptr, FX_STRSIZE len); | 155 CFX_ByteString(const uint8_t* ptr, FX_STRSIZE len); |
156 | 156 |
157 CFX_ByteString(const CFX_ByteStringC& bstrc); | 157 CFX_ByteString(const CFX_ByteStringC& bstrc); |
158 CFX_ByteString(const CFX_ByteStringC& bstrc1, const CFX_ByteStringC& bstrc2); | 158 CFX_ByteString(const CFX_ByteStringC& bstrc1, const CFX_ByteStringC& bstrc2); |
159 | 159 |
160 ~CFX_ByteString(); | 160 ~CFX_ByteString(); |
161 | 161 |
162 // Deprecated -- use clear(). | |
163 void Empty() { m_pData.Reset(); } | |
164 void clear() { m_pData.Reset(); } | 162 void clear() { m_pData.Reset(); } |
165 | 163 |
166 static CFX_ByteString FromUnicode(const FX_WCHAR* ptr, FX_STRSIZE len = -1); | 164 static CFX_ByteString FromUnicode(const FX_WCHAR* ptr, FX_STRSIZE len = -1); |
167 static CFX_ByteString FromUnicode(const CFX_WideString& str); | 165 static CFX_ByteString FromUnicode(const CFX_WideString& str); |
168 | 166 |
169 // Explicit conversion to C-style string. | 167 // Explicit conversion to C-style string. |
170 // Note: Any subsequent modification of |this| will invalidate the result. | 168 // Note: Any subsequent modification of |this| will invalidate the result. |
171 const FX_CHAR* c_str() const { return m_pData ? m_pData->m_String : ""; } | 169 const FX_CHAR* c_str() const { return m_pData ? m_pData->m_String : ""; } |
172 | 170 |
173 // Explicit conversion to uint8_t*. | 171 // Explicit conversion to uint8_t*. |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 // Explicit conversion to C-style wide string. | 494 // Explicit conversion to C-style wide string. |
497 // Note: Any subsequent modification of |this| will invalidate the result. | 495 // Note: Any subsequent modification of |this| will invalidate the result. |
498 const FX_WCHAR* c_str() const { return m_pData ? m_pData->m_String : L""; } | 496 const FX_WCHAR* c_str() const { return m_pData ? m_pData->m_String : L""; } |
499 | 497 |
500 // Explicit conversion to CFX_WideStringC. | 498 // Explicit conversion to CFX_WideStringC. |
501 // Note: Any subsequent modification of |this| will invalidate the result. | 499 // Note: Any subsequent modification of |this| will invalidate the result. |
502 CFX_WideStringC AsStringC() const { | 500 CFX_WideStringC AsStringC() const { |
503 return CFX_WideStringC(c_str(), GetLength()); | 501 return CFX_WideStringC(c_str(), GetLength()); |
504 } | 502 } |
505 | 503 |
506 // Deprecated -- use clear(). | |
507 void Empty() { m_pData.Reset(); } | |
508 void clear() { m_pData.Reset(); } | 504 void clear() { m_pData.Reset(); } |
509 | 505 |
510 FX_STRSIZE GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; } | 506 FX_STRSIZE GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; } |
511 bool IsEmpty() const { return !GetLength(); } | 507 bool IsEmpty() const { return !GetLength(); } |
512 | 508 |
513 const CFX_WideString& operator=(const FX_WCHAR* str); | 509 const CFX_WideString& operator=(const FX_WCHAR* str); |
514 const CFX_WideString& operator=(const CFX_WideString& stringSrc); | 510 const CFX_WideString& operator=(const CFX_WideString& stringSrc); |
515 const CFX_WideString& operator=(const CFX_WideStringC& stringSrc); | 511 const CFX_WideString& operator=(const CFX_WideStringC& stringSrc); |
516 | 512 |
517 const CFX_WideString& operator+=(const FX_WCHAR* str); | 513 const CFX_WideString& operator+=(const FX_WCHAR* str); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 } | 670 } |
675 | 671 |
676 FX_FLOAT FX_atof(const CFX_ByteStringC& str); | 672 FX_FLOAT FX_atof(const CFX_ByteStringC& str); |
677 inline FX_FLOAT FX_atof(const CFX_WideStringC& wsStr) { | 673 inline FX_FLOAT FX_atof(const CFX_WideStringC& wsStr) { |
678 return FX_atof(FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength()).c_str()); | 674 return FX_atof(FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength()).c_str()); |
679 } | 675 } |
680 void FX_atonum(const CFX_ByteStringC& str, FX_BOOL& bInteger, void* pData); | 676 void FX_atonum(const CFX_ByteStringC& str, FX_BOOL& bInteger, void* pData); |
681 FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf); | 677 FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf); |
682 | 678 |
683 #endif // CORE_FXCRT_INCLUDE_FX_STRING_H_ | 679 #endif // CORE_FXCRT_INCLUDE_FX_STRING_H_ |
OLD | NEW |