Chromium Code Reviews| 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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 336 | 336 |
| 337 void ensure16Bit(); | 337 void ensure16Bit(); |
| 338 | 338 |
| 339 void truncate(unsigned len); | 339 void truncate(unsigned len); |
| 340 void remove(unsigned pos, int len = 1); | 340 void remove(unsigned pos, int len = 1); |
| 341 | 341 |
| 342 String substring(unsigned pos, unsigned len = UINT_MAX) const; | 342 String substring(unsigned pos, unsigned len = UINT_MAX) const; |
| 343 String left(unsigned len) const { return substring(0, len); } | 343 String left(unsigned len) const { return substring(0, len); } |
| 344 String right(unsigned len) const { return substring(length() - len, len); } | 344 String right(unsigned len) const { return substring(length() - len, len); } |
| 345 | 345 |
| 346 StringView createView() const { return StringView(impl()); } | |
| 347 StringView createView(unsigned offset, unsigned length) const { return Strin gView(impl(), offset, length); } | |
| 348 | |
| 349 // Returns a lowercase/uppercase version of the string | 346 // Returns a lowercase/uppercase version of the string |
| 350 String lower() const; | 347 String lower() const; |
| 351 String upper() const; | 348 String upper() const; |
| 352 | 349 |
| 353 String lower(const AtomicString& localeIdentifier) const; | 350 String lower(const AtomicString& localeIdentifier) const; |
| 354 String upper(const AtomicString& localeIdentifier) const; | 351 String upper(const AtomicString& localeIdentifier) const; |
| 355 | 352 |
| 356 String stripWhiteSpace() const; | 353 String stripWhiteSpace() const; |
| 357 String stripWhiteSpace(IsWhiteSpaceFunctionPtr) const; | 354 String stripWhiteSpace(IsWhiteSpaceFunctionPtr) const; |
| 358 String simplifyWhiteSpace(StripBehavior = StripExtraWhiteSpace) const; | 355 String simplifyWhiteSpace(StripBehavior = StripExtraWhiteSpace) const; |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 660 if (is8Bit()) { | 657 if (is8Bit()) { |
| 661 size_t oldSize = result.size(); | 658 size_t oldSize = result.size(); |
| 662 result.resize(oldSize + numberOfCharactersToCopy); | 659 result.resize(oldSize + numberOfCharactersToCopy); |
| 663 memmove(result.data() + numberOfCharactersToCopy, result.data(), oldSize * sizeof(UChar)); | 660 memmove(result.data() + numberOfCharactersToCopy, result.data(), oldSize * sizeof(UChar)); |
| 664 StringImpl::copyChars(result.data(), m_impl->characters8() + pos, number OfCharactersToCopy); | 661 StringImpl::copyChars(result.data(), m_impl->characters8() + pos, number OfCharactersToCopy); |
| 665 } else { | 662 } else { |
| 666 result.prepend(m_impl->characters16() + pos, numberOfCharactersToCopy); | 663 result.prepend(m_impl->characters16() + pos, numberOfCharactersToCopy); |
| 667 } | 664 } |
| 668 } | 665 } |
| 669 | 666 |
| 667 inline StringView::StringView(const String& string) | |
| 668 : StringView(string, 0, string.length()) {} | |
| 669 inline StringView::StringView(const String& string, unsigned offset, unsigned le ngth) | |
| 670 : StringView(string.impl(), offset, length) {} | |
| 671 inline StringView::StringView(const String& string, unsigned offset) | |
| 672 : StringView(string.impl(), offset) {} | |
|
Yuta Kitamura
2016/05/27 04:47:41
Having inline definitions of StringView here looks
| |
| 673 | |
| 670 // StringHash is the default hash for String | 674 // StringHash is the default hash for String |
| 671 template<typename T> struct DefaultHash; | 675 template<typename T> struct DefaultHash; |
| 672 template<> struct DefaultHash<String> { | 676 template<> struct DefaultHash<String> { |
| 673 typedef StringHash Hash; | 677 typedef StringHash Hash; |
| 674 }; | 678 }; |
| 675 | 679 |
| 676 // Shared global empty string. | 680 // Shared global empty string. |
| 677 WTF_EXPORT const String& emptyString(); | 681 WTF_EXPORT const String& emptyString(); |
| 678 WTF_EXPORT const String& emptyString16Bit(); | 682 WTF_EXPORT const String& emptyString16Bit(); |
| 679 WTF_EXPORT extern const String& xmlnsWithColon; | 683 WTF_EXPORT extern const String& xmlnsWithColon; |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 707 using WTF::charactersToFloat; | 711 using WTF::charactersToFloat; |
| 708 using WTF::equal; | 712 using WTF::equal; |
| 709 using WTF::equalIgnoringCase; | 713 using WTF::equalIgnoringCase; |
| 710 using WTF::find; | 714 using WTF::find; |
| 711 using WTF::isAllSpecialCharacters; | 715 using WTF::isAllSpecialCharacters; |
| 712 using WTF::isSpaceOrNewline; | 716 using WTF::isSpaceOrNewline; |
| 713 using WTF::reverseFind; | 717 using WTF::reverseFind; |
| 714 | 718 |
| 715 #include "wtf/text/AtomicString.h" | 719 #include "wtf/text/AtomicString.h" |
| 716 #endif // WTFString_h | 720 #endif // WTFString_h |
| OLD | NEW |