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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 WTF_EXPORT float charactersToFloat(const UChar*, size_t, size_t& parsedLength); | 75 WTF_EXPORT float charactersToFloat(const UChar*, size_t, size_t& parsedLength); |
76 | 76 |
77 enum TrailingZerosTruncatingPolicy { | 77 enum TrailingZerosTruncatingPolicy { |
78 KeepTrailingZeros, | 78 KeepTrailingZeros, |
79 TruncateTrailingZeros | 79 TruncateTrailingZeros |
80 }; | 80 }; |
81 | 81 |
82 template<bool isSpecialCharacter(UChar), typename CharacterType> | 82 template<bool isSpecialCharacter(UChar), typename CharacterType> |
83 bool isAllSpecialCharacters(const CharacterType*, size_t); | 83 bool isAllSpecialCharacters(const CharacterType*, size_t); |
84 | 84 |
85 // FIXME: Remove this class once all callers are gone. | |
86 class ASCIILiteral { | |
87 public: | |
88 explicit ASCIILiteral(const char* characters) : m_characters(characters) { } | |
89 operator const char*() { return m_characters; } | |
90 | |
91 private: | |
92 const char* m_characters; | |
93 }; | |
94 | |
95 // You can find documentation about this class in this doc: | 85 // You can find documentation about this class in this doc: |
96 // https://docs.google.com/document/d/1kOCUlJdh2WJMJGDf-WoEQhmnjKLaOYRbiHz5TiGJl
14/edit?usp=sharing | 86 // https://docs.google.com/document/d/1kOCUlJdh2WJMJGDf-WoEQhmnjKLaOYRbiHz5TiGJl
14/edit?usp=sharing |
97 class WTF_EXPORT String { | 87 class WTF_EXPORT String { |
98 public: | 88 public: |
99 // Construct a null string, distinguishable from an empty string. | 89 // Construct a null string, distinguishable from an empty string. |
100 String() { } | 90 String() { } |
101 | 91 |
102 // Construct a string with UTF-16 data. | 92 // Construct a string with UTF-16 data. |
103 String(const UChar* characters, unsigned length); | 93 String(const UChar* characters, unsigned length); |
104 | 94 |
(...skipping 19 matching lines...) Expand all Loading... |
124 String(const char* characters); | 114 String(const char* characters); |
125 | 115 |
126 // Construct a string referencing an existing StringImpl. | 116 // Construct a string referencing an existing StringImpl. |
127 String(StringImpl* impl) : m_impl(impl) { } | 117 String(StringImpl* impl) : m_impl(impl) { } |
128 String(PassRefPtr<StringImpl> impl) : m_impl(impl) { } | 118 String(PassRefPtr<StringImpl> impl) : m_impl(impl) { } |
129 String(RefPtr<StringImpl> impl) : m_impl(impl) { } | 119 String(RefPtr<StringImpl> impl) : m_impl(impl) { } |
130 | 120 |
131 // FIXME: Remove this API once all callers are gone. | 121 // FIXME: Remove this API once all callers are gone. |
132 enum ConstructFromLiteralTag { ConstructFromLiteral }; | 122 enum ConstructFromLiteralTag { ConstructFromLiteral }; |
133 String(const char* characters, ConstructFromLiteralTag) : m_impl(StringImpl:
:create(reinterpret_cast<const LChar*>(characters))) { } | 123 String(const char* characters, ConstructFromLiteralTag) : m_impl(StringImpl:
:create(reinterpret_cast<const LChar*>(characters))) { } |
134 String(ASCIILiteral literal) : m_impl(StringImpl::create(reinterpret_cast<co
nst LChar*>(static_cast<const char*>(literal)))) { } | |
135 | 124 |
136 #if COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES) | 125 #if COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES) |
137 // We have to declare the copy constructor and copy assignment operator as w
ell, otherwise | 126 // We have to declare the copy constructor and copy assignment operator as w
ell, otherwise |
138 // they'll be implicitly deleted by adding the move constructor and move ass
ignment operator. | 127 // they'll be implicitly deleted by adding the move constructor and move ass
ignment operator. |
139 String(const String& other) : m_impl(other.m_impl) { } | 128 String(const String& other) : m_impl(other.m_impl) { } |
140 String(String&& other) : m_impl(other.m_impl.release()) { } | 129 String(String&& other) : m_impl(other.m_impl.release()) { } |
141 String& operator=(const String& other) { m_impl = other.m_impl; return *this
; } | 130 String& operator=(const String& other) { m_impl = other.m_impl; return *this
; } |
142 String& operator=(String&& other) { m_impl = other.m_impl.release(); return
*this; } | 131 String& operator=(String&& other) { m_impl = other.m_impl.release(); return
*this; } |
143 #endif | 132 #endif |
144 | 133 |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 using WTF::charactersToUInt64; | 708 using WTF::charactersToUInt64; |
720 using WTF::charactersToIntPtr; | 709 using WTF::charactersToIntPtr; |
721 using WTF::charactersToDouble; | 710 using WTF::charactersToDouble; |
722 using WTF::charactersToFloat; | 711 using WTF::charactersToFloat; |
723 using WTF::equal; | 712 using WTF::equal; |
724 using WTF::equalIgnoringCase; | 713 using WTF::equalIgnoringCase; |
725 using WTF::find; | 714 using WTF::find; |
726 using WTF::isAllSpecialCharacters; | 715 using WTF::isAllSpecialCharacters; |
727 using WTF::isSpaceOrNewline; | 716 using WTF::isSpaceOrNewline; |
728 using WTF::reverseFind; | 717 using WTF::reverseFind; |
729 using WTF::ASCIILiteral; | |
730 | 718 |
731 #include "wtf/text/AtomicString.h" | 719 #include "wtf/text/AtomicString.h" |
732 #endif | 720 #endif |
OLD | NEW |