OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 * Library General Public License for more details. | 12 * Library General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU Library General Public License | 14 * You should have received a copy of the GNU Library General Public License |
15 * along with this library; see the file COPYING.LIB. If not, write to | 15 * along with this library; see the file COPYING.LIB. If not, write to |
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
17 * Boston, MA 02110-1301, USA. | 17 * Boston, MA 02110-1301, USA. |
18 * | 18 * |
19 */ | 19 */ |
20 | 20 |
21 #ifndef AtomicString_h | 21 #ifndef AtomicString_h |
22 #define AtomicString_h | 22 #define AtomicString_h |
23 | 23 |
24 #include "wtf/HashTableDeletedValueType.h" | 24 #include "wtf/HashTableDeletedValueType.h" |
25 #include "wtf/WTFExport.h" | 25 #include "wtf/WTFExport.h" |
26 #include "wtf/text/AtomicStringImpl.h" | |
27 #include "wtf/text/WTFString.h" | 26 #include "wtf/text/WTFString.h" |
28 | 27 |
29 // Define 'NO_IMPLICIT_ATOMICSTRING' before including this header, | 28 // Define 'NO_IMPLICIT_ATOMICSTRING' before including this header, |
30 // to disallow (expensive) implicit String-->AtomicString conversions. | 29 // to disallow (expensive) implicit String-->AtomicString conversions. |
31 #ifdef NO_IMPLICIT_ATOMICSTRING | 30 #ifdef NO_IMPLICIT_ATOMICSTRING |
32 #define ATOMICSTRING_CONVERSION explicit | 31 #define ATOMICSTRING_CONVERSION explicit |
33 #else | 32 #else |
34 #define ATOMICSTRING_CONVERSION | 33 #define ATOMICSTRING_CONVERSION |
35 #endif | 34 #endif |
36 | 35 |
(...skipping 13 matching lines...) Expand all Loading... |
50 AtomicString(const UChar* s, unsigned length, unsigned existingHash) : m_str
ing(add(s, length, existingHash)) { } | 49 AtomicString(const UChar* s, unsigned length, unsigned existingHash) : m_str
ing(add(s, length, existingHash)) { } |
51 AtomicString(const UChar* s) : m_string(add(s)) { } | 50 AtomicString(const UChar* s) : m_string(add(s)) { } |
52 | 51 |
53 template<size_t inlineCapacity> | 52 template<size_t inlineCapacity> |
54 explicit AtomicString(const Vector<UChar, inlineCapacity>& characters) | 53 explicit AtomicString(const Vector<UChar, inlineCapacity>& characters) |
55 : m_string(add(characters.data(), characters.size())) | 54 : m_string(add(characters.data(), characters.size())) |
56 { | 55 { |
57 } | 56 } |
58 | 57 |
59 ATOMICSTRING_CONVERSION AtomicString(StringImpl* imp) : m_string(add(imp)) {
} | 58 ATOMICSTRING_CONVERSION AtomicString(StringImpl* imp) : m_string(add(imp)) {
} |
60 AtomicString(AtomicStringImpl* imp) : m_string(imp) { } | |
61 ATOMICSTRING_CONVERSION AtomicString(const String& s) : m_string(add(s.impl(
))) { } | 59 ATOMICSTRING_CONVERSION AtomicString(const String& s) : m_string(add(s.impl(
))) { } |
62 AtomicString(StringImpl* baseString, unsigned start, unsigned length) : m_st
ring(add(baseString, start, length)) { } | 60 AtomicString(StringImpl* baseString, unsigned start, unsigned length) : m_st
ring(add(baseString, start, length)) { } |
63 | 61 |
64 enum ConstructFromLiteralTag { ConstructFromLiteral }; | 62 enum ConstructFromLiteralTag { ConstructFromLiteral }; |
65 AtomicString(const char* characters, unsigned length, ConstructFromLiteralTa
g) | 63 AtomicString(const char* characters, unsigned length, ConstructFromLiteralTa
g) |
66 : m_string(addFromLiteralData(characters, length)) | 64 : m_string(addFromLiteralData(characters, length)) |
67 { | 65 { |
68 } | 66 } |
69 | 67 |
70 template<unsigned charactersCount> | 68 template<unsigned charactersCount> |
(...skipping 12 matching lines...) Expand all Loading... |
83 AtomicString(const AtomicString& other) : m_string(other.m_string) { } | 81 AtomicString(const AtomicString& other) : m_string(other.m_string) { } |
84 AtomicString(AtomicString&& other) : m_string(static_cast<String&&>(other.m_
string)) { } | 82 AtomicString(AtomicString&& other) : m_string(static_cast<String&&>(other.m_
string)) { } |
85 AtomicString& operator=(const AtomicString& other) { m_string = other.m_stri
ng; return *this; } | 83 AtomicString& operator=(const AtomicString& other) { m_string = other.m_stri
ng; return *this; } |
86 AtomicString& operator=(AtomicString&& other) { m_string = static_cast<Strin
g&&>(other.m_string); return *this; } | 84 AtomicString& operator=(AtomicString&& other) { m_string = static_cast<Strin
g&&>(other.m_string); return *this; } |
87 #endif | 85 #endif |
88 | 86 |
89 // Hash table deleted values, which are only constructed and never copied or
destroyed. | 87 // Hash table deleted values, which are only constructed and never copied or
destroyed. |
90 AtomicString(WTF::HashTableDeletedValueType) : m_string(WTF::HashTableDelete
dValue) { } | 88 AtomicString(WTF::HashTableDeletedValueType) : m_string(WTF::HashTableDelete
dValue) { } |
91 bool isHashTableDeletedValue() const { return m_string.isHashTableDeletedVal
ue(); } | 89 bool isHashTableDeletedValue() const { return m_string.isHashTableDeletedVal
ue(); } |
92 | 90 |
93 static AtomicStringImpl* find(const StringImpl*); | 91 static StringImpl* find(const StringImpl*); |
94 | 92 |
95 operator const String&() const { return m_string; } | 93 operator const String&() const { return m_string; } |
96 const String& string() const { return m_string; }; | 94 const String& string() const { return m_string; }; |
97 | 95 |
98 AtomicStringImpl* impl() const { return static_cast<AtomicStringImpl *>(m_st
ring.impl()); } | 96 StringImpl* impl() const { return m_string.impl(); } |
99 | 97 |
100 bool is8Bit() const { return m_string.is8Bit(); } | 98 bool is8Bit() const { return m_string.is8Bit(); } |
101 const LChar* characters8() const { return m_string.characters8(); } | 99 const LChar* characters8() const { return m_string.characters8(); } |
102 const UChar* characters16() const { return m_string.characters16(); } | 100 const UChar* characters16() const { return m_string.characters16(); } |
103 unsigned length() const { return m_string.length(); } | 101 unsigned length() const { return m_string.length(); } |
104 | 102 |
105 UChar operator[](unsigned int i) const { return m_string[i]; } | 103 UChar operator[](unsigned int i) const { return m_string[i]; } |
106 | 104 |
107 bool contains(UChar c) const { return m_string.contains(c); } | 105 bool contains(UChar c) const { return m_string.contains(c); } |
108 bool contains(const LChar* s, bool caseSensitive = true) const | 106 bool contains(const LChar* s, bool caseSensitive = true) const |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 using WTF::textAtom; | 260 using WTF::textAtom; |
263 using WTF::commentAtom; | 261 using WTF::commentAtom; |
264 using WTF::starAtom; | 262 using WTF::starAtom; |
265 using WTF::xmlAtom; | 263 using WTF::xmlAtom; |
266 using WTF::xmlnsAtom; | 264 using WTF::xmlnsAtom; |
267 using WTF::xlinkAtom; | 265 using WTF::xlinkAtom; |
268 #endif | 266 #endif |
269 | 267 |
270 #include "wtf/text/StringConcatenate.h" | 268 #include "wtf/text/StringConcatenate.h" |
271 #endif // AtomicString_h | 269 #endif // AtomicString_h |
OLD | NEW |