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

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

Issue 2227903002: String::contains should use StringView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 StringImpl* impl() const { return m_string.impl(); } 67 StringImpl* impl() const { return m_string.impl(); }
68 68
69 bool is8Bit() const { return m_string.is8Bit(); } 69 bool is8Bit() const { return m_string.is8Bit(); }
70 const LChar* characters8() const { return m_string.characters8(); } 70 const LChar* characters8() const { return m_string.characters8(); }
71 const UChar* characters16() const { return m_string.characters16(); } 71 const UChar* characters16() const { return m_string.characters16(); }
72 unsigned length() const { return m_string.length(); } 72 unsigned length() const { return m_string.length(); }
73 73
74 UChar operator[](unsigned i) const { return m_string[i]; } 74 UChar operator[](unsigned i) const { return m_string[i]; }
75 75
76 bool contains(UChar c) const { return m_string.contains(c); }
77 bool contains(const LChar* s, TextCaseSensitivity caseSensitivity = TextCase Sensitive) const
78 { return m_string.contains(s, caseSensitivity); }
79 bool contains(const String& s, TextCaseSensitivity caseSensitivity = TextCas eSensitive) const
80 { return m_string.contains(s, caseSensitivity); }
81
82 // Find characters. 76 // Find characters.
83 size_t find(UChar c, unsigned start = 0) const 77 size_t find(UChar c, unsigned start = 0) const
84 { return m_string.find(c, start); } 78 { return m_string.find(c, start); }
85 size_t find(LChar c, unsigned start = 0) const 79 size_t find(LChar c, unsigned start = 0) const
86 { return m_string.find(c, start); } 80 { return m_string.find(c, start); }
87 size_t find(char c, unsigned start = 0) const { return find(static_cast<LCha r>(c), start); } 81 size_t find(char c, unsigned start = 0) const { return find(static_cast<LCha r>(c), start); }
88 size_t find(CharacterMatchFunctionPtr matchFunction, unsigned start = 0) con st 82 size_t find(CharacterMatchFunctionPtr matchFunction, unsigned start = 0) con st
89 { return m_string.find(matchFunction, start); } 83 { return m_string.find(matchFunction, start); }
90 84
91 // Find substrings. 85 // Find substrings.
92 size_t find(const StringView& value, unsigned start = 0, TextCaseSensitivity caseSensitivity = TextCaseSensitive) const 86 size_t find(const StringView& value, unsigned start = 0, TextCaseSensitivity caseSensitivity = TextCaseSensitive) const
93 { return m_string.find(value, start, caseSensitivity); } 87 { return m_string.find(value, start, caseSensitivity); }
94 88
89 bool contains(char c) const { return find(c) != kNotFound; }
90 bool contains(const StringView& value, TextCaseSensitivity caseSensitivity = TextCaseSensitive) const
91 { return find(value, 0, caseSensitivity) != kNotFound; }
92
95 bool startsWith(const StringView& prefix, TextCaseSensitivity caseSensitivit y = TextCaseSensitive) const 93 bool startsWith(const StringView& prefix, TextCaseSensitivity caseSensitivit y = TextCaseSensitive) const
96 { return m_string.startsWith(prefix, caseSensitivity); } 94 { return m_string.startsWith(prefix, caseSensitivity); }
97 bool startsWith(UChar character) const 95 bool startsWith(UChar character) const
98 { return m_string.startsWith(character); } 96 { return m_string.startsWith(character); }
99 97
100 bool endsWith(const StringView& suffix, TextCaseSensitivity caseSensitivity = TextCaseSensitive) const 98 bool endsWith(const StringView& suffix, TextCaseSensitivity caseSensitivity = TextCaseSensitive) const
101 { return m_string.endsWith(suffix, caseSensitivity); } 99 { return m_string.endsWith(suffix, caseSensitivity); }
102 bool endsWith(UChar character) const 100 bool endsWith(UChar character) const
103 { return m_string.endsWith(character); } 101 { return m_string.endsWith(character); }
104 102
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 using WTF::AtomicString; 207 using WTF::AtomicString;
210 using WTF::nullAtom; 208 using WTF::nullAtom;
211 using WTF::emptyAtom; 209 using WTF::emptyAtom;
212 using WTF::starAtom; 210 using WTF::starAtom;
213 using WTF::xmlAtom; 211 using WTF::xmlAtom;
214 using WTF::xmlnsAtom; 212 using WTF::xmlnsAtom;
215 using WTF::xlinkAtom; 213 using WTF::xlinkAtom;
216 214
217 #include "wtf/text/StringConcatenate.h" 215 #include "wtf/text/StringConcatenate.h"
218 #endif // AtomicString_h 216 #endif // AtomicString_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698