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

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

Issue 1846083002: Remove CFX_{Byte,Wide}String::Equal in favor of "==". (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Nits. Created 4 years, 8 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 | « core/fxcrt/fx_basic_wstring.cpp ('k') | fpdfsdk/fpdfdoc.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 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 operator const uint8_t*() const { 187 operator const uint8_t*() const {
188 return m_pData ? reinterpret_cast<const uint8_t*>(m_pData->m_String) 188 return m_pData ? reinterpret_cast<const uint8_t*>(m_pData->m_String)
189 : nullptr; 189 : nullptr;
190 } 190 }
191 191
192 FX_STRSIZE GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; } 192 FX_STRSIZE GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; }
193 193
194 bool IsEmpty() const { return !GetLength(); } 194 bool IsEmpty() const { return !GetLength(); }
195 195
196 int Compare(const CFX_ByteStringC& str) const; 196 int Compare(const CFX_ByteStringC& str) const;
197
198 bool Equal(const char* ptr) const;
199 bool Equal(const CFX_ByteStringC& str) const;
200 bool Equal(const CFX_ByteString& other) const;
201
202 bool EqualNoCase(const CFX_ByteStringC& str) const; 197 bool EqualNoCase(const CFX_ByteStringC& str) const;
203 198
204 bool operator==(const char* ptr) const { return Equal(ptr); } 199 bool operator==(const char* ptr) const;
205 bool operator==(const CFX_ByteStringC& str) const { return Equal(str); } 200 bool operator==(const CFX_ByteStringC& str) const;
206 bool operator==(const CFX_ByteString& other) const { return Equal(other); } 201 bool operator==(const CFX_ByteString& other) const;
207 202
208 bool operator!=(const char* ptr) const { return !(*this == ptr); } 203 bool operator!=(const char* ptr) const { return !(*this == ptr); }
209 bool operator!=(const CFX_ByteStringC& str) const { return !(*this == str); } 204 bool operator!=(const CFX_ByteStringC& str) const { return !(*this == str); }
210 bool operator!=(const CFX_ByteString& other) const { 205 bool operator!=(const CFX_ByteString& other) const {
211 return !(*this == other); 206 return !(*this == other);
212 } 207 }
213 208
214 bool operator<(const CFX_ByteString& str) const { 209 bool operator<(const CFX_ByteString& str) const {
215 int result = FXSYS_memcmp(c_str(), str.c_str(), 210 int result = FXSYS_memcmp(c_str(), str.c_str(),
216 std::min(GetLength(), str.GetLength())); 211 std::min(GetLength(), str.GetLength()));
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 576
582 // Explicit conversion to C-style wide string. 577 // Explicit conversion to C-style wide string.
583 const FX_WCHAR* c_str() const { return m_pData ? m_pData->m_String : L""; } 578 const FX_WCHAR* c_str() const { return m_pData ? m_pData->m_String : L""; }
584 579
585 // Implicit conversion to C-style wide string -- deprecated. 580 // Implicit conversion to C-style wide string -- deprecated.
586 operator const FX_WCHAR*() const { return m_pData ? m_pData->m_String : L""; } 581 operator const FX_WCHAR*() const { return m_pData ? m_pData->m_String : L""; }
587 582
588 void Empty(); 583 void Empty();
589 584
590 bool IsEmpty() const { return !GetLength(); } 585 bool IsEmpty() const { return !GetLength(); }
591
592 FX_STRSIZE GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; } 586 FX_STRSIZE GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; }
593 587
594 const CFX_WideString& operator=(const FX_WCHAR* str); 588 const CFX_WideString& operator=(const FX_WCHAR* str);
595
596 const CFX_WideString& operator=(const CFX_WideString& stringSrc); 589 const CFX_WideString& operator=(const CFX_WideString& stringSrc);
597
598 const CFX_WideString& operator=(const CFX_WideStringC& stringSrc); 590 const CFX_WideString& operator=(const CFX_WideStringC& stringSrc);
599 591
600 const CFX_WideString& operator+=(const FX_WCHAR* str); 592 const CFX_WideString& operator+=(const FX_WCHAR* str);
601
602 const CFX_WideString& operator+=(FX_WCHAR ch); 593 const CFX_WideString& operator+=(FX_WCHAR ch);
603
604 const CFX_WideString& operator+=(const CFX_WideString& str); 594 const CFX_WideString& operator+=(const CFX_WideString& str);
605
606 const CFX_WideString& operator+=(const CFX_WideStringC& str); 595 const CFX_WideString& operator+=(const CFX_WideStringC& str);
607 596
608 bool operator==(const wchar_t* ptr) const { return Equal(ptr); } 597 bool operator==(const wchar_t* ptr) const;
609 bool operator==(const CFX_WideStringC& str) const { return Equal(str); } 598 bool operator==(const CFX_WideStringC& str) const;
610 bool operator==(const CFX_WideString& other) const { return Equal(other); } 599 bool operator==(const CFX_WideString& other) const;
611 600
612 bool operator!=(const wchar_t* ptr) const { return !(*this == ptr); } 601 bool operator!=(const wchar_t* ptr) const { return !(*this == ptr); }
613 bool operator!=(const CFX_WideStringC& str) const { return !(*this == str); } 602 bool operator!=(const CFX_WideStringC& str) const { return !(*this == str); }
614 bool operator!=(const CFX_WideString& other) const { 603 bool operator!=(const CFX_WideString& other) const {
615 return !(*this == other); 604 return !(*this == other);
616 } 605 }
617 606
618 bool operator<(const CFX_WideString& str) const { 607 bool operator<(const CFX_WideString& str) const {
619 int result = 608 int result =
620 wmemcmp(c_str(), str.c_str(), std::min(GetLength(), str.GetLength())); 609 wmemcmp(c_str(), str.c_str(), std::min(GetLength(), str.GetLength()));
621 return result < 0 || (result == 0 && GetLength() < str.GetLength()); 610 return result < 0 || (result == 0 && GetLength() < str.GetLength());
622 } 611 }
623 612
624 FX_WCHAR GetAt(FX_STRSIZE nIndex) const { 613 FX_WCHAR GetAt(FX_STRSIZE nIndex) const {
625 return m_pData ? m_pData->m_String[nIndex] : 0; 614 return m_pData ? m_pData->m_String[nIndex] : 0;
626 } 615 }
627 616
628 FX_WCHAR operator[](FX_STRSIZE nIndex) const { 617 FX_WCHAR operator[](FX_STRSIZE nIndex) const {
629 return m_pData ? m_pData->m_String[nIndex] : 0; 618 return m_pData ? m_pData->m_String[nIndex] : 0;
630 } 619 }
631 620
632 void SetAt(FX_STRSIZE nIndex, FX_WCHAR ch); 621 void SetAt(FX_STRSIZE nIndex, FX_WCHAR ch);
633 622
634 int Compare(const FX_WCHAR* str) const; 623 int Compare(const FX_WCHAR* str) const;
635
636 int Compare(const CFX_WideString& str) const; 624 int Compare(const CFX_WideString& str) const;
637
638 int CompareNoCase(const FX_WCHAR* str) const; 625 int CompareNoCase(const FX_WCHAR* str) const;
639 626
640 bool Equal(const wchar_t* ptr) const;
641 bool Equal(const CFX_WideStringC& str) const;
642 bool Equal(const CFX_WideString& other) const;
643 627
644 CFX_WideString Mid(FX_STRSIZE first) const; 628 CFX_WideString Mid(FX_STRSIZE first) const;
645
646 CFX_WideString Mid(FX_STRSIZE first, FX_STRSIZE count) const; 629 CFX_WideString Mid(FX_STRSIZE first, FX_STRSIZE count) const;
647
648 CFX_WideString Left(FX_STRSIZE count) const; 630 CFX_WideString Left(FX_STRSIZE count) const;
649
650 CFX_WideString Right(FX_STRSIZE count) const; 631 CFX_WideString Right(FX_STRSIZE count) const;
651 632
652 FX_STRSIZE Insert(FX_STRSIZE index, FX_WCHAR ch); 633 FX_STRSIZE Insert(FX_STRSIZE index, FX_WCHAR ch);
653
654 FX_STRSIZE Delete(FX_STRSIZE index, FX_STRSIZE count = 1); 634 FX_STRSIZE Delete(FX_STRSIZE index, FX_STRSIZE count = 1);
655 635
656 void Format(const FX_WCHAR* lpszFormat, ...); 636 void Format(const FX_WCHAR* lpszFormat, ...);
657
658 void FormatV(const FX_WCHAR* lpszFormat, va_list argList); 637 void FormatV(const FX_WCHAR* lpszFormat, va_list argList);
659 638
660 void MakeLower(); 639 void MakeLower();
661
662 void MakeUpper(); 640 void MakeUpper();
663 641
664 void TrimRight(); 642 void TrimRight();
665
666 void TrimRight(FX_WCHAR chTarget); 643 void TrimRight(FX_WCHAR chTarget);
667
668 void TrimRight(const FX_WCHAR* lpszTargets); 644 void TrimRight(const FX_WCHAR* lpszTargets);
669 645
670 void TrimLeft(); 646 void TrimLeft();
671
672 void TrimLeft(FX_WCHAR chTarget); 647 void TrimLeft(FX_WCHAR chTarget);
673
674 void TrimLeft(const FX_WCHAR* lpszTargets); 648 void TrimLeft(const FX_WCHAR* lpszTargets);
675 649
676 void Reserve(FX_STRSIZE len); 650 void Reserve(FX_STRSIZE len);
677
678 FX_WCHAR* GetBuffer(FX_STRSIZE len); 651 FX_WCHAR* GetBuffer(FX_STRSIZE len);
679
680 void ReleaseBuffer(FX_STRSIZE len = -1); 652 void ReleaseBuffer(FX_STRSIZE len = -1);
681 653
682 int GetInteger() const; 654 int GetInteger() const;
683 655
684 FX_FLOAT GetFloat() const; 656 FX_FLOAT GetFloat() const;
685 657
686 FX_STRSIZE Find(const FX_WCHAR* lpszSub, FX_STRSIZE start = 0) const; 658 FX_STRSIZE Find(const FX_WCHAR* lpszSub, FX_STRSIZE start = 0) const;
687 659
688 FX_STRSIZE Find(FX_WCHAR ch, FX_STRSIZE start = 0) const; 660 FX_STRSIZE Find(FX_WCHAR ch, FX_STRSIZE start = 0) const;
689 661
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 } 784 }
813 785
814 FX_FLOAT FX_atof(const CFX_ByteStringC& str); 786 FX_FLOAT FX_atof(const CFX_ByteStringC& str);
815 inline FX_FLOAT FX_atof(const CFX_WideStringC& wsStr) { 787 inline FX_FLOAT FX_atof(const CFX_WideStringC& wsStr) {
816 return FX_atof(FX_UTF8Encode(wsStr.GetPtr(), wsStr.GetLength())); 788 return FX_atof(FX_UTF8Encode(wsStr.GetPtr(), wsStr.GetLength()));
817 } 789 }
818 void FX_atonum(const CFX_ByteStringC& str, FX_BOOL& bInteger, void* pData); 790 void FX_atonum(const CFX_ByteStringC& str, FX_BOOL& bInteger, void* pData);
819 FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf); 791 FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf);
820 792
821 #endif // CORE_FXCRT_INCLUDE_FX_STRING_H_ 793 #endif // CORE_FXCRT_INCLUDE_FX_STRING_H_
OLDNEW
« no previous file with comments | « core/fxcrt/fx_basic_wstring.cpp ('k') | fpdfsdk/fpdfdoc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698