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

Side by Side Diff: third_party/WebKit/Source/wtf/text/AtomicString.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
« no previous file with comments | « no previous file | third_party/WebKit/Source/wtf/text/StringBuilder.h » ('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) 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 return m_string.find(matchFunction, start); 97 return m_string.find(matchFunction, start);
98 } 98 }
99 99
100 // Find substrings. 100 // Find substrings.
101 size_t find(const StringView& value, 101 size_t find(const StringView& value,
102 unsigned start = 0, 102 unsigned start = 0,
103 TextCaseSensitivity caseSensitivity = TextCaseSensitive) const { 103 TextCaseSensitivity caseSensitivity = TextCaseSensitive) const {
104 return m_string.find(value, start, caseSensitivity); 104 return m_string.find(value, start, caseSensitivity);
105 } 105 }
106 106
107 // Unicode aware case insensitive string matching. 107 // Unicode aware case insensitive string matching. Non-ASCII characters might
108 // match to ASCII characters. This function is rarely used to implement web
109 // platform features.
108 size_t findIgnoringCase(const StringView& value, unsigned start = 0) const { 110 size_t findIgnoringCase(const StringView& value, unsigned start = 0) const {
109 return m_string.findIgnoringCase(value, start); 111 return m_string.findIgnoringCase(value, start);
110 } 112 }
111 113
112 // ASCII case insensitive string matching. 114 // ASCII case insensitive string matching.
113 size_t findIgnoringASCIICase(const StringView& value, 115 size_t findIgnoringASCIICase(const StringView& value,
114 unsigned start = 0) const { 116 unsigned start = 0) const {
115 return m_string.findIgnoringASCIICase(value, start); 117 return m_string.findIgnoringASCIICase(value, start);
116 } 118 }
117 119
(...skipping 19 matching lines...) Expand all
137 bool startsWith(UChar character) const { 139 bool startsWith(UChar character) const {
138 return m_string.startsWith(character); 140 return m_string.startsWith(character);
139 } 141 }
140 142
141 bool endsWith(const StringView& suffix, 143 bool endsWith(const StringView& suffix,
142 TextCaseSensitivity caseSensitivity = TextCaseSensitive) const { 144 TextCaseSensitivity caseSensitivity = TextCaseSensitive) const {
143 return m_string.endsWith(suffix, caseSensitivity); 145 return m_string.endsWith(suffix, caseSensitivity);
144 } 146 }
145 bool endsWith(UChar character) const { return m_string.endsWith(character); } 147 bool endsWith(UChar character) const { return m_string.endsWith(character); }
146 148
149 // Returns a lowercase/uppercase version of the string. These functions might
150 // convert non-ASCII characters to ASCII characters. For example, lower() for
151 // U+212A is 'k', upper() for U+017F is 'S'.
152 // These functions are rarely used to implement web platform features.
147 AtomicString lower() const; 153 AtomicString lower() const;
154 AtomicString upper() const { return AtomicString(impl()->upper()); }
155
156 // Returns a lowercase version of the string. This function converts only
157 // upper-case ASCII characters.
148 AtomicString lowerASCII() const; 158 AtomicString lowerASCII() const;
149 AtomicString upper() const { return AtomicString(impl()->upper()); }
150 159
151 int toInt(bool* ok = 0) const { return m_string.toInt(ok); } 160 int toInt(bool* ok = 0) const { return m_string.toInt(ok); }
152 double toDouble(bool* ok = 0) const { return m_string.toDouble(ok); } 161 double toDouble(bool* ok = 0) const { return m_string.toDouble(ok); }
153 float toFloat(bool* ok = 0) const { return m_string.toFloat(ok); } 162 float toFloat(bool* ok = 0) const { return m_string.toFloat(ok); }
154 163
155 static AtomicString number(int); 164 static AtomicString number(int);
156 static AtomicString number(unsigned); 165 static AtomicString number(unsigned);
157 static AtomicString number(long); 166 static AtomicString number(long);
158 static AtomicString number(unsigned long); 167 static AtomicString number(unsigned long);
159 static AtomicString number(long long); 168 static AtomicString number(long long);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 using WTF::AtomicString; 306 using WTF::AtomicString;
298 using WTF::nullAtom; 307 using WTF::nullAtom;
299 using WTF::emptyAtom; 308 using WTF::emptyAtom;
300 using WTF::starAtom; 309 using WTF::starAtom;
301 using WTF::xmlAtom; 310 using WTF::xmlAtom;
302 using WTF::xmlnsAtom; 311 using WTF::xmlnsAtom;
303 using WTF::xlinkAtom; 312 using WTF::xlinkAtom;
304 313
305 #include "wtf/text/StringConcatenate.h" 314 #include "wtf/text/StringConcatenate.h"
306 #endif // AtomicString_h 315 #endif // AtomicString_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/wtf/text/StringBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698