Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: core/include/fxcrt/fx_string.h

Issue 860973002: Simplify UTF16LE_Encode and add unittest. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: tab Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « BUILD.gn ('k') | core/src/fxcrt/fx_basic_wstring.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 FX_STRSIZE Find(FX_LPCWSTR lpszSub, FX_STRSIZE star t = 0) const; 767 FX_STRSIZE Find(FX_LPCWSTR lpszSub, FX_STRSIZE star t = 0) const;
768 768
769 FX_STRSIZE Find(FX_WCHAR ch, FX_STRSIZE start = 0) const; 769 FX_STRSIZE Find(FX_WCHAR ch, FX_STRSIZE start = 0) const;
770 770
771 FX_STRSIZE Replace(FX_LPCWSTR lpszOld, FX_LPCWSTR l pszNew); 771 FX_STRSIZE Replace(FX_LPCWSTR lpszOld, FX_LPCWSTR l pszNew);
772 772
773 FX_STRSIZE Remove(FX_WCHAR ch); 773 FX_STRSIZE Remove(FX_WCHAR ch);
774 774
775 CFX_ByteString UTF8Encode() const; 775 CFX_ByteString UTF8Encode() const;
776 776
777 CFX_ByteString» » » UTF16LE_Encode(FX_BOOL bTerminate = TRUE ) const; 777 CFX_ByteString» » » UTF16LE_Encode() const;
778 778
779 void ConvertFrom(const CFX_ByteString & str, CFX_CharMap* pCharMap = NULL); 779 void ConvertFrom(const CFX_ByteString & str, CFX_CharMap* pCharMap = NULL);
780 protected: 780 protected:
781 void InitStr(FX_LPCWSTR ptr, int len) ; 781 void InitStr(FX_LPCWSTR ptr, int len) ;
782 782
783 CFX_StringDataW* m_pData; 783 CFX_StringDataW* m_pData;
784 void CopyBeforeWrite(); 784 void CopyBeforeWrite();
785 void AllocBeforeWrite(FX_STRSIZE nLen ); 785 void AllocBeforeWrite(FX_STRSIZE nLen );
786 void ConcatInPlace(FX_STRSIZE nSrcLen , FX_LPCWSTR lpszSrcData); 786 void ConcatInPlace(FX_STRSIZE nSrcLen , FX_LPCWSTR lpszSrcData);
787 void ConcatCopy(FX_STRSIZE nSrc1Len, FX_LPCWSTR lpszSrc1Data, FX_STRSIZE nSrc2Len, FX_LPCWSTR lpszSrc2Data); 787 void ConcatCopy(FX_STRSIZE nSrc1Len, FX_LPCWSTR lpszSrc1Data, FX_STRSIZE nSrc2Len, FX_LPCWSTR lpszSrc2Data);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 CFX_ByteString FX_UTF8Encode(FX_LPCWSTR pwsStr, FX_STRSIZE len); 865 CFX_ByteString FX_UTF8Encode(FX_LPCWSTR pwsStr, FX_STRSIZE len);
866 inline CFX_ByteString FX_UTF8Encode(FX_WSTR wsStr) 866 inline CFX_ByteString FX_UTF8Encode(FX_WSTR wsStr)
867 { 867 {
868 return FX_UTF8Encode(wsStr.GetPtr(), wsStr.GetLength()); 868 return FX_UTF8Encode(wsStr.GetPtr(), wsStr.GetLength());
869 } 869 }
870 inline CFX_ByteString FX_UTF8Encode(const CFX_WideString &wsStr) 870 inline CFX_ByteString FX_UTF8Encode(const CFX_WideString &wsStr)
871 { 871 {
872 return FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength()); 872 return FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength());
873 } 873 }
874 #endif 874 #endif
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | core/src/fxcrt/fx_basic_wstring.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698