OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2009 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 |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 namespace blink { | 31 namespace blink { |
32 | 32 |
33 struct QualifiedNameComponents { | 33 struct QualifiedNameComponents { |
34 DISALLOW_NEW(); | 34 DISALLOW_NEW(); |
35 StringImpl* m_prefix; | 35 StringImpl* m_prefix; |
36 StringImpl* m_localName; | 36 StringImpl* m_localName; |
37 StringImpl* m_namespace; | 37 StringImpl* m_namespace; |
38 }; | 38 }; |
39 | 39 |
40 // This struct is used to pass data between QualifiedName and the QNameTranslato
r. | 40 // This struct is used to pass data between QualifiedName and the |
41 // For hashing and equality only the QualifiedNameComponents fields are used. | 41 // QNameTranslator. For hashing and equality only the QualifiedNameComponents |
| 42 // fields are used. |
42 struct QualifiedNameData { | 43 struct QualifiedNameData { |
43 DISALLOW_NEW(); | 44 DISALLOW_NEW(); |
44 QualifiedNameComponents m_components; | 45 QualifiedNameComponents m_components; |
45 bool m_isStatic; | 46 bool m_isStatic; |
46 }; | 47 }; |
47 | 48 |
48 class CORE_EXPORT QualifiedName { | 49 class CORE_EXPORT QualifiedName { |
49 USING_FAST_MALLOC(QualifiedName); | 50 USING_FAST_MALLOC(QualifiedName); |
50 | 51 |
51 public: | 52 public: |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 const AtomicString& localName, | 106 const AtomicString& localName, |
106 const AtomicString& namespaceURI); | 107 const AtomicString& namespaceURI); |
107 ~QualifiedName(); | 108 ~QualifiedName(); |
108 | 109 |
109 QualifiedName(const QualifiedName& other) : m_impl(other.m_impl) {} | 110 QualifiedName(const QualifiedName& other) : m_impl(other.m_impl) {} |
110 const QualifiedName& operator=(const QualifiedName& other) { | 111 const QualifiedName& operator=(const QualifiedName& other) { |
111 m_impl = other.m_impl; | 112 m_impl = other.m_impl; |
112 return *this; | 113 return *this; |
113 } | 114 } |
114 | 115 |
115 // Hash table deleted values, which are only constructed and never copied or d
estroyed. | 116 // Hash table deleted values, which are only constructed and never copied or |
| 117 // destroyed. |
116 QualifiedName(WTF::HashTableDeletedValueType) | 118 QualifiedName(WTF::HashTableDeletedValueType) |
117 : m_impl(WTF::HashTableDeletedValue) {} | 119 : m_impl(WTF::HashTableDeletedValue) {} |
118 bool isHashTableDeletedValue() const { | 120 bool isHashTableDeletedValue() const { |
119 return m_impl.isHashTableDeletedValue(); | 121 return m_impl.isHashTableDeletedValue(); |
120 } | 122 } |
121 | 123 |
122 bool operator==(const QualifiedName& other) const { | 124 bool operator==(const QualifiedName& other) const { |
123 return m_impl == other.m_impl; | 125 return m_impl == other.m_impl; |
124 } | 126 } |
125 bool operator!=(const QualifiedName& other) const { | 127 bool operator!=(const QualifiedName& other) const { |
(...skipping 27 matching lines...) Expand all Loading... |
153 | 155 |
154 String toString() const; | 156 String toString() const; |
155 | 157 |
156 QualifiedNameImpl* impl() const { return m_impl.get(); } | 158 QualifiedNameImpl* impl() const { return m_impl.get(); } |
157 | 159 |
158 // Init routine for globals | 160 // Init routine for globals |
159 static void initAndReserveCapacityForSize(unsigned size); | 161 static void initAndReserveCapacityForSize(unsigned size); |
160 | 162 |
161 static const QualifiedName& null(); | 163 static const QualifiedName& null(); |
162 | 164 |
163 // The below methods are only for creating static global QNames that need no r
ef counting. | 165 // The below methods are only for creating static global QNames that need no |
| 166 // ref counting. |
164 static void createStatic(void* targetAddress, StringImpl* name); | 167 static void createStatic(void* targetAddress, StringImpl* name); |
165 static void createStatic(void* targetAddress, | 168 static void createStatic(void* targetAddress, |
166 StringImpl* name, | 169 StringImpl* name, |
167 const AtomicString& nameNamespace); | 170 const AtomicString& nameNamespace); |
168 | 171 |
169 private: | 172 private: |
170 // This constructor is used only to create global/static QNames that don't req
uire any ref counting. | 173 // This constructor is used only to create global/static QNames that don't |
| 174 // require any ref counting. |
171 QualifiedName(const AtomicString& prefix, | 175 QualifiedName(const AtomicString& prefix, |
172 const AtomicString& localName, | 176 const AtomicString& localName, |
173 const AtomicString& namespaceURI, | 177 const AtomicString& namespaceURI, |
174 bool isStatic); | 178 bool isStatic); |
175 | 179 |
176 RefPtr<QualifiedNameImpl> m_impl; | 180 RefPtr<QualifiedNameImpl> m_impl; |
177 }; | 181 }; |
178 | 182 |
179 extern const QualifiedName& anyName; | 183 extern const QualifiedName& anyName; |
180 inline const QualifiedName& anyQName() { | 184 inline const QualifiedName& anyQName() { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 struct HashTraits<blink::QualifiedName> | 236 struct HashTraits<blink::QualifiedName> |
233 : SimpleClassHashTraits<blink::QualifiedName> { | 237 : SimpleClassHashTraits<blink::QualifiedName> { |
234 static const bool emptyValueIsZero = false; | 238 static const bool emptyValueIsZero = false; |
235 static blink::QualifiedName emptyValue() { | 239 static blink::QualifiedName emptyValue() { |
236 return blink::QualifiedName::null(); | 240 return blink::QualifiedName::null(); |
237 } | 241 } |
238 }; | 242 }; |
239 } // namespace WTF | 243 } // namespace WTF |
240 | 244 |
241 #endif | 245 #endif |
OLD | NEW |