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 <stdint.h> // For intptr_t. | 10 #include <stdint.h> // For intptr_t. |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 }; | 382 }; |
383 | 383 |
384 void AllocCopy(CFX_ByteString& dest,
FX_STRSIZE nCopyLen, FX_STRSIZE nCopyIndex) const; | 384 void AllocCopy(CFX_ByteString& dest,
FX_STRSIZE nCopyLen, FX_STRSIZE nCopyIndex) const; |
385 void AssignCopy(FX_STRSIZE nSrcLen, F
X_LPCSTR lpszSrcData); | 385 void AssignCopy(FX_STRSIZE nSrcLen, F
X_LPCSTR lpszSrcData); |
386 void ConcatCopy(FX_STRSIZE nSrc1Len,
FX_LPCSTR lpszSrc1Data, FX_STRSIZE nSrc2Len, FX_LPCSTR lpszSrc2Data); | 386 void ConcatCopy(FX_STRSIZE nSrc1Len,
FX_LPCSTR lpszSrc1Data, FX_STRSIZE nSrc2Len, FX_LPCSTR lpszSrc2Data); |
387 void ConcatInPlace(FX_STRSIZE nSrcLen
, FX_LPCSTR lpszSrcData); | 387 void ConcatInPlace(FX_STRSIZE nSrcLen
, FX_LPCSTR lpszSrcData); |
388 void CopyBeforeWrite(); | 388 void CopyBeforeWrite(); |
389 void AllocBeforeWrite(FX_STRSIZE nLen
); | 389 void AllocBeforeWrite(FX_STRSIZE nLen
); |
390 | 390 |
391 StringData* m_pData; | 391 StringData* m_pData; |
| 392 friend class fxcrt_ByteStringConcatInPlace_Test; |
392 }; | 393 }; |
393 inline CFX_ByteStringC::CFX_ByteStringC(const CFX_ByteString& src) | 394 inline CFX_ByteStringC::CFX_ByteStringC(const CFX_ByteString& src) |
394 { | 395 { |
395 m_Ptr = (FX_LPCBYTE)src; | 396 m_Ptr = (FX_LPCBYTE)src; |
396 m_Length = src.GetLength(); | 397 m_Length = src.GetLength(); |
397 } | 398 } |
398 inline CFX_ByteStringC& CFX_ByteStringC::operator = (const CFX_ByteString& src) | 399 inline CFX_ByteStringC& CFX_ByteStringC::operator = (const CFX_ByteString& src) |
399 { | 400 { |
400 m_Ptr = (FX_LPCBYTE)src; | 401 m_Ptr = (FX_LPCBYTE)src; |
401 m_Length = src.GetLength(); | 402 m_Length = src.GetLength(); |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 }; | 809 }; |
809 | 810 |
810 void CopyBeforeWrite(); | 811 void CopyBeforeWrite(); |
811 void AllocBeforeWrite(FX_STRSIZE nLen); | 812 void AllocBeforeWrite(FX_STRSIZE nLen); |
812 void ConcatInPlace(FX_STRSIZE nSrcLen, FX_LPCWSTR lpszSrc
Data); | 813 void ConcatInPlace(FX_STRSIZE nSrcLen, FX_LPCWSTR lpszSrc
Data); |
813 void ConcatCopy(FX_STRSIZE nSrc1Len, FX_LPCWSTR lpszSrc1D
ata, FX_STRSIZE nSrc2Len, FX_LPCWSTR lpszSrc2Data); | 814 void ConcatCopy(FX_STRSIZE nSrc1Len, FX_LPCWSTR lpszSrc1D
ata, FX_STRSIZE nSrc2Len, FX_LPCWSTR lpszSrc2Data); |
814 void AssignCopy(FX_STRSIZE nSrcLen, FX_LPCWSTR lpszSrcDat
a); | 815 void AssignCopy(FX_STRSIZE nSrcLen, FX_LPCWSTR lpszSrcDat
a); |
815 void AllocCopy(CFX_WideString& dest, FX_STRSIZE nCopyLen,
FX_STRSIZE nCopyIndex) const; | 816 void AllocCopy(CFX_WideString& dest, FX_STRSIZE nCopyLen,
FX_STRSIZE nCopyIndex) const; |
816 | 817 |
817 StringData* m_pData; | 818 StringData* m_pData; |
| 819 friend class fxcrt_WideStringConcatInPlace_Test; |
818 }; | 820 }; |
819 inline CFX_WideStringC::CFX_WideStringC(const CFX_WideString& src) | 821 inline CFX_WideStringC::CFX_WideStringC(const CFX_WideString& src) |
820 { | 822 { |
821 m_Ptr = src.c_str(); | 823 m_Ptr = src.c_str(); |
822 m_Length = src.GetLength(); | 824 m_Length = src.GetLength(); |
823 } | 825 } |
824 inline CFX_WideStringC& CFX_WideStringC::operator = (const CFX_WideString& src) | 826 inline CFX_WideStringC& CFX_WideStringC::operator = (const CFX_WideString& src) |
825 { | 827 { |
826 m_Ptr = src.c_str(); | 828 m_Ptr = src.c_str(); |
827 m_Length = src.GetLength(); | 829 m_Length = src.GetLength(); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 CFX_ByteString FX_UTF8Encode(FX_LPCWSTR pwsStr, FX_STRSIZE len); | 896 CFX_ByteString FX_UTF8Encode(FX_LPCWSTR pwsStr, FX_STRSIZE len); |
895 inline CFX_ByteString FX_UTF8Encode(FX_WSTR wsStr) | 897 inline CFX_ByteString FX_UTF8Encode(FX_WSTR wsStr) |
896 { | 898 { |
897 return FX_UTF8Encode(wsStr.GetPtr(), wsStr.GetLength()); | 899 return FX_UTF8Encode(wsStr.GetPtr(), wsStr.GetLength()); |
898 } | 900 } |
899 inline CFX_ByteString FX_UTF8Encode(const CFX_WideString &wsStr) | 901 inline CFX_ByteString FX_UTF8Encode(const CFX_WideString &wsStr) |
900 { | 902 { |
901 return FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength()); | 903 return FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength()); |
902 } | 904 } |
903 #endif | 905 #endif |
OLD | NEW |