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

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

Issue 2230643002: Use StringView for String::findIgnoringCase and findIgnoringASCIICase. (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
« no previous file with comments | « third_party/WebKit/Source/wtf/text/AtomicString.h ('k') | no next file » | 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 * (C) 1999 Lars Knoll (knoll@kde.org) 2 * (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 size_t find(LChar c, unsigned start = 0) const 175 size_t find(LChar c, unsigned start = 0) const
176 { return m_impl ? m_impl->find(c, start) : kNotFound; } 176 { return m_impl ? m_impl->find(c, start) : kNotFound; }
177 size_t find(char c, unsigned start = 0) const { return find(static_cast<LCha r>(c), start); } 177 size_t find(char c, unsigned start = 0) const { return find(static_cast<LCha r>(c), start); }
178 size_t find(CharacterMatchFunctionPtr matchFunction, unsigned start = 0) con st 178 size_t find(CharacterMatchFunctionPtr matchFunction, unsigned start = 0) con st
179 { return m_impl ? m_impl->find(matchFunction, start) : kNotFound; } 179 { return m_impl ? m_impl->find(matchFunction, start) : kNotFound; }
180 180
181 // Find substrings. 181 // Find substrings.
182 size_t find(const StringView& value, unsigned start = 0, TextCaseSensitivity caseSensitivity = TextCaseSensitive) const 182 size_t find(const StringView& value, unsigned start = 0, TextCaseSensitivity caseSensitivity = TextCaseSensitive) const
183 { return m_impl ? DISPATCH_CASE_OP(caseSensitivity, m_impl->find, (value , start)) : kNotFound; } 183 { return m_impl ? DISPATCH_CASE_OP(caseSensitivity, m_impl->find, (value , start)) : kNotFound; }
184 184
185 // Unicode aware case insensitive string matching.
186 size_t findIgnoringCase(const StringView& value, unsigned start = 0) const
187 { return m_impl ? m_impl->findIgnoringCase(value, start) : kNotFound; }
188
189 // ASCII case insensitive string matching.
190 size_t findIgnoringASCIICase(const StringView& value, unsigned start = 0) co nst
191 { return m_impl ? m_impl->findIgnoringASCIICase(value, start) : kNotFoun d; }
192
185 bool contains(char c) const { return find(c) != kNotFound; } 193 bool contains(char c) const { return find(c) != kNotFound; }
186 bool contains(const StringView& value, TextCaseSensitivity caseSensitivity = TextCaseSensitive) const 194 bool contains(const StringView& value, TextCaseSensitivity caseSensitivity = TextCaseSensitive) const
187 { return find(value, 0, caseSensitivity) != kNotFound; } 195 { return find(value, 0, caseSensitivity) != kNotFound; }
188 196
189 // Find the last instance of a single character or string. 197 // Find the last instance of a single character or string.
190 size_t reverseFind(UChar c, unsigned start = UINT_MAX) const 198 size_t reverseFind(UChar c, unsigned start = UINT_MAX) const
191 { return m_impl ? m_impl->reverseFind(c, start) : kNotFound; } 199 { return m_impl ? m_impl->reverseFind(c, start) : kNotFound; }
192 size_t reverseFind(const String& str, unsigned start = UINT_MAX) const 200 size_t reverseFind(const String& str, unsigned start = UINT_MAX) const
193 { return m_impl ? m_impl->reverseFind(str.impl(), start) : kNotFound; } 201 { return m_impl ? m_impl->reverseFind(str.impl(), start) : kNotFound; }
194 202
195 // Case insensitive string matching.
196 size_t findIgnoringCase(const LChar* str, unsigned start = 0) const
197 { return m_impl ? m_impl->findIgnoringCase(str, start) : kNotFound; }
198 size_t findIgnoringCase(const String& str, unsigned start = 0) const
199 { return m_impl ? m_impl->findIgnoringCase(str.impl(), start) : kNotFoun d; }
200
201 // ASCII case insensitive string matching.
202 size_t findIgnoringASCIICase(const String& str, unsigned start = 0) const
203 { return m_impl ? m_impl->findIgnoringASCIICase(str.impl(), start) : kNo tFound; }
204
205 unsigned copyTo(UChar* buffer, unsigned pos, unsigned maxLength) const; 203 unsigned copyTo(UChar* buffer, unsigned pos, unsigned maxLength) const;
206 204
207 template<typename BufferType> 205 template<typename BufferType>
208 void appendTo(BufferType&, unsigned pos = 0, unsigned len = UINT_MAX) const; 206 void appendTo(BufferType&, unsigned pos = 0, unsigned len = UINT_MAX) const;
209 207
210 template<typename BufferType> 208 template<typename BufferType>
211 void prependTo(BufferType&, unsigned pos = 0, unsigned len = UINT_MAX) const ; 209 void prependTo(BufferType&, unsigned pos = 0, unsigned len = UINT_MAX) const ;
212 210
213 UChar32 characterStartingAt(unsigned) const; 211 UChar32 characterStartingAt(unsigned) const;
214 212
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 using WTF::append; 598 using WTF::append;
601 using WTF::charactersAreAllASCII; 599 using WTF::charactersAreAllASCII;
602 using WTF::equal; 600 using WTF::equal;
603 using WTF::find; 601 using WTF::find;
604 using WTF::isAllSpecialCharacters; 602 using WTF::isAllSpecialCharacters;
605 using WTF::isSpaceOrNewline; 603 using WTF::isSpaceOrNewline;
606 using WTF::reverseFind; 604 using WTF::reverseFind;
607 605
608 #include "wtf/text/AtomicString.h" 606 #include "wtf/text/AtomicString.h"
609 #endif // WTFString_h 607 #endif // WTFString_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/text/AtomicString.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698