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 |
199 | |
Tom Sepez
2014/12/30 22:53:26
nit: extra blank line.
| |
192 operator FX_LPCBYTE() const | 200 operator FX_LPCBYTE() const |
193 { | 201 { |
194 return m_pData ? (FX_LPCBYTE)m_pData->m_String : NULL; | 202 return m_pData ? (FX_LPCBYTE)m_pData->m_String : NULL; |
195 } | 203 } |
196 | 204 |
197 FX_STRSIZE GetLength() const | 205 FX_STRSIZE GetLength() const |
198 { | 206 { |
199 return m_pData ? m_pData->m_nDataLength : 0; | 207 return m_pData ? m_pData->m_nDataLength : 0; |
200 } | 208 } |
201 | 209 |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
844 CFX_ByteString FX_UTF8Encode(FX_LPCWSTR pwsStr, FX_STRSIZE len); | 852 CFX_ByteString FX_UTF8Encode(FX_LPCWSTR pwsStr, FX_STRSIZE len); |
845 inline CFX_ByteString FX_UTF8Encode(FX_WSTR wsStr) | 853 inline CFX_ByteString FX_UTF8Encode(FX_WSTR wsStr) |
846 { | 854 { |
847 return FX_UTF8Encode(wsStr.GetPtr(), wsStr.GetLength()); | 855 return FX_UTF8Encode(wsStr.GetPtr(), wsStr.GetLength()); |
848 } | 856 } |
849 inline CFX_ByteString FX_UTF8Encode(const CFX_WideString &wsStr) | 857 inline CFX_ByteString FX_UTF8Encode(const CFX_WideString &wsStr) |
850 { | 858 { |
851 return FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength()); | 859 return FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength()); |
852 } | 860 } |
853 #endif | 861 #endif |
OLD | NEW |