| 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 14 matching lines...) Expand all Loading... |
| 25 // This file would be called String.h, but that conflicts with <string.h> | 25 // This file would be called String.h, but that conflicts with <string.h> |
| 26 // on systems without case-sensitive file systems. | 26 // on systems without case-sensitive file systems. |
| 27 | 27 |
| 28 #include <wtf/text/ASCIIFastPath.h> | 28 #include <wtf/text/ASCIIFastPath.h> |
| 29 #include <wtf/text/StringImpl.h> | 29 #include <wtf/text/StringImpl.h> |
| 30 | 30 |
| 31 #ifdef __OBJC__ | 31 #ifdef __OBJC__ |
| 32 #include <objc/objc.h> | 32 #include <objc/objc.h> |
| 33 #endif | 33 #endif |
| 34 | 34 |
| 35 #if PLATFORM(QT) | |
| 36 QT_BEGIN_NAMESPACE | |
| 37 class QString; | |
| 38 QT_END_NAMESPACE | |
| 39 #endif | |
| 40 | |
| 41 #if PLATFORM(WX) | |
| 42 class wxString; | |
| 43 #endif | |
| 44 | |
| 45 #if PLATFORM(BLACKBERRY) | |
| 46 namespace BlackBerry { | |
| 47 namespace Platform { | |
| 48 class String; | |
| 49 } | |
| 50 } | |
| 51 #endif | |
| 52 | |
| 53 namespace WTF { | 35 namespace WTF { |
| 54 | 36 |
| 55 class CString; | 37 class CString; |
| 56 class MemoryObjectInfo; | 38 class MemoryObjectInfo; |
| 57 struct StringHash; | 39 struct StringHash; |
| 58 | 40 |
| 59 // Declarations of string operations | 41 // Declarations of string operations |
| 60 | 42 |
| 61 WTF_EXPORT_STRING_API int charactersToIntStrict(const LChar*, size_t, bool* ok =
0, int base = 10); | 43 WTF_EXPORT_STRING_API int charactersToIntStrict(const LChar*, size_t, bool* ok =
0, int base = 10); |
| 62 WTF_EXPORT_STRING_API int charactersToIntStrict(const UChar*, size_t, bool* ok =
0, int base = 10); | 44 WTF_EXPORT_STRING_API int charactersToIntStrict(const UChar*, size_t, bool* ok =
0, int base = 10); |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 WTF_EXPORT_STRING_API String stripWhiteSpace(IsWhiteSpaceFunctionPtr) const; | 335 WTF_EXPORT_STRING_API String stripWhiteSpace(IsWhiteSpaceFunctionPtr) const; |
| 354 WTF_EXPORT_STRING_API String simplifyWhiteSpace() const; | 336 WTF_EXPORT_STRING_API String simplifyWhiteSpace() const; |
| 355 WTF_EXPORT_STRING_API String simplifyWhiteSpace(IsWhiteSpaceFunctionPtr) con
st; | 337 WTF_EXPORT_STRING_API String simplifyWhiteSpace(IsWhiteSpaceFunctionPtr) con
st; |
| 356 | 338 |
| 357 WTF_EXPORT_STRING_API String removeCharacters(CharacterMatchFunctionPtr) con
st; | 339 WTF_EXPORT_STRING_API String removeCharacters(CharacterMatchFunctionPtr) con
st; |
| 358 template<bool isSpecialCharacter(UChar)> bool isAllSpecialCharacters() const
; | 340 template<bool isSpecialCharacter(UChar)> bool isAllSpecialCharacters() const
; |
| 359 | 341 |
| 360 // Return the string with case folded for case insensitive comparison. | 342 // Return the string with case folded for case insensitive comparison. |
| 361 WTF_EXPORT_STRING_API String foldCase() const; | 343 WTF_EXPORT_STRING_API String foldCase() const; |
| 362 | 344 |
| 363 #if !PLATFORM(QT) | |
| 364 WTF_EXPORT_STRING_API static String format(const char *, ...) WTF_ATTRIBUTE_
PRINTF(1, 2); | 345 WTF_EXPORT_STRING_API static String format(const char *, ...) WTF_ATTRIBUTE_
PRINTF(1, 2); |
| 365 #else | |
| 366 WTF_EXPORT_STRING_API static String format(const char *, ...); | |
| 367 #endif | |
| 368 | 346 |
| 369 // Returns an uninitialized string. The characters needs to be written | 347 // Returns an uninitialized string. The characters needs to be written |
| 370 // into the buffer returned in data before the returned string is used. | 348 // into the buffer returned in data before the returned string is used. |
| 371 // Failure to do this will have unpredictable results. | 349 // Failure to do this will have unpredictable results. |
| 372 static String createUninitialized(unsigned length, UChar*& data) { return St
ringImpl::createUninitialized(length, data); } | 350 static String createUninitialized(unsigned length, UChar*& data) { return St
ringImpl::createUninitialized(length, data); } |
| 373 static String createUninitialized(unsigned length, LChar*& data) { return St
ringImpl::createUninitialized(length, data); } | 351 static String createUninitialized(unsigned length, LChar*& data) { return St
ringImpl::createUninitialized(length, data); } |
| 374 | 352 |
| 375 WTF_EXPORT_STRING_API void split(const String& separator, bool allowEmptyEnt
ries, Vector<String>& result) const; | 353 WTF_EXPORT_STRING_API void split(const String& separator, bool allowEmptyEnt
ries, Vector<String>& result) const; |
| 376 void split(const String& separator, Vector<String>& result) const | 354 void split(const String& separator, Vector<String>& result) const |
| 377 { | 355 { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 #endif | 397 #endif |
| 420 | 398 |
| 421 #ifdef __OBJC__ | 399 #ifdef __OBJC__ |
| 422 String(NSString*); | 400 String(NSString*); |
| 423 | 401 |
| 424 // This conversion maps NULL to "", which loses the meaning of NULL, but we | 402 // This conversion maps NULL to "", which loses the meaning of NULL, but we |
| 425 // need this mapping because AppKit crashes when passed nil NSStrings. | 403 // need this mapping because AppKit crashes when passed nil NSStrings. |
| 426 operator NSString*() const { if (!m_impl) return @""; return *m_impl; } | 404 operator NSString*() const { if (!m_impl) return @""; return *m_impl; } |
| 427 #endif | 405 #endif |
| 428 | 406 |
| 429 #if PLATFORM(QT) | |
| 430 WTF_EXPORT_STRING_API String(const QString&); | |
| 431 WTF_EXPORT_STRING_API String(const QStringRef&); | |
| 432 WTF_EXPORT_STRING_API operator QString() const; | |
| 433 #endif | |
| 434 | |
| 435 #if PLATFORM(WX) | |
| 436 WTF_EXPORT_PRIVATE String(const wxString&); | |
| 437 WTF_EXPORT_PRIVATE operator wxString() const; | |
| 438 #endif | |
| 439 | |
| 440 #if PLATFORM(BLACKBERRY) | |
| 441 String(const BlackBerry::Platform::String&); | |
| 442 operator BlackBerry::Platform::String() const; | |
| 443 #endif | |
| 444 | |
| 445 WTF_EXPORT_STRING_API static String make8BitFrom16BitSource(const UChar*, si
ze_t); | 407 WTF_EXPORT_STRING_API static String make8BitFrom16BitSource(const UChar*, si
ze_t); |
| 446 template<size_t inlineCapacity> | 408 template<size_t inlineCapacity> |
| 447 static String make8BitFrom16BitSource(const Vector<UChar, inlineCapacity>& b
uffer) | 409 static String make8BitFrom16BitSource(const Vector<UChar, inlineCapacity>& b
uffer) |
| 448 { | 410 { |
| 449 return make8BitFrom16BitSource(buffer.data(), buffer.size()); | 411 return make8BitFrom16BitSource(buffer.data(), buffer.size()); |
| 450 } | 412 } |
| 451 | 413 |
| 452 WTF_EXPORT_STRING_API static String make16BitFrom8BitSource(const LChar*, si
ze_t); | 414 WTF_EXPORT_STRING_API static String make16BitFrom8BitSource(const LChar*, si
ze_t); |
| 453 | 415 |
| 454 // String::fromUTF8 will return a null string if | 416 // String::fromUTF8 will return a null string if |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 using WTF::equal; | 673 using WTF::equal; |
| 712 using WTF::equalIgnoringCase; | 674 using WTF::equalIgnoringCase; |
| 713 using WTF::find; | 675 using WTF::find; |
| 714 using WTF::isAllSpecialCharacters; | 676 using WTF::isAllSpecialCharacters; |
| 715 using WTF::isSpaceOrNewline; | 677 using WTF::isSpaceOrNewline; |
| 716 using WTF::reverseFind; | 678 using WTF::reverseFind; |
| 717 using WTF::ASCIILiteral; | 679 using WTF::ASCIILiteral; |
| 718 | 680 |
| 719 #include <wtf/text/AtomicString.h> | 681 #include <wtf/text/AtomicString.h> |
| 720 #endif | 682 #endif |
| OLD | NEW |