OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "platform/wtf/text/StringView.h" | 5 #include "platform/wtf/text/StringView.h" |
6 | 6 |
7 #include "platform/wtf/text/AtomicString.h" | 7 #include "platform/wtf/text/AtomicString.h" |
8 #include "platform/wtf/text/StringImpl.h" | 8 #include "platform/wtf/text/StringImpl.h" |
9 #include "platform/wtf/text/WTFString.h" | 9 #include "platform/wtf/text/WTFString.h" |
10 | 10 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 if (a.Is8Bit()) { | 54 if (a.Is8Bit()) { |
55 if (b.Is8Bit()) | 55 if (b.Is8Bit()) |
56 return Equal(a.Characters8(), b.Characters8(), a.length()); | 56 return Equal(a.Characters8(), b.Characters8(), a.length()); |
57 return Equal(a.Characters8(), b.Characters16(), a.length()); | 57 return Equal(a.Characters8(), b.Characters16(), a.length()); |
58 } | 58 } |
59 if (b.Is8Bit()) | 59 if (b.Is8Bit()) |
60 return Equal(a.Characters16(), b.Characters8(), a.length()); | 60 return Equal(a.Characters16(), b.Characters8(), a.length()); |
61 return Equal(a.Characters16(), b.Characters16(), a.length()); | 61 return Equal(a.Characters16(), b.Characters16(), a.length()); |
62 } | 62 } |
63 | 63 |
64 bool EqualIgnoringCaseAndNullity(const StringView& a, const StringView& b) { | 64 bool DeprecatedEqualIgnoringCaseAndNullity(const StringView& a, |
| 65 const StringView& b) { |
65 if (a.length() != b.length()) | 66 if (a.length() != b.length()) |
66 return false; | 67 return false; |
67 if (a.Is8Bit()) { | 68 if (a.Is8Bit()) { |
68 if (b.Is8Bit()) | 69 if (b.Is8Bit()) { |
69 return EqualIgnoringCase(a.Characters8(), b.Characters8(), a.length()); | 70 return DeprecatedEqualIgnoringCase(a.Characters8(), b.Characters8(), |
70 return EqualIgnoringCase(a.Characters8(), b.Characters16(), a.length()); | 71 a.length()); |
| 72 } |
| 73 return DeprecatedEqualIgnoringCase(a.Characters8(), b.Characters16(), |
| 74 a.length()); |
71 } | 75 } |
72 if (b.Is8Bit()) | 76 if (b.Is8Bit()) { |
73 return EqualIgnoringCase(a.Characters16(), b.Characters8(), a.length()); | 77 return DeprecatedEqualIgnoringCase(a.Characters16(), b.Characters8(), |
74 return EqualIgnoringCase(a.Characters16(), b.Characters16(), a.length()); | 78 a.length()); |
| 79 } |
| 80 return DeprecatedEqualIgnoringCase(a.Characters16(), b.Characters16(), |
| 81 a.length()); |
75 } | 82 } |
76 | 83 |
77 bool EqualIgnoringCase(const StringView& a, const StringView& b) { | 84 bool DeprecatedEqualIgnoringCase(const StringView& a, const StringView& b) { |
78 if (a.IsNull() || b.IsNull()) | 85 if (a.IsNull() || b.IsNull()) |
79 return a.IsNull() == b.IsNull(); | 86 return a.IsNull() == b.IsNull(); |
80 return EqualIgnoringCaseAndNullity(a, b); | 87 return DeprecatedEqualIgnoringCaseAndNullity(a, b); |
81 } | 88 } |
82 | 89 |
83 bool EqualIgnoringASCIICase(const StringView& a, const StringView& b) { | 90 bool EqualIgnoringASCIICase(const StringView& a, const StringView& b) { |
84 if (a.IsNull() || b.IsNull()) | 91 if (a.IsNull() || b.IsNull()) |
85 return a.IsNull() == b.IsNull(); | 92 return a.IsNull() == b.IsNull(); |
86 if (a.length() != b.length()) | 93 if (a.length() != b.length()) |
87 return false; | 94 return false; |
88 if (a.Is8Bit()) { | 95 if (a.Is8Bit()) { |
89 if (b.Is8Bit()) | 96 if (b.Is8Bit()) |
90 return EqualIgnoringASCIICase(a.Characters8(), b.Characters8(), | 97 return EqualIgnoringASCIICase(a.Characters8(), b.Characters8(), |
91 a.length()); | 98 a.length()); |
92 return EqualIgnoringASCIICase(a.Characters8(), b.Characters16(), | 99 return EqualIgnoringASCIICase(a.Characters8(), b.Characters16(), |
93 a.length()); | 100 a.length()); |
94 } | 101 } |
95 if (b.Is8Bit()) | 102 if (b.Is8Bit()) |
96 return EqualIgnoringASCIICase(a.Characters16(), b.Characters8(), | 103 return EqualIgnoringASCIICase(a.Characters16(), b.Characters8(), |
97 a.length()); | 104 a.length()); |
98 return EqualIgnoringASCIICase(a.Characters16(), b.Characters16(), a.length()); | 105 return EqualIgnoringASCIICase(a.Characters16(), b.Characters16(), a.length()); |
99 } | 106 } |
100 | 107 |
101 } // namespace WTF | 108 } // namespace WTF |
OLD | NEW |