OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. | 3 * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. |
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 bool equalIgnoringCase(const char* str) const | 84 bool equalIgnoringCase(const char* str) const |
85 { | 85 { |
86 bool match = is8Bit() ? WTF::equalIgnoringCase(str, characters8(), lengt
h()) : WTF::equalIgnoringCase(str, characters16(), length()); | 86 bool match = is8Bit() ? WTF::equalIgnoringCase(str, characters8(), lengt
h()) : WTF::equalIgnoringCase(str, characters16(), length()); |
87 if (!match) | 87 if (!match) |
88 return false; | 88 return false; |
89 ASSERT(strlen(str) >= length()); | 89 ASSERT(strlen(str) >= length()); |
90 return str[length()] == '\0'; | 90 return str[length()] == '\0'; |
91 } | 91 } |
92 | 92 |
| 93 template<unsigned matchLength> |
| 94 bool equalIgnoringASCIICase(const char (&match)[matchLength]) const |
| 95 { |
| 96 if (matchLength - 1 != length()) |
| 97 return false; |
| 98 return is8Bit() ? WTF::equalIgnoringASCIICase(match, characters8(), leng
th()) : WTF::equalIgnoringASCIICase(match, characters16(), length()); |
| 99 } |
| 100 |
93 operator String() const { return is8Bit() ? String(m_data.characters8, m_len
gth) : StringImpl::create8BitIfPossible(m_data.characters16, m_length); } | 101 operator String() const { return is8Bit() ? String(m_data.characters8, m_len
gth) : StringImpl::create8BitIfPossible(m_data.characters16, m_length); } |
94 operator AtomicString() const { return is8Bit() ? AtomicString(m_data.charac
ters8, m_length) : AtomicString(m_data.characters16, m_length); } | 102 operator AtomicString() const { return is8Bit() ? AtomicString(m_data.charac
ters8, m_length) : AtomicString(m_data.characters16, m_length); } |
95 | 103 |
96 union { | 104 union { |
97 const LChar* characters8; | 105 const LChar* characters8; |
98 const UChar* characters16; | 106 const UChar* characters16; |
99 const void* charactersRaw; | 107 const void* charactersRaw; |
100 } m_data; | 108 } m_data; |
101 unsigned m_length; | 109 unsigned m_length; |
102 bool m_is8Bit; | 110 bool m_is8Bit; |
103 }; | 111 }; |
104 | 112 |
105 } | 113 } |
106 | 114 |
107 #endif | 115 #endif |
OLD | NEW |