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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 | 421 |
422 static String make8BitFrom16BitSource(const UChar*, size_t); | 422 static String make8BitFrom16BitSource(const UChar*, size_t); |
423 template<size_t inlineCapacity> | 423 template<size_t inlineCapacity> |
424 static String make8BitFrom16BitSource(const Vector<UChar, inlineCapacity>& b
uffer) | 424 static String make8BitFrom16BitSource(const Vector<UChar, inlineCapacity>& b
uffer) |
425 { | 425 { |
426 return make8BitFrom16BitSource(buffer.data(), buffer.size()); | 426 return make8BitFrom16BitSource(buffer.data(), buffer.size()); |
427 } | 427 } |
428 | 428 |
429 static String make16BitFrom8BitSource(const LChar*, size_t); | 429 static String make16BitFrom8BitSource(const LChar*, size_t); |
430 | 430 |
431 // String::fromUTF8 will return a null string if | 431 // String::fromUTF8 will return a null string if the input data contains |
432 // the input data contains invalid UTF-8 sequences. | 432 // invalid UTF-8 sequences. When |strict| is false, isolated surrogates are |
433 static String fromUTF8(const LChar*, size_t); | 433 // converted. |
| 434 static String fromUTF8(const LChar*, size_t, bool strict = true); |
434 static String fromUTF8(const LChar*); | 435 static String fromUTF8(const LChar*); |
435 static String fromUTF8(const char* s, size_t length) { return fromUTF8(reint
erpret_cast<const LChar*>(s), length); } | 436 static String fromUTF8(const char* s, size_t length) { return fromUTF8(reint
erpret_cast<const LChar*>(s), length); } |
436 static String fromUTF8(const char* s) { return fromUTF8(reinterpret_cast<con
st LChar*>(s)); } | 437 static String fromUTF8(const char* s) { return fromUTF8(reinterpret_cast<con
st LChar*>(s)); } |
437 static String fromUTF8(const CString&); | 438 static String fromUTF8(const CString&); |
438 | 439 |
439 // Tries to convert the passed in string to UTF-8, but will fall back to | 440 // Tries to convert the passed in string to UTF-8, but will fall back to |
440 // Latin-1 if the string is not valid UTF-8. | 441 // Latin-1 if the string is not valid UTF-8. |
441 static String fromUTF8WithLatin1Fallback(const LChar*, size_t); | 442 static String fromUTF8WithLatin1Fallback(const LChar*, size_t); |
442 static String fromUTF8WithLatin1Fallback(const char* s, size_t length) { ret
urn fromUTF8WithLatin1Fallback(reinterpret_cast<const LChar*>(s), length); } | 443 static String fromUTF8WithLatin1Fallback(const char* s, size_t length) { ret
urn fromUTF8WithLatin1Fallback(reinterpret_cast<const LChar*>(s), length); } |
443 | 444 |
| 445 // Helper methods to call fromUTF8() with |strict| = false. |
| 446 static String fromUTF8Lenient(const LChar* s, size_t length) { return fromUT
F8(s, length, false); } |
| 447 static String fromUTF8Lenient(const char* s, size_t length) { return fromUTF
8Lenient(reinterpret_cast<const LChar*>(s), length); } |
| 448 |
444 bool containsOnlyASCII() const; | 449 bool containsOnlyASCII() const; |
445 bool containsOnlyLatin1() const; | 450 bool containsOnlyLatin1() const; |
446 bool containsOnlyWhitespace() const { return !m_impl || m_impl->containsOnly
Whitespace(); } | 451 bool containsOnlyWhitespace() const { return !m_impl || m_impl->containsOnly
Whitespace(); } |
447 | 452 |
448 // Hash table deleted values, which are only constructed and never copied or | 453 // Hash table deleted values, which are only constructed and never copied or |
449 // destroyed. | 454 // destroyed. |
450 String(WTF::HashTableDeletedValueType) : m_impl(WTF::HashTableDeletedValue)
{ } | 455 String(WTF::HashTableDeletedValueType) : m_impl(WTF::HashTableDeletedValue)
{ } |
451 bool isHashTableDeletedValue() const { return m_impl.isHashTableDeletedValue
(); } | 456 bool isHashTableDeletedValue() const { return m_impl.isHashTableDeletedValue
(); } |
452 | 457 |
453 #ifndef NDEBUG | 458 #ifndef NDEBUG |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 using WTF::charactersToFloat; | 711 using WTF::charactersToFloat; |
707 using WTF::equal; | 712 using WTF::equal; |
708 using WTF::equalIgnoringCase; | 713 using WTF::equalIgnoringCase; |
709 using WTF::find; | 714 using WTF::find; |
710 using WTF::isAllSpecialCharacters; | 715 using WTF::isAllSpecialCharacters; |
711 using WTF::isSpaceOrNewline; | 716 using WTF::isSpaceOrNewline; |
712 using WTF::reverseFind; | 717 using WTF::reverseFind; |
713 | 718 |
714 #include "wtf/text/AtomicString.h" | 719 #include "wtf/text/AtomicString.h" |
715 #endif // WTFString_h | 720 #endif // WTFString_h |
OLD | NEW |