| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 void Empty() { m_pData.Reset(); } | 163 void Empty() { m_pData.Reset(); } |
| 164 void clear() { m_pData.Reset(); } | 164 void clear() { m_pData.Reset(); } |
| 165 | 165 |
| 166 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); |
| 167 static CFX_ByteString FromUnicode(const CFX_WideString& str); | 167 static CFX_ByteString FromUnicode(const CFX_WideString& str); |
| 168 | 168 |
| 169 // Explicit conversion to C-style string. | 169 // Explicit conversion to C-style string. |
| 170 // Note: Any subsequent modification of |this| will invalidate the result. | 170 // Note: Any subsequent modification of |this| will invalidate the result. |
| 171 const FX_CHAR* c_str() const { return m_pData ? m_pData->m_String : ""; } | 171 const FX_CHAR* c_str() const { return m_pData ? m_pData->m_String : ""; } |
| 172 | 172 |
| 173 // Implicit conversion to C-style string -- deprecated. | |
| 174 operator const FX_CHAR*() const { return m_pData ? m_pData->m_String : ""; } | |
| 175 | |
| 176 // Explicit conversion to uint8_t*. | 173 // Explicit conversion to uint8_t*. |
| 177 // Note: Any subsequent modification of |this| will invalidate the result. | 174 // Note: Any subsequent modification of |this| will invalidate the result. |
| 178 const uint8_t* raw_str() const { | 175 const uint8_t* raw_str() const { |
| 179 return m_pData ? reinterpret_cast<const uint8_t*>(m_pData->m_String) | 176 return m_pData ? reinterpret_cast<const uint8_t*>(m_pData->m_String) |
| 180 : nullptr; | 177 : nullptr; |
| 181 } | 178 } |
| 182 | 179 |
| 183 // Explicit conversion to CFX_ByteStringC. | 180 // Explicit conversion to CFX_ByteStringC. |
| 184 // Note: Any subsequent modification of |this| will invalidate the result. | 181 // Note: Any subsequent modification of |this| will invalidate the result. |
| 185 CFX_ByteStringC AsStringC() const { | 182 CFX_ByteStringC AsStringC() const { |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 } | 678 } |
| 682 | 679 |
| 683 FX_FLOAT FX_atof(const CFX_ByteStringC& str); | 680 FX_FLOAT FX_atof(const CFX_ByteStringC& str); |
| 684 inline FX_FLOAT FX_atof(const CFX_WideStringC& wsStr) { | 681 inline FX_FLOAT FX_atof(const CFX_WideStringC& wsStr) { |
| 685 return FX_atof(FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength()).c_str()); | 682 return FX_atof(FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength()).c_str()); |
| 686 } | 683 } |
| 687 void FX_atonum(const CFX_ByteStringC& str, FX_BOOL& bInteger, void* pData); | 684 void FX_atonum(const CFX_ByteStringC& str, FX_BOOL& bInteger, void* pData); |
| 688 FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf); | 685 FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf); |
| 689 | 686 |
| 690 #endif // CORE_FXCRT_INCLUDE_FX_STRING_H_ | 687 #endif // CORE_FXCRT_INCLUDE_FX_STRING_H_ |
| OLD | NEW |