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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 template<size_t inlineCapacity> | 271 template<size_t inlineCapacity> |
272 void appendTo(Vector<UChar, inlineCapacity>&, unsigned pos = 0, unsigned len
= UINT_MAX) const; | 272 void appendTo(Vector<UChar, inlineCapacity>&, unsigned pos = 0, unsigned len
= UINT_MAX) const; |
273 | 273 |
274 template<typename BufferType> | 274 template<typename BufferType> |
275 void appendTo(BufferType&, unsigned pos = 0, unsigned len = UINT_MAX) const; | 275 void appendTo(BufferType&, unsigned pos = 0, unsigned len = UINT_MAX) const; |
276 | 276 |
277 template<size_t inlineCapacity> | 277 template<size_t inlineCapacity> |
278 void prependTo(Vector<UChar, inlineCapacity>&, unsigned pos = 0, unsigned le
n = UINT_MAX) const; | 278 void prependTo(Vector<UChar, inlineCapacity>&, unsigned pos = 0, unsigned le
n = UINT_MAX) const; |
279 | 279 |
280 UChar32 characterStartingAt(unsigned) const; | 280 UChar32 characterStartingAt(unsigned) const; |
281 | 281 |
282 bool contains(UChar c) const { return find(c) != notFound; } | 282 bool contains(UChar c) const { return find(c) != notFound; } |
283 bool contains(const LChar* str, bool caseSensitive = true) const { return fi
nd(str, 0, caseSensitive) != notFound; } | 283 bool contains(const LChar* str, bool caseSensitive = true) const { return fi
nd(str, 0, caseSensitive) != notFound; } |
284 bool contains(const String& str, bool caseSensitive = true) const { return f
ind(str, 0, caseSensitive) != notFound; } | 284 bool contains(const String& str, bool caseSensitive = true) const { return f
ind(str, 0, caseSensitive) != notFound; } |
285 | 285 |
286 bool startsWith(const String& s, bool caseSensitive = true) const | 286 bool startsWith(const String& s, bool caseSensitive = true) const |
287 { return m_impl ? m_impl->startsWith(s.impl(), caseSensitive) : s.isEmpt
y(); } | 287 { return m_impl ? m_impl->startsWith(s.impl(), caseSensitive) : s.isEmpt
y(); } |
288 bool startsWith(UChar character) const | 288 bool startsWith(UChar character) const |
289 { return m_impl ? m_impl->startsWith(character) : false; } | 289 { return m_impl ? m_impl->startsWith(character) : false; } |
290 template<unsigned matchLength> | 290 template<unsigned matchLength> |
291 bool startsWith(const char (&prefix)[matchLength], bool caseSensitive = true
) const | 291 bool startsWith(const char (&prefix)[matchLength], bool caseSensitive = true
) const |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 operator UnspecifiedBoolTypeA() const; | 403 operator UnspecifiedBoolTypeA() const; |
404 operator UnspecifiedBoolTypeB() const; | 404 operator UnspecifiedBoolTypeB() const; |
405 | 405 |
406 #if USE(CF) | 406 #if USE(CF) |
407 String(CFStringRef); | 407 String(CFStringRef); |
408 RetainPtr<CFStringRef> createCFString() const; | 408 RetainPtr<CFStringRef> createCFString() const; |
409 #endif | 409 #endif |
410 | 410 |
411 #ifdef __OBJC__ | 411 #ifdef __OBJC__ |
412 String(NSString*); | 412 String(NSString*); |
413 | 413 |
414 // This conversion maps NULL to "", which loses the meaning of NULL, but we | 414 // This conversion maps NULL to "", which loses the meaning of NULL, but we |
415 // need this mapping because AppKit crashes when passed nil NSStrings. | 415 // need this mapping because AppKit crashes when passed nil NSStrings. |
416 operator NSString*() const { if (!m_impl) return @""; return *m_impl; } | 416 operator NSString*() const { if (!m_impl) return @""; return *m_impl; } |
417 #endif | 417 #endif |
418 | 418 |
419 static String make8BitFrom16BitSource(const UChar*, size_t); | 419 static String make8BitFrom16BitSource(const UChar*, size_t); |
420 template<size_t inlineCapacity> | 420 template<size_t inlineCapacity> |
421 static String make8BitFrom16BitSource(const Vector<UChar, inlineCapacity>& b
uffer) | 421 static String make8BitFrom16BitSource(const Vector<UChar, inlineCapacity>& b
uffer) |
422 { | 422 { |
423 return make8BitFrom16BitSource(buffer.data(), buffer.size()); | 423 return make8BitFrom16BitSource(buffer.data(), buffer.size()); |
424 } | 424 } |
425 | 425 |
426 static String make16BitFrom8BitSource(const LChar*, size_t); | 426 static String make16BitFrom8BitSource(const LChar*, size_t); |
427 | 427 |
428 // String::fromUTF8 will return a null string if | 428 // String::fromUTF8 will return a null string if |
429 // the input data contains invalid UTF-8 sequences. | 429 // the input data contains invalid UTF-8 sequences. |
430 static String fromUTF8(const LChar*, size_t); | 430 static String fromUTF8(const LChar*, size_t); |
431 static String fromUTF8(const LChar*); | 431 static String fromUTF8(const LChar*); |
432 static String fromUTF8(const char* s, size_t length) { return fromUTF8(reint
erpret_cast<const LChar*>(s), length); }; | 432 static String fromUTF8(const char* s, size_t length) { return fromUTF8(reint
erpret_cast<const LChar*>(s), length); }; |
433 static String fromUTF8(const char* s) { return fromUTF8(reinterpret_cast<con
st LChar*>(s)); }; | 433 static String fromUTF8(const char* s) { return fromUTF8(reinterpret_cast<con
st LChar*>(s)); }; |
434 static String fromUTF8(const CString&); | 434 static String fromUTF8(const CString&); |
435 | 435 |
436 // Tries to convert the passed in string to UTF-8, but will fall back to Lat
in-1 if the string is not valid UTF-8. | 436 // Tries to convert the passed in string to UTF-8, but will fall back to Lat
in-1 if the string is not valid UTF-8. |
437 static String fromUTF8WithLatin1Fallback(const LChar*, size_t); | 437 static String fromUTF8WithLatin1Fallback(const LChar*, size_t); |
438 static String fromUTF8WithLatin1Fallback(const char* s, size_t length) { ret
urn fromUTF8WithLatin1Fallback(reinterpret_cast<const LChar*>(s), length); }; | 438 static String fromUTF8WithLatin1Fallback(const char* s, size_t length) { ret
urn fromUTF8WithLatin1Fallback(reinterpret_cast<const LChar*>(s), length); }; |
439 | 439 |
440 // Determines the writing direction using the Unicode Bidi Algorithm rules P
2 and P3. | 440 // Determines the writing direction using the Unicode Bidi Algorithm rules P
2 and P3. |
441 WTF::Unicode::Direction defaultWritingDirection(bool* hasStrongDirectionalit
y = 0) const | 441 WTF::Unicode::Direction defaultWritingDirection(bool* hasStrongDirectionalit
y = 0) const |
442 { | 442 { |
443 if (m_impl) | 443 if (m_impl) |
444 return m_impl->defaultWritingDirection(hasStrongDirectionality); | 444 return m_impl->defaultWritingDirection(hasStrongDirectionality); |
445 if (hasStrongDirectionality) | 445 if (hasStrongDirectionality) |
446 *hasStrongDirectionality = false; | 446 *hasStrongDirectionality = false; |
447 return WTF::Unicode::LeftToRight; | 447 return WTF::Unicode::LeftToRight; |
448 } | 448 } |
449 | 449 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 inline bool operator!=(const Vector<char, inlineCapacity>& a, const String& b) {
return !(a == b); } | 497 inline bool operator!=(const Vector<char, inlineCapacity>& a, const String& b) {
return !(a == b); } |
498 template<size_t inlineCapacity> | 498 template<size_t inlineCapacity> |
499 inline bool operator!=(const String& a, const Vector<char, inlineCapacity>& b) {
return b != a; } | 499 inline bool operator!=(const String& a, const Vector<char, inlineCapacity>& b) {
return b != a; } |
500 | 500 |
501 inline bool equalIgnoringCase(const String& a, const String& b) { return equalIg
noringCase(a.impl(), b.impl()); } | 501 inline bool equalIgnoringCase(const String& a, const String& b) { return equalIg
noringCase(a.impl(), b.impl()); } |
502 inline bool equalIgnoringCase(const String& a, const LChar* b) { return equalIgn
oringCase(a.impl(), b); } | 502 inline bool equalIgnoringCase(const String& a, const LChar* b) { return equalIgn
oringCase(a.impl(), b); } |
503 inline bool equalIgnoringCase(const String& a, const char* b) { return equalIgno
ringCase(a.impl(), reinterpret_cast<const LChar*>(b)); } | 503 inline bool equalIgnoringCase(const String& a, const char* b) { return equalIgno
ringCase(a.impl(), reinterpret_cast<const LChar*>(b)); } |
504 inline bool equalIgnoringCase(const LChar* a, const String& b) { return equalIgn
oringCase(a, b.impl()); } | 504 inline bool equalIgnoringCase(const LChar* a, const String& b) { return equalIgn
oringCase(a, b.impl()); } |
505 inline bool equalIgnoringCase(const char* a, const String& b) { return equalIgno
ringCase(reinterpret_cast<const LChar*>(a), b.impl()); } | 505 inline bool equalIgnoringCase(const char* a, const String& b) { return equalIgno
ringCase(reinterpret_cast<const LChar*>(a), b.impl()); } |
506 | 506 |
507 inline bool equalPossiblyIgnoringCase(const String& a, const String& b, bool ign
oreCase) | 507 inline bool equalPossiblyIgnoringCase(const String& a, const String& b, bool ign
oreCase) |
508 { | 508 { |
509 return ignoreCase ? equalIgnoringCase(a, b) : (a == b); | 509 return ignoreCase ? equalIgnoringCase(a, b) : (a == b); |
510 } | 510 } |
511 | 511 |
512 inline bool equalIgnoringNullity(const String& a, const String& b) { return equa
lIgnoringNullity(a.impl(), b.impl()); } | 512 inline bool equalIgnoringNullity(const String& a, const String& b) { return equa
lIgnoringNullity(a.impl(), b.impl()); } |
513 | 513 |
514 template<size_t inlineCapacity> | 514 template<size_t inlineCapacity> |
515 inline bool equalIgnoringNullity(const Vector<UChar, inlineCapacity>& a, const S
tring& b) { return equalIgnoringNullity(a, b.impl()); } | 515 inline bool equalIgnoringNullity(const Vector<UChar, inlineCapacity>& a, const S
tring& b) { return equalIgnoringNullity(a, b.impl()); } |
516 | 516 |
517 inline bool operator!(const String& str) { return str.isNull(); } | 517 inline bool operator!(const String& str) { return str.isNull(); } |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 using WTF::equal; | 730 using WTF::equal; |
731 using WTF::equalIgnoringCase; | 731 using WTF::equalIgnoringCase; |
732 using WTF::find; | 732 using WTF::find; |
733 using WTF::isAllSpecialCharacters; | 733 using WTF::isAllSpecialCharacters; |
734 using WTF::isSpaceOrNewline; | 734 using WTF::isSpaceOrNewline; |
735 using WTF::reverseFind; | 735 using WTF::reverseFind; |
736 using WTF::ASCIILiteral; | 736 using WTF::ASCIILiteral; |
737 | 737 |
738 #include "wtf/text/AtomicString.h" | 738 #include "wtf/text/AtomicString.h" |
739 #endif | 739 #endif |
OLD | NEW |