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

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

Issue 2508953003: WTF: Add comments and tests for Unicode aware case-insensitive string operations. (Closed)
Patch Set: Created 4 years, 1 month 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 * (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. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
4 * All rights reserved. 4 * 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 180
181 // Find substrings. 181 // Find substrings.
182 size_t find(const StringView& value, 182 size_t find(const StringView& value,
183 unsigned start = 0, 183 unsigned start = 0,
184 TextCaseSensitivity caseSensitivity = TextCaseSensitive) const { 184 TextCaseSensitivity caseSensitivity = TextCaseSensitive) const {
185 return m_impl 185 return m_impl
186 ? DISPATCH_CASE_OP(caseSensitivity, m_impl->find, (value, start)) 186 ? DISPATCH_CASE_OP(caseSensitivity, m_impl->find, (value, start))
187 : kNotFound; 187 : kNotFound;
188 } 188 }
189 189
190 // Unicode aware case insensitive string matching. 190 // Unicode aware case insensitive string matching. Non-ASCII characters might
191 // match to ASCII characters. This function is rarely used to implement web
192 // platform features.
191 size_t findIgnoringCase(const StringView& value, unsigned start = 0) const { 193 size_t findIgnoringCase(const StringView& value, unsigned start = 0) const {
192 return m_impl ? m_impl->findIgnoringCase(value, start) : kNotFound; 194 return m_impl ? m_impl->findIgnoringCase(value, start) : kNotFound;
193 } 195 }
194 196
195 // ASCII case insensitive string matching. 197 // ASCII case insensitive string matching.
196 size_t findIgnoringASCIICase(const StringView& value, 198 size_t findIgnoringASCIICase(const StringView& value,
197 unsigned start = 0) const { 199 unsigned start = 0) const {
198 return m_impl ? m_impl->findIgnoringASCIICase(value, start) : kNotFound; 200 return m_impl ? m_impl->findIgnoringASCIICase(value, start) : kNotFound;
199 } 201 }
200 202
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 275
274 void ensure16Bit(); 276 void ensure16Bit();
275 277
276 void truncate(unsigned length); 278 void truncate(unsigned length);
277 void remove(unsigned start, unsigned length = 1); 279 void remove(unsigned start, unsigned length = 1);
278 280
279 String substring(unsigned pos, unsigned len = UINT_MAX) const; 281 String substring(unsigned pos, unsigned len = UINT_MAX) const;
280 String left(unsigned len) const { return substring(0, len); } 282 String left(unsigned len) const { return substring(0, len); }
281 String right(unsigned len) const { return substring(length() - len, len); } 283 String right(unsigned len) const { return substring(length() - len, len); }
282 284
283 // Returns a lowercase/uppercase version of the string 285 // Returns a lowercase/uppercase version of the string. These functions might
286 // convert non-ASCII characters to ASCII characters. For example, lower() for
287 // U+212A is 'k', upper() for U+017F is 'S'.
288 // These functions are rarely used to implement web platform features.
284 String lower() const; 289 String lower() const;
285 String upper() const; 290 String upper() const;
286 291
287 String lower(const AtomicString& localeIdentifier) const; 292 String lower(const AtomicString& localeIdentifier) const;
288 String upper(const AtomicString& localeIdentifier) const; 293 String upper(const AtomicString& localeIdentifier) const;
289 294
290 String stripWhiteSpace() const; 295 String stripWhiteSpace() const;
291 String stripWhiteSpace(IsWhiteSpaceFunctionPtr) const; 296 String stripWhiteSpace(IsWhiteSpaceFunctionPtr) const;
292 String simplifyWhiteSpace(StripBehavior = StripExtraWhiteSpace) const; 297 String simplifyWhiteSpace(StripBehavior = StripExtraWhiteSpace) const;
293 String simplifyWhiteSpace(IsWhiteSpaceFunctionPtr, 298 String simplifyWhiteSpace(IsWhiteSpaceFunctionPtr,
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 using WTF::emptyString; 652 using WTF::emptyString;
648 using WTF::emptyString16Bit; 653 using WTF::emptyString16Bit;
649 using WTF::charactersAreAllASCII; 654 using WTF::charactersAreAllASCII;
650 using WTF::equal; 655 using WTF::equal;
651 using WTF::find; 656 using WTF::find;
652 using WTF::isAllSpecialCharacters; 657 using WTF::isAllSpecialCharacters;
653 using WTF::isSpaceOrNewline; 658 using WTF::isSpaceOrNewline;
654 659
655 #include "wtf/text/AtomicString.h" 660 #include "wtf/text/AtomicString.h"
656 #endif // WTFString_h 661 #endif // WTFString_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/text/StringView.h ('k') | third_party/WebKit/Source/wtf/text/WTFStringTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698