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

Side by Side Diff: third_party/WebKit/Source/platform/wtf/text/StringImpl.cpp

Issue 2811793004: Rename EqualIgnoringCase*() to DeprecatedEqualIgnoringCase*() (Closed)
Patch Set: Created 3 years, 8 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller ( mueller@kde.org ) 4 * (C) 2001 Dirk Mueller ( mueller@kde.org )
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All
6 * rights reserved. 6 * rights reserved.
7 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) 7 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1279 0x00bd, 0x00be, 0x00bf, 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 1279 0x00bd, 0x00be, 0x00bf, 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5,
1280 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 1280 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee,
1281 0x00ef, 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00d7, 1281 0x00ef, 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00d7,
1282 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00df, 0x00e0, 1282 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00df, 0x00e0,
1283 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 1283 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9,
1284 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, 0x00f0, 0x00f1, 0x00f2, 1284 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, 0x00f0, 0x00f1, 0x00f2,
1285 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 1285 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb,
1286 0x00fc, 0x00fd, 0x00fe, 0x00ff, 1286 0x00fc, 0x00fd, 0x00fe, 0x00ff,
1287 }; 1287 };
1288 1288
1289 bool EqualIgnoringCase(const LChar* a, const LChar* b, unsigned length) { 1289 bool DeprecatedEqualIgnoringCase(const LChar* a,
1290 const LChar* b,
1291 unsigned length) {
1290 DCHECK_GE(length, 0u); 1292 DCHECK_GE(length, 0u);
1291 if (a == b) 1293 if (a == b)
1292 return true; 1294 return true;
1293 while (length--) { 1295 while (length--) {
1294 if (StringImpl::kLatin1CaseFoldTable[*a++] != 1296 if (StringImpl::kLatin1CaseFoldTable[*a++] !=
1295 StringImpl::kLatin1CaseFoldTable[*b++]) 1297 StringImpl::kLatin1CaseFoldTable[*b++])
1296 return false; 1298 return false;
1297 } 1299 }
1298 return true; 1300 return true;
1299 } 1301 }
1300 1302
1301 bool EqualIgnoringCase(const UChar* a, const UChar* b, unsigned length) { 1303 bool DeprecatedEqualIgnoringCase(const UChar* a,
1304 const UChar* b,
1305 unsigned length) {
1302 DCHECK_GE(length, 0u); 1306 DCHECK_GE(length, 0u);
1303 if (a == b) 1307 if (a == b)
1304 return true; 1308 return true;
1305 return !Unicode::Umemcasecmp(a, b, length); 1309 return !Unicode::Umemcasecmp(a, b, length);
1306 } 1310 }
1307 1311
1308 bool EqualIgnoringCase(const UChar* a, const LChar* b, unsigned length) { 1312 bool DeprecatedEqualIgnoringCase(const UChar* a,
1313 const LChar* b,
1314 unsigned length) {
1309 while (length--) { 1315 while (length--) {
1310 if (FoldCase(*a++) != StringImpl::kLatin1CaseFoldTable[*b++]) 1316 if (FoldCase(*a++) != StringImpl::kLatin1CaseFoldTable[*b++])
1311 return false; 1317 return false;
1312 } 1318 }
1313 return true; 1319 return true;
1314 } 1320 }
1315 1321
1316 size_t StringImpl::Find(CharacterMatchFunctionPtr match_function, 1322 size_t StringImpl::Find(CharacterMatchFunctionPtr match_function,
1317 unsigned start) { 1323 unsigned start) {
1318 if (Is8Bit()) 1324 if (Is8Bit())
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1398 const MatchCharacterType* match_characters, 1404 const MatchCharacterType* match_characters,
1399 unsigned index, 1405 unsigned index,
1400 unsigned search_length, 1406 unsigned search_length,
1401 unsigned match_length) { 1407 unsigned match_length) {
1402 // delta is the number of additional times to test; delta == 0 means test only 1408 // delta is the number of additional times to test; delta == 0 means test only
1403 // once. 1409 // once.
1404 unsigned delta = search_length - match_length; 1410 unsigned delta = search_length - match_length;
1405 1411
1406 unsigned i = 0; 1412 unsigned i = 0;
1407 // keep looping until we match 1413 // keep looping until we match
1408 while (!EqualIgnoringCase(search_characters + i, match_characters, 1414 while (!DeprecatedEqualIgnoringCase(search_characters + i, match_characters,
1409 match_length)) { 1415 match_length)) {
1410 if (i == delta) 1416 if (i == delta)
1411 return kNotFound; 1417 return kNotFound;
1412 ++i; 1418 ++i;
1413 } 1419 }
1414 return index + i; 1420 return index + i;
1415 } 1421 }
1416 1422
1417 size_t StringImpl::FindIgnoringCase(const StringView& match_string, 1423 size_t StringImpl::FindIgnoringCase(const StringView& match_string,
1418 unsigned index) { 1424 unsigned index) {
1419 if (UNLIKELY(match_string.IsNull())) 1425 if (UNLIKELY(match_string.IsNull()))
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 } 1598 }
1593 if (prefix.Is8Bit()) 1599 if (prefix.Is8Bit())
1594 return Equal(Characters16(), prefix.Characters8(), prefix.length()); 1600 return Equal(Characters16(), prefix.Characters8(), prefix.length());
1595 return Equal(Characters16(), prefix.Characters16(), prefix.length()); 1601 return Equal(Characters16(), prefix.Characters16(), prefix.length());
1596 } 1602 }
1597 1603
1598 bool StringImpl::StartsWithIgnoringCase(const StringView& prefix) const { 1604 bool StringImpl::StartsWithIgnoringCase(const StringView& prefix) const {
1599 if (prefix.length() > length()) 1605 if (prefix.length() > length())
1600 return false; 1606 return false;
1601 if (Is8Bit()) { 1607 if (Is8Bit()) {
1602 if (prefix.Is8Bit()) 1608 if (prefix.Is8Bit()) {
1603 return EqualIgnoringCase(Characters8(), prefix.Characters8(), 1609 return DeprecatedEqualIgnoringCase(Characters8(), prefix.Characters8(),
1604 prefix.length()); 1610 prefix.length());
1605 return EqualIgnoringCase(Characters8(), prefix.Characters16(), 1611 }
1606 prefix.length()); 1612 return DeprecatedEqualIgnoringCase(Characters8(), prefix.Characters16(),
1613 prefix.length());
1607 } 1614 }
1608 if (prefix.Is8Bit()) 1615 if (prefix.Is8Bit()) {
1609 return EqualIgnoringCase(Characters16(), prefix.Characters8(), 1616 return DeprecatedEqualIgnoringCase(Characters16(), prefix.Characters8(),
1610 prefix.length()); 1617 prefix.length());
1611 return EqualIgnoringCase(Characters16(), prefix.Characters16(), 1618 }
1612 prefix.length()); 1619 return DeprecatedEqualIgnoringCase(Characters16(), prefix.Characters16(),
1620 prefix.length());
1613 } 1621 }
1614 1622
1615 bool StringImpl::StartsWithIgnoringASCIICase(const StringView& prefix) const { 1623 bool StringImpl::StartsWithIgnoringASCIICase(const StringView& prefix) const {
1616 if (prefix.length() > length()) 1624 if (prefix.length() > length())
1617 return false; 1625 return false;
1618 if (Is8Bit()) { 1626 if (Is8Bit()) {
1619 if (prefix.Is8Bit()) 1627 if (prefix.Is8Bit())
1620 return EqualIgnoringASCIICase(Characters8(), prefix.Characters8(), 1628 return EqualIgnoringASCIICase(Characters8(), prefix.Characters8(),
1621 prefix.length()); 1629 prefix.length());
1622 return EqualIgnoringASCIICase(Characters8(), prefix.Characters16(), 1630 return EqualIgnoringASCIICase(Characters8(), prefix.Characters16(),
(...skipping 26 matching lines...) Expand all
1649 suffix.length()); 1657 suffix.length());
1650 return Equal(Characters16() + start_offset, suffix.Characters16(), 1658 return Equal(Characters16() + start_offset, suffix.Characters16(),
1651 suffix.length()); 1659 suffix.length());
1652 } 1660 }
1653 1661
1654 bool StringImpl::EndsWithIgnoringCase(const StringView& suffix) const { 1662 bool StringImpl::EndsWithIgnoringCase(const StringView& suffix) const {
1655 if (suffix.length() > length()) 1663 if (suffix.length() > length())
1656 return false; 1664 return false;
1657 unsigned start_offset = length() - suffix.length(); 1665 unsigned start_offset = length() - suffix.length();
1658 if (Is8Bit()) { 1666 if (Is8Bit()) {
1659 if (suffix.Is8Bit()) 1667 if (suffix.Is8Bit()) {
1660 return EqualIgnoringCase(Characters8() + start_offset, 1668 return DeprecatedEqualIgnoringCase(Characters8() + start_offset,
1661 suffix.Characters8(), suffix.length()); 1669 suffix.Characters8(), suffix.length());
1662 return EqualIgnoringCase(Characters8() + start_offset, 1670 }
1663 suffix.Characters16(), suffix.length()); 1671 return DeprecatedEqualIgnoringCase(Characters8() + start_offset,
1672 suffix.Characters16(), suffix.length());
1664 } 1673 }
1665 if (suffix.Is8Bit()) 1674 if (suffix.Is8Bit()) {
1666 return EqualIgnoringCase(Characters16() + start_offset, 1675 return DeprecatedEqualIgnoringCase(Characters16() + start_offset,
1667 suffix.Characters8(), suffix.length()); 1676 suffix.Characters8(), suffix.length());
1668 return EqualIgnoringCase(Characters16() + start_offset, suffix.Characters16(), 1677 }
1669 suffix.length()); 1678 return DeprecatedEqualIgnoringCase(Characters16() + start_offset,
1679 suffix.Characters16(), suffix.length());
1670 } 1680 }
1671 1681
1672 bool StringImpl::EndsWithIgnoringASCIICase(const StringView& suffix) const { 1682 bool StringImpl::EndsWithIgnoringASCIICase(const StringView& suffix) const {
1673 if (suffix.length() > length()) 1683 if (suffix.length() > length())
1674 return false; 1684 return false;
1675 unsigned start_offset = length() - suffix.length(); 1685 unsigned start_offset = length() - suffix.length();
1676 if (Is8Bit()) { 1686 if (Is8Bit()) {
1677 if (suffix.Is8Bit()) 1687 if (suffix.Is8Bit())
1678 return EqualIgnoringASCIICase(Characters8() + start_offset, 1688 return EqualIgnoringASCIICase(Characters8() + start_offset,
1679 suffix.Characters8(), suffix.length()); 1689 suffix.Characters8(), suffix.length());
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
2246 } else if (LocaleIdMatchesLang(locale_identifier, "lt")) { 2256 } else if (LocaleIdMatchesLang(locale_identifier, "lt")) {
2247 // TODO(rob.buis) implement upper-casing rules for lt 2257 // TODO(rob.buis) implement upper-casing rules for lt
2248 // like in StringImpl::upper(locale). 2258 // like in StringImpl::upper(locale).
2249 } 2259 }
2250 } 2260 }
2251 2261
2252 return ToUpper(c); 2262 return ToUpper(c);
2253 } 2263 }
2254 2264
2255 } // namespace WTF 2265 } // namespace WTF
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/wtf/text/StringImpl.h ('k') | third_party/WebKit/Source/platform/wtf/text/StringView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698