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: Source/wtf/text/WTFString.h

Issue 23464095: WTF::notFound looks too much like a local variable. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « Source/wtf/text/TextPosition.cpp ('k') | Source/wtf/text/WTFString.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 * (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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 static String number(unsigned long long); 207 static String number(unsigned long long);
208 208
209 static String number(double, unsigned precision = 6, TrailingZerosTruncating Policy = TruncateTrailingZeros); 209 static String number(double, unsigned precision = 6, TrailingZerosTruncating Policy = TruncateTrailingZeros);
210 210
211 // Number to String conversion following the ECMAScript definition. 211 // Number to String conversion following the ECMAScript definition.
212 static String numberToStringECMAScript(double); 212 static String numberToStringECMAScript(double);
213 static String numberToStringFixedWidth(double, unsigned decimalPlaces); 213 static String numberToStringFixedWidth(double, unsigned decimalPlaces);
214 214
215 // Find a single character or string, also with match function & latin1 form s. 215 // Find a single character or string, also with match function & latin1 form s.
216 size_t find(UChar c, unsigned start = 0) const 216 size_t find(UChar c, unsigned start = 0) const
217 { return m_impl ? m_impl->find(c, start) : notFound; } 217 { return m_impl ? m_impl->find(c, start) : kNotFound; }
218 218
219 size_t find(const String& str) const 219 size_t find(const String& str) const
220 { return m_impl ? m_impl->find(str.impl()) : notFound; } 220 { return m_impl ? m_impl->find(str.impl()) : kNotFound; }
221 size_t find(const String& str, unsigned start) const 221 size_t find(const String& str, unsigned start) const
222 { return m_impl ? m_impl->find(str.impl(), start) : notFound; } 222 { return m_impl ? m_impl->find(str.impl(), start) : kNotFound; }
223 223
224 size_t find(CharacterMatchFunctionPtr matchFunction, unsigned start = 0) con st 224 size_t find(CharacterMatchFunctionPtr matchFunction, unsigned start = 0) con st
225 { return m_impl ? m_impl->find(matchFunction, start) : notFound; } 225 { return m_impl ? m_impl->find(matchFunction, start) : kNotFound; }
226 size_t find(const LChar* str, unsigned start = 0) const 226 size_t find(const LChar* str, unsigned start = 0) const
227 { return m_impl ? m_impl->find(str, start) : notFound; } 227 { return m_impl ? m_impl->find(str, start) : kNotFound; }
228 228
229 size_t findNextLineStart(unsigned start = 0) const 229 size_t findNextLineStart(unsigned start = 0) const
230 { return m_impl ? m_impl->findNextLineStart(start) : notFound; } 230 { return m_impl ? m_impl->findNextLineStart(start) : kNotFound; }
231 231
232 // Find the last instance of a single character or string. 232 // Find the last instance of a single character or string.
233 size_t reverseFind(UChar c, unsigned start = UINT_MAX) const 233 size_t reverseFind(UChar c, unsigned start = UINT_MAX) const
234 { return m_impl ? m_impl->reverseFind(c, start) : notFound; } 234 { return m_impl ? m_impl->reverseFind(c, start) : kNotFound; }
235 size_t reverseFind(const String& str, unsigned start = UINT_MAX) const 235 size_t reverseFind(const String& str, unsigned start = UINT_MAX) const
236 { return m_impl ? m_impl->reverseFind(str.impl(), start) : notFound; } 236 { return m_impl ? m_impl->reverseFind(str.impl(), start) : kNotFound; }
237 237
238 // Case insensitive string matching. 238 // Case insensitive string matching.
239 size_t findIgnoringCase(const LChar* str, unsigned start = 0) const 239 size_t findIgnoringCase(const LChar* str, unsigned start = 0) const
240 { return m_impl ? m_impl->findIgnoringCase(str, start) : notFound; } 240 { return m_impl ? m_impl->findIgnoringCase(str, start) : kNotFound; }
241 size_t findIgnoringCase(const String& str, unsigned start = 0) const 241 size_t findIgnoringCase(const String& str, unsigned start = 0) const
242 { return m_impl ? m_impl->findIgnoringCase(str.impl(), start) : notFound ; } 242 { return m_impl ? m_impl->findIgnoringCase(str.impl(), start) : kNotFoun d; }
243 size_t reverseFindIgnoringCase(const String& str, unsigned start = UINT_MAX) const 243 size_t reverseFindIgnoringCase(const String& str, unsigned start = UINT_MAX) const
244 { return m_impl ? m_impl->reverseFindIgnoringCase(str.impl(), start) : n otFound; } 244 { return m_impl ? m_impl->reverseFindIgnoringCase(str.impl(), start) : k NotFound; }
245 245
246 // Wrappers for find & reverseFind adding dynamic sensitivity check. 246 // Wrappers for find & reverseFind adding dynamic sensitivity check.
247 size_t find(const LChar* str, unsigned start, bool caseSensitive) const 247 size_t find(const LChar* str, unsigned start, bool caseSensitive) const
248 { return caseSensitive ? find(str, start) : findIgnoringCase(str, start) ; } 248 { return caseSensitive ? find(str, start) : findIgnoringCase(str, start) ; }
249 size_t find(const String& str, unsigned start, bool caseSensitive) const 249 size_t find(const String& str, unsigned start, bool caseSensitive) const
250 { return caseSensitive ? find(str, start) : findIgnoringCase(str, start) ; } 250 { return caseSensitive ? find(str, start) : findIgnoringCase(str, start) ; }
251 size_t reverseFind(const String& str, unsigned start, bool caseSensitive) co nst 251 size_t reverseFind(const String& str, unsigned start, bool caseSensitive) co nst
252 { return caseSensitive ? reverseFind(str, start) : reverseFindIgnoringCa se(str, start); } 252 { return caseSensitive ? reverseFind(str, start) : reverseFindIgnoringCa se(str, start); }
253 253
254 Vector<UChar> charactersWithNullTermination() const; 254 Vector<UChar> charactersWithNullTermination() const;
255 unsigned copyTo(UChar* buffer, unsigned pos, unsigned maxLength) const; 255 unsigned copyTo(UChar* buffer, unsigned pos, unsigned maxLength) const;
256 256
257 template<size_t inlineCapacity> 257 template<size_t inlineCapacity>
258 void appendTo(Vector<UChar, inlineCapacity>&, unsigned pos = 0, unsigned len = UINT_MAX) const; 258 void appendTo(Vector<UChar, inlineCapacity>&, unsigned pos = 0, unsigned len = UINT_MAX) const;
259 259
260 template<typename BufferType> 260 template<typename BufferType>
261 void appendTo(BufferType&, unsigned pos = 0, unsigned len = UINT_MAX) const; 261 void appendTo(BufferType&, unsigned pos = 0, unsigned len = UINT_MAX) const;
262 262
263 template<size_t inlineCapacity> 263 template<size_t inlineCapacity>
264 void prependTo(Vector<UChar, inlineCapacity>&, unsigned pos = 0, unsigned le n = UINT_MAX) const; 264 void prependTo(Vector<UChar, inlineCapacity>&, unsigned pos = 0, unsigned le n = UINT_MAX) const;
265 265
266 UChar32 characterStartingAt(unsigned) const; 266 UChar32 characterStartingAt(unsigned) const;
267 267
268 bool contains(UChar c) const { return find(c) != notFound; } 268 bool contains(UChar c) const { return find(c) != kNotFound; }
269 bool contains(const LChar* str, bool caseSensitive = true) const { return fi nd(str, 0, caseSensitive) != notFound; } 269 bool contains(const LChar* str, bool caseSensitive = true) const { return fi nd(str, 0, caseSensitive) != kNotFound; }
270 bool contains(const String& str, bool caseSensitive = true) const { return f ind(str, 0, caseSensitive) != notFound; } 270 bool contains(const String& str, bool caseSensitive = true) const { return f ind(str, 0, caseSensitive) != kNotFound; }
271 271
272 bool startsWith(const String& s, bool caseSensitive = true) const 272 bool startsWith(const String& s, bool caseSensitive = true) const
273 { return m_impl ? m_impl->startsWith(s.impl(), caseSensitive) : s.isEmpt y(); } 273 { return m_impl ? m_impl->startsWith(s.impl(), caseSensitive) : s.isEmpt y(); }
274 bool startsWith(UChar character) const 274 bool startsWith(UChar character) const
275 { return m_impl ? m_impl->startsWith(character) : false; } 275 { return m_impl ? m_impl->startsWith(character) : false; }
276 template<unsigned matchLength> 276 template<unsigned matchLength>
277 bool startsWith(const char (&prefix)[matchLength], bool caseSensitive = true ) const 277 bool startsWith(const char (&prefix)[matchLength], bool caseSensitive = true ) const
278 { return m_impl ? m_impl->startsWith<matchLength>(prefix, caseSensitive) : !matchLength; } 278 { return m_impl ? m_impl->startsWith<matchLength>(prefix, caseSensitive) : !matchLength; }
279 279
280 bool endsWith(const String& s, bool caseSensitive = true) const 280 bool endsWith(const String& s, bool caseSensitive = true) const
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 using WTF::charactersToFloat; 708 using WTF::charactersToFloat;
709 using WTF::equal; 709 using WTF::equal;
710 using WTF::equalIgnoringCase; 710 using WTF::equalIgnoringCase;
711 using WTF::find; 711 using WTF::find;
712 using WTF::isAllSpecialCharacters; 712 using WTF::isAllSpecialCharacters;
713 using WTF::isSpaceOrNewline; 713 using WTF::isSpaceOrNewline;
714 using WTF::reverseFind; 714 using WTF::reverseFind;
715 715
716 #include "wtf/text/AtomicString.h" 716 #include "wtf/text/AtomicString.h"
717 #endif 717 #endif
OLDNEW
« no previous file with comments | « Source/wtf/text/TextPosition.cpp ('k') | Source/wtf/text/WTFString.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698