OLD | NEW |
---|---|
1 /* | 1 /* |
2 * (C) 1999 Lars Knoll (knoll@kde.org) | 2 * (C) 1999 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 }; | 80 }; |
81 | 81 |
82 enum UTF8ConversionMode { | 82 enum UTF8ConversionMode { |
83 LenientUTF8Conversion, | 83 LenientUTF8Conversion, |
84 StrictUTF8Conversion, | 84 StrictUTF8Conversion, |
85 StrictUTF8ConversionReplacingUnpairedSurrogatesWithFFFD | 85 StrictUTF8ConversionReplacingUnpairedSurrogatesWithFFFD |
86 }; | 86 }; |
87 | 87 |
88 #define DISPATCH_CASE_OP(caseSensitivity, op, args) \ | 88 #define DISPATCH_CASE_OP(caseSensitivity, op, args) \ |
89 ((caseSensitivity == TextCaseSensitive) ? op args : \ | 89 ((caseSensitivity == TextCaseSensitive) ? op args : \ |
90 (caseSensitivity == TextCaseASCIIInsensitive) ? op##IgnoringASCIICase args : \ | |
tkent
2015/12/11 00:02:45
I was afraid the code size bloat by this. However
fs
2015/12/11 11:43:16
Yes, this was how I reasoned about it as well.
| |
90 op##IgnoringCase args) | 91 op##IgnoringCase args) |
91 | 92 |
92 template<bool isSpecialCharacter(UChar), typename CharacterType> | 93 template<bool isSpecialCharacter(UChar), typename CharacterType> |
93 bool isAllSpecialCharacters(const CharacterType*, size_t); | 94 bool isAllSpecialCharacters(const CharacterType*, size_t); |
94 | 95 |
95 // You can find documentation about this class in this doc: | 96 // You can find documentation about this class in this doc: |
96 // https://docs.google.com/document/d/1kOCUlJdh2WJMJGDf-WoEQhmnjKLaOYRbiHz5TiGJl 14/edit?usp=sharing | 97 // https://docs.google.com/document/d/1kOCUlJdh2WJMJGDf-WoEQhmnjKLaOYRbiHz5TiGJl 14/edit?usp=sharing |
97 class WTF_EXPORT String { | 98 class WTF_EXPORT String { |
98 public: | 99 public: |
99 // Construct a null string, distinguishable from an empty string. | 100 // Construct a null string, distinguishable from an empty string. |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
229 { return m_impl ? m_impl->reverseFind(c, start) : kNotFound; } | 230 { return m_impl ? m_impl->reverseFind(c, start) : kNotFound; } |
230 size_t reverseFind(const String& str, unsigned start = UINT_MAX) const | 231 size_t reverseFind(const String& str, unsigned start = UINT_MAX) const |
231 { return m_impl ? m_impl->reverseFind(str.impl(), start) : kNotFound; } | 232 { return m_impl ? m_impl->reverseFind(str.impl(), start) : kNotFound; } |
232 | 233 |
233 // Case insensitive string matching. | 234 // Case insensitive string matching. |
234 size_t findIgnoringCase(const LChar* str, unsigned start = 0) const | 235 size_t findIgnoringCase(const LChar* str, unsigned start = 0) const |
235 { return m_impl ? m_impl->findIgnoringCase(str, start) : kNotFound; } | 236 { return m_impl ? m_impl->findIgnoringCase(str, start) : kNotFound; } |
236 size_t findIgnoringCase(const String& str, unsigned start = 0) const | 237 size_t findIgnoringCase(const String& str, unsigned start = 0) const |
237 { return m_impl ? m_impl->findIgnoringCase(str.impl(), start) : kNotFoun d; } | 238 { return m_impl ? m_impl->findIgnoringCase(str.impl(), start) : kNotFoun d; } |
238 | 239 |
240 // ASCII case insensitive string matching. | |
241 size_t findIgnoringASCIICase(const String& str, unsigned start = 0) const | |
242 { return m_impl ? m_impl->findIgnoringASCIICase(str.impl(), start) : kNo tFound; } | |
243 | |
239 // Wrappers for find adding dynamic sensitivity check. | 244 // Wrappers for find adding dynamic sensitivity check. |
240 size_t find(const LChar* str, unsigned start, TextCaseSensitivity caseSensit ivity) const | 245 size_t find(const LChar* str, unsigned start, TextCaseSensitivity caseSensit ivity) const |
241 { return DISPATCH_CASE_OP(caseSensitivity, find, (str, start)); } | 246 { return DISPATCH_CASE_OP(caseSensitivity, find, (str, start)); } |
242 size_t find(const String& str, unsigned start, TextCaseSensitivity caseSensi tivity) const | 247 size_t find(const String& str, unsigned start, TextCaseSensitivity caseSensi tivity) const |
243 { return DISPATCH_CASE_OP(caseSensitivity, find, (str, start)); } | 248 { return DISPATCH_CASE_OP(caseSensitivity, find, (str, start)); } |
244 | 249 |
245 Vector<UChar> charactersWithNullTermination() const; | 250 Vector<UChar> charactersWithNullTermination() const; |
246 unsigned copyTo(UChar* buffer, unsigned pos, unsigned maxLength) const; | 251 unsigned copyTo(UChar* buffer, unsigned pos, unsigned maxLength) const; |
247 | 252 |
248 template<size_t inlineCapacity> | 253 template<size_t inlineCapacity> |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
695 using WTF::charactersToFloat; | 700 using WTF::charactersToFloat; |
696 using WTF::equal; | 701 using WTF::equal; |
697 using WTF::equalIgnoringCase; | 702 using WTF::equalIgnoringCase; |
698 using WTF::find; | 703 using WTF::find; |
699 using WTF::isAllSpecialCharacters; | 704 using WTF::isAllSpecialCharacters; |
700 using WTF::isSpaceOrNewline; | 705 using WTF::isSpaceOrNewline; |
701 using WTF::reverseFind; | 706 using WTF::reverseFind; |
702 | 707 |
703 #include "wtf/text/AtomicString.h" | 708 #include "wtf/text/AtomicString.h" |
704 #endif // WTFString_h | 709 #endif // WTFString_h |
OLD | NEW |