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 class CFX_ByteStringC; | 9 class CFX_ByteStringC; |
10 class CFX_ByteString; | 10 class CFX_ByteString; |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 CFX_ByteString(FX_BSTR bstrc); | 177 CFX_ByteString(FX_BSTR bstrc); |
178 | 178 |
179 CFX_ByteString(FX_BSTR bstrc1, FX_BSTR bstrc2); | 179 CFX_ByteString(FX_BSTR bstrc1, FX_BSTR bstrc2); |
180 | 180 |
181 ~CFX_ByteString(); | 181 ~CFX_ByteString(); |
182 | 182 |
183 static CFX_ByteString FromUnicode(FX_LPCWSTR ptr, FX_STRSIZE len = -1)
; | 183 static CFX_ByteString FromUnicode(FX_LPCWSTR ptr, FX_STRSIZE len = -1)
; |
184 | 184 |
185 static CFX_ByteString FromUnicode(const CFX_WideString& str); | 185 static CFX_ByteString FromUnicode(const CFX_WideString& str); |
186 | 186 |
| 187 // Explicit conversion to raw string |
| 188 FX_LPCSTR c_str() const |
| 189 { |
| 190 return m_pData ? m_pData->m_String : ""; |
| 191 } |
| 192 |
| 193 // Implicit conversion to C-style string -- deprecated |
187 operator FX_LPCSTR() const | 194 operator FX_LPCSTR() const |
188 { | 195 { |
189 return m_pData ? m_pData->m_String : ""; | 196 return m_pData ? m_pData->m_String : ""; |
190 } | 197 } |
191 | 198 |
192 operator FX_LPCBYTE() const | 199 operator FX_LPCBYTE() const |
193 { | 200 { |
194 return m_pData ? (FX_LPCBYTE)m_pData->m_String : NULL; | 201 return m_pData ? (FX_LPCBYTE)m_pData->m_String : NULL; |
195 } | 202 } |
196 | 203 |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 CFX_ByteString FX_UTF8Encode(FX_LPCWSTR pwsStr, FX_STRSIZE len); | 851 CFX_ByteString FX_UTF8Encode(FX_LPCWSTR pwsStr, FX_STRSIZE len); |
845 inline CFX_ByteString FX_UTF8Encode(FX_WSTR wsStr) | 852 inline CFX_ByteString FX_UTF8Encode(FX_WSTR wsStr) |
846 { | 853 { |
847 return FX_UTF8Encode(wsStr.GetPtr(), wsStr.GetLength()); | 854 return FX_UTF8Encode(wsStr.GetPtr(), wsStr.GetLength()); |
848 } | 855 } |
849 inline CFX_ByteString FX_UTF8Encode(const CFX_WideString &wsStr) | 856 inline CFX_ByteString FX_UTF8Encode(const CFX_WideString &wsStr) |
850 { | 857 { |
851 return FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength()); | 858 return FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength()); |
852 } | 859 } |
853 #endif | 860 #endif |
OLD | NEW |