OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2012, 2013 Apple Inc. All rights reserved | 2 * Copyright (C) 2006, 2007, 2008, 2012, 2013 Apple Inc. All rights reserved |
3 * Copyright (C) Research In Motion Limited 2009. All rights reserved. | 3 * Copyright (C) Research In Motion Limited 2009. 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 return (a == b) || equal(a.impl(), b.impl()); | 120 return (a == b) || equal(a.impl(), b.impl()); |
121 } | 121 } |
122 | 122 |
123 static const bool safeToCompareToEmptyOrDeleted = false; | 123 static const bool safeToCompareToEmptyOrDeleted = false; |
124 | 124 |
125 private: | 125 private: |
126 // Private so no one uses this in the belief that it will return the | 126 // Private so no one uses this in the belief that it will return the |
127 // correctly-folded code point in all cases (see comment below). | 127 // correctly-folded code point in all cases (see comment below). |
128 template<typename T> static inline UChar foldCase(T ch) | 128 template<typename T> static inline UChar foldCase(T ch) |
129 { | 129 { |
130 if (IsSameType<T, LChar>::value) | 130 if (std::is_same<T, LChar>::value) |
131 return StringImpl::latin1CaseFoldTable[ch]; | 131 return StringImpl::latin1CaseFoldTable[ch]; |
132 // It's possible for WTF::Unicode::foldCase() to return a 32-bit value | 132 // It's possible for WTF::Unicode::foldCase() to return a 32-bit value |
133 // that's not representable as a UChar. However, since this is rare and | 133 // that's not representable as a UChar. However, since this is rare and |
134 // deterministic, and the result of this is merely used for hashing, go | 134 // deterministic, and the result of this is merely used for hashing, go |
135 // ahead and clamp the value. | 135 // ahead and clamp the value. |
136 return static_cast<UChar>(WTF::Unicode::foldCase(ch)); | 136 return static_cast<UChar>(WTF::Unicode::foldCase(ch)); |
137 } | 137 } |
138 }; | 138 }; |
139 | 139 |
140 // This hash can be used in cases where the key is a hash of a string, but we | 140 // This hash can be used in cases where the key is a hash of a string, but we |
(...skipping 16 matching lines...) Expand all Loading... |
157 } | 157 } |
158 }; | 158 }; |
159 | 159 |
160 } | 160 } |
161 | 161 |
162 using WTF::AlreadyHashed; | 162 using WTF::AlreadyHashed; |
163 using WTF::CaseFoldingHash; | 163 using WTF::CaseFoldingHash; |
164 using WTF::StringHash; | 164 using WTF::StringHash; |
165 | 165 |
166 #endif | 166 #endif |
OLD | NEW |