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 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 static AtomicString number(long long); | 141 static AtomicString number(long long); |
142 static AtomicString number(unsigned long long); | 142 static AtomicString number(unsigned long long); |
143 | 143 |
144 static AtomicString number(double, unsigned precision = 6, TrailingZerosTrun
catingPolicy = TruncateTrailingZeros); | 144 static AtomicString number(double, unsigned precision = 6, TrailingZerosTrun
catingPolicy = TruncateTrailingZeros); |
145 | 145 |
146 bool isNull() const { return m_string.isNull(); } | 146 bool isNull() const { return m_string.isNull(); } |
147 bool isEmpty() const { return m_string.isEmpty(); } | 147 bool isEmpty() const { return m_string.isEmpty(); } |
148 | 148 |
149 static void remove(StringImpl*); | 149 static void remove(StringImpl*); |
150 | 150 |
151 #if USE(CF) | |
152 AtomicString(CFStringRef s) : m_string(add(s)) { } | |
153 #endif | |
154 #ifdef __OBJC__ | |
155 AtomicString(NSString* s) : m_string(add((CFStringRef)s)) { } | |
156 operator NSString*() const { return m_string; } | |
157 #endif | |
158 // AtomicString::fromUTF8 will return a null string if | 151 // AtomicString::fromUTF8 will return a null string if |
159 // the input data contains invalid UTF-8 sequences. | 152 // the input data contains invalid UTF-8 sequences. |
160 static AtomicString fromUTF8(const char*, size_t); | 153 static AtomicString fromUTF8(const char*, size_t); |
161 static AtomicString fromUTF8(const char*); | 154 static AtomicString fromUTF8(const char*); |
162 | 155 |
163 CString ascii() const { return m_string.ascii(); } | 156 CString ascii() const { return m_string.ascii(); } |
164 CString latin1() const { return m_string.latin1(); } | 157 CString latin1() const { return m_string.latin1(); } |
165 CString utf8(UTF8ConversionMode mode = LenientUTF8Conversion) const { return
m_string.utf8(mode); } | 158 CString utf8(UTF8ConversionMode mode = LenientUTF8Conversion) const { return
m_string.utf8(mode); } |
166 | 159 |
167 #ifndef NDEBUG | 160 #ifndef NDEBUG |
(...skipping 12 matching lines...) Expand all Loading... |
180 static PassRefPtr<StringImpl> add(const UChar*); | 173 static PassRefPtr<StringImpl> add(const UChar*); |
181 static PassRefPtr<StringImpl> add(StringImpl*, unsigned offset, unsigned len
gth); | 174 static PassRefPtr<StringImpl> add(StringImpl*, unsigned offset, unsigned len
gth); |
182 ALWAYS_INLINE static PassRefPtr<StringImpl> add(StringImpl* r) | 175 ALWAYS_INLINE static PassRefPtr<StringImpl> add(StringImpl* r) |
183 { | 176 { |
184 if (!r || r->isAtomic()) | 177 if (!r || r->isAtomic()) |
185 return r; | 178 return r; |
186 return addSlowCase(r); | 179 return addSlowCase(r); |
187 } | 180 } |
188 static PassRefPtr<StringImpl> addFromLiteralData(const char* characters, uns
igned length); | 181 static PassRefPtr<StringImpl> addFromLiteralData(const char* characters, uns
igned length); |
189 static PassRefPtr<StringImpl> addSlowCase(StringImpl*); | 182 static PassRefPtr<StringImpl> addSlowCase(StringImpl*); |
190 #if USE(CF) | |
191 static PassRefPtr<StringImpl> add(CFStringRef); | |
192 #endif | |
193 | 183 |
194 static AtomicString fromUTF8Internal(const char*, const char*); | 184 static AtomicString fromUTF8Internal(const char*, const char*); |
195 }; | 185 }; |
196 | 186 |
197 inline bool operator==(const AtomicString& a, const AtomicString& b) { return a.
impl() == b.impl(); } | 187 inline bool operator==(const AtomicString& a, const AtomicString& b) { return a.
impl() == b.impl(); } |
198 WTF_EXPORT bool operator==(const AtomicString&, const LChar*); | 188 WTF_EXPORT bool operator==(const AtomicString&, const LChar*); |
199 inline bool operator==(const AtomicString& a, const char* b) { return WTF::equal
(a.impl(), reinterpret_cast<const LChar*>(b)); } | 189 inline bool operator==(const AtomicString& a, const char* b) { return WTF::equal
(a.impl(), reinterpret_cast<const LChar*>(b)); } |
200 inline bool operator==(const AtomicString& a, const Vector<UChar>& b) { return a
.impl() && equal(a.impl(), b.data(), b.size()); } | 190 inline bool operator==(const AtomicString& a, const Vector<UChar>& b) { return a
.impl() && equal(a.impl(), b.data(), b.size()); } |
201 inline bool operator==(const AtomicString& a, const String& b) { return equal(a.
impl(), b.impl()); } | 191 inline bool operator==(const AtomicString& a, const String& b) { return equal(a.
impl(), b.impl()); } |
202 inline bool operator==(const LChar* a, const AtomicString& b) { return b == a; } | 192 inline bool operator==(const LChar* a, const AtomicString& b) { return b == a; } |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 using WTF::nullAtom; | 252 using WTF::nullAtom; |
263 using WTF::emptyAtom; | 253 using WTF::emptyAtom; |
264 using WTF::starAtom; | 254 using WTF::starAtom; |
265 using WTF::xmlAtom; | 255 using WTF::xmlAtom; |
266 using WTF::xmlnsAtom; | 256 using WTF::xmlnsAtom; |
267 using WTF::xlinkAtom; | 257 using WTF::xlinkAtom; |
268 #endif | 258 #endif |
269 | 259 |
270 #include "wtf/text/StringConcatenate.h" | 260 #include "wtf/text/StringConcatenate.h" |
271 #endif // AtomicString_h | 261 #endif // AtomicString_h |
OLD | NEW |