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

Side by Side Diff: third_party/WebKit/Source/wtf/text/StringImpl.h

Issue 2149463002: Remove unused StringImpl::findNextLineStart, StringImpl::count and reverseFindLineTerminator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | « no previous file | third_party/WebKit/Source/wtf/text/StringImpl.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 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights reserved.
4 * Copyright (C) 2009 Google Inc. All rights reserved. 4 * Copyright (C) 2009 Google Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 size_t find(CharacterMatchFunctionPtr, unsigned index = 0); 372 size_t find(CharacterMatchFunctionPtr, unsigned index = 0);
373 size_t find(const LChar*, unsigned index = 0); 373 size_t find(const LChar*, unsigned index = 0);
374 ALWAYS_INLINE size_t find(const char* s, unsigned index = 0) { return find(r einterpret_cast<const LChar*>(s), index); } 374 ALWAYS_INLINE size_t find(const char* s, unsigned index = 0) { return find(r einterpret_cast<const LChar*>(s), index); }
375 size_t find(StringImpl*); 375 size_t find(StringImpl*);
376 size_t find(StringImpl*, unsigned index); 376 size_t find(StringImpl*, unsigned index);
377 size_t findIgnoringCase(const LChar*, unsigned index = 0); 377 size_t findIgnoringCase(const LChar*, unsigned index = 0);
378 ALWAYS_INLINE size_t findIgnoringCase(const char* s, unsigned index = 0) { r eturn findIgnoringCase(reinterpret_cast<const LChar*>(s), index); } 378 ALWAYS_INLINE size_t findIgnoringCase(const char* s, unsigned index = 0) { r eturn findIgnoringCase(reinterpret_cast<const LChar*>(s), index); }
379 size_t findIgnoringCase(StringImpl*, unsigned index = 0); 379 size_t findIgnoringCase(StringImpl*, unsigned index = 0);
380 size_t findIgnoringASCIICase(StringImpl*, unsigned index = 0); 380 size_t findIgnoringASCIICase(StringImpl*, unsigned index = 0);
381 381
382 size_t findNextLineStart(unsigned index = UINT_MAX);
383
384 size_t reverseFind(UChar, unsigned index = UINT_MAX); 382 size_t reverseFind(UChar, unsigned index = UINT_MAX);
385 size_t reverseFind(StringImpl*, unsigned index = UINT_MAX); 383 size_t reverseFind(StringImpl*, unsigned index = UINT_MAX);
386 384
387 size_t count(LChar) const;
388
389 bool startsWith(UChar) const; 385 bool startsWith(UChar) const;
390 bool startsWith(const char*, unsigned prefixLength) const; 386 bool startsWith(const char*, unsigned prefixLength) const;
391 bool startsWith(const StringImpl*) const; 387 bool startsWith(const StringImpl*) const;
392 bool startsWithIgnoringCase(const char*, unsigned prefixLength) const; 388 bool startsWithIgnoringCase(const char*, unsigned prefixLength) const;
393 bool startsWithIgnoringCase(const StringImpl*) const; 389 bool startsWithIgnoringCase(const StringImpl*) const;
394 bool startsWithIgnoringASCIICase(const char*, unsigned prefixLength) const; 390 bool startsWithIgnoringASCIICase(const char*, unsigned prefixLength) const;
395 bool startsWithIgnoringASCIICase(const StringImpl*) const; 391 bool startsWithIgnoringASCIICase(const StringImpl*) const;
396 392
397 bool endsWith(UChar) const; 393 bool endsWith(UChar) const;
398 bool endsWith(const char*, unsigned suffixLength) const; 394 bool endsWith(const char*, unsigned suffixLength) const;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 { 575 {
580 while (index < length) { 576 while (index < length) {
581 if (matchFunction(characters[index])) 577 if (matchFunction(characters[index]))
582 return index; 578 return index;
583 ++index; 579 ++index;
584 } 580 }
585 return kNotFound; 581 return kNotFound;
586 } 582 }
587 583
588 template<typename CharacterType> 584 template<typename CharacterType>
589 inline size_t findNextLineStart(const CharacterType* characters, unsigned length , unsigned index = 0)
590 {
591 while (index < length) {
592 CharacterType c = characters[index++];
593 if ((c != '\n') && (c != '\r'))
594 continue;
595
596 // There can only be a start of a new line if there are more characters
597 // beyond the current character.
598 if (index < length) {
599 // The 3 common types of line terminators are 1. \r\n (Windows),
600 // 2. \r (old MacOS) and 3. \n (Unix'es).
601
602 if (c == '\n')
603 return index; // Case 3: just \n.
604
605 CharacterType c2 = characters[index];
606 if (c2 != '\n')
607 return index; // Case 2: just \r.
608
609 // Case 1: \r\n.
610 // But, there's only a start of a new line if there are more
611 // characters beyond the \r\n.
612 if (++index < length)
613 return index;
614 }
615 }
616 return kNotFound;
617 }
618
619 template<typename CharacterType>
620 inline size_t reverseFindLineTerminator(const CharacterType* characters, unsigne d length, unsigned index = UINT_MAX)
621 {
622 if (!length)
623 return kNotFound;
624 if (index >= length)
625 index = length - 1;
626 CharacterType c = characters[index];
627 while ((c != '\n') && (c != '\r')) {
628 if (!index--)
629 return kNotFound;
630 c = characters[index];
631 }
632 return index;
633 }
634
635 template<typename CharacterType>
636 inline size_t reverseFind(const CharacterType* characters, unsigned length, Char acterType matchCharacter, unsigned index = UINT_MAX) 585 inline size_t reverseFind(const CharacterType* characters, unsigned length, Char acterType matchCharacter, unsigned index = UINT_MAX)
637 { 586 {
638 if (!length) 587 if (!length)
639 return kNotFound; 588 return kNotFound;
640 if (index >= length) 589 if (index >= length)
641 index = length - 1; 590 index = length - 1;
642 while (characters[index] != matchCharacter) { 591 while (characters[index] != matchCharacter) {
643 if (!index--) 592 if (!index--)
644 return kNotFound; 593 return kNotFound;
645 } 594 }
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 735
787 using WTF::StringImpl; 736 using WTF::StringImpl;
788 using WTF::equal; 737 using WTF::equal;
789 using WTF::equalNonNull; 738 using WTF::equalNonNull;
790 using WTF::TextCaseSensitivity; 739 using WTF::TextCaseSensitivity;
791 using WTF::TextCaseSensitive; 740 using WTF::TextCaseSensitive;
792 using WTF::TextCaseASCIIInsensitive; 741 using WTF::TextCaseASCIIInsensitive;
793 using WTF::TextCaseInsensitive; 742 using WTF::TextCaseInsensitive;
794 743
795 #endif 744 #endif
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/wtf/text/StringImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698