Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: Source/wtf/text/AtomicString.h

Issue 15861022: Build WTF as dll in component build (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix AutoDrainedPool ctor and ThreadSpecificThreadExit exports Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/wtf/dtoa.h ('k') | Source/wtf/text/Base64.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/text/AtomicStringImpl.h> 24 #include "wtf/WTFExport.h"
25 #include <wtf/text/WTFString.h> 25 #include "wtf/text/AtomicStringImpl.h"
26 #include "wtf/text/WTFString.h"
26 27
27 // Define 'NO_IMPLICIT_ATOMICSTRING' before including this header, 28 // Define 'NO_IMPLICIT_ATOMICSTRING' before including this header,
28 // to disallow (expensive) implicit String-->AtomicString conversions. 29 // to disallow (expensive) implicit String-->AtomicString conversions.
29 #ifdef NO_IMPLICIT_ATOMICSTRING 30 #ifdef NO_IMPLICIT_ATOMICSTRING
30 #define ATOMICSTRING_CONVERSION explicit 31 #define ATOMICSTRING_CONVERSION explicit
31 #else 32 #else
32 #define ATOMICSTRING_CONVERSION 33 #define ATOMICSTRING_CONVERSION
33 #endif 34 #endif
34 35
35 namespace WTF { 36 namespace WTF {
36 37
37 struct AtomicStringHash; 38 struct AtomicStringHash;
38 class MemoryObjectInfo; 39 class MemoryObjectInfo;
39 40
40 class AtomicString { 41 class WTF_EXPORT AtomicString {
41 public: 42 public:
42 static void init(); 43 static void init();
43 44
44 AtomicString() { } 45 AtomicString() { }
45 AtomicString(const LChar* s) : m_string(add(s)) { } 46 AtomicString(const LChar* s) : m_string(add(s)) { }
46 AtomicString(const char* s) : m_string(add(s)) { } 47 AtomicString(const char* s) : m_string(add(s)) { }
47 AtomicString(const LChar* s, unsigned length) : m_string(add(s, length)) { } 48 AtomicString(const LChar* s, unsigned length) : m_string(add(s, length)) { }
48 AtomicString(const UChar* s, unsigned length) : m_string(add(s, length)) { } 49 AtomicString(const UChar* s, unsigned length) : m_string(add(s, length)) { }
49 AtomicString(const UChar* s, unsigned length, unsigned existingHash) : m_str ing(add(s, length, existingHash)) { } 50 AtomicString(const UChar* s, unsigned length, unsigned existingHash) : m_str ing(add(s, length, existingHash)) { }
50 AtomicString(const UChar* s) : m_string(add(s)) { } 51 AtomicString(const UChar* s) : m_string(add(s)) { }
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 static PassRefPtr<StringImpl> addFromLiteralData(const char* characters, uns igned length); 185 static PassRefPtr<StringImpl> addFromLiteralData(const char* characters, uns igned length);
185 static PassRefPtr<StringImpl> addSlowCase(StringImpl*); 186 static PassRefPtr<StringImpl> addSlowCase(StringImpl*);
186 #if USE(CF) 187 #if USE(CF)
187 static PassRefPtr<StringImpl> add(CFStringRef); 188 static PassRefPtr<StringImpl> add(CFStringRef);
188 #endif 189 #endif
189 190
190 static AtomicString fromUTF8Internal(const char*, const char*); 191 static AtomicString fromUTF8Internal(const char*, const char*);
191 }; 192 };
192 193
193 inline bool operator==(const AtomicString& a, const AtomicString& b) { return a. impl() == b.impl(); } 194 inline bool operator==(const AtomicString& a, const AtomicString& b) { return a. impl() == b.impl(); }
194 bool operator==(const AtomicString&, const LChar*); 195 WTF_EXPORT bool operator==(const AtomicString&, const LChar*);
195 inline bool operator==(const AtomicString& a, const char* b) { return WTF::equal (a.impl(), reinterpret_cast<const LChar*>(b)); } 196 inline bool operator==(const AtomicString& a, const char* b) { return WTF::equal (a.impl(), reinterpret_cast<const LChar*>(b)); }
196 inline bool operator==(const AtomicString& a, const Vector<UChar>& b) { return a .impl() && equal(a.impl(), b.data(), b.size()); } 197 inline bool operator==(const AtomicString& a, const Vector<UChar>& b) { return a .impl() && equal(a.impl(), b.data(), b.size()); }
197 inline bool operator==(const AtomicString& a, const String& b) { return equal(a. impl(), b.impl()); } 198 inline bool operator==(const AtomicString& a, const String& b) { return equal(a. impl(), b.impl()); }
198 inline bool operator==(const LChar* a, const AtomicString& b) { return b == a; } 199 inline bool operator==(const LChar* a, const AtomicString& b) { return b == a; }
199 inline bool operator==(const String& a, const AtomicString& b) { return equal(a. impl(), b.impl()); } 200 inline bool operator==(const String& a, const AtomicString& b) { return equal(a. impl(), b.impl()); }
200 inline bool operator==(const Vector<UChar>& a, const AtomicString& b) { return b == a; } 201 inline bool operator==(const Vector<UChar>& a, const AtomicString& b) { return b == a; }
201 202
202 inline bool operator!=(const AtomicString& a, const AtomicString& b) { return a. impl() != b.impl(); } 203 inline bool operator!=(const AtomicString& a, const AtomicString& b) { return a. impl() != b.impl(); }
203 inline bool operator!=(const AtomicString& a, const LChar* b) { return !(a == b) ; } 204 inline bool operator!=(const AtomicString& a, const LChar* b) { return !(a == b) ; }
204 inline bool operator!=(const AtomicString& a, const char* b) { return !(a == b); } 205 inline bool operator!=(const AtomicString& a, const char* b) { return !(a == b); }
205 inline bool operator!=(const AtomicString& a, const String& b) { return !equal(a .impl(), b.impl()); } 206 inline bool operator!=(const AtomicString& a, const String& b) { return !equal(a .impl(), b.impl()); }
206 inline bool operator!=(const AtomicString& a, const Vector<UChar>& b) { return ! (a == b); } 207 inline bool operator!=(const AtomicString& a, const Vector<UChar>& b) { return ! (a == b); }
207 inline bool operator!=(const LChar* a, const AtomicString& b) { return !(b == a) ; } 208 inline bool operator!=(const LChar* a, const AtomicString& b) { return !(b == a) ; }
208 inline bool operator!=(const String& a, const AtomicString& b) { return !equal(a .impl(), b.impl()); } 209 inline bool operator!=(const String& a, const AtomicString& b) { return !equal(a .impl(), b.impl()); }
209 inline bool operator!=(const Vector<UChar>& a, const AtomicString& b) { return ! (a == b); } 210 inline bool operator!=(const Vector<UChar>& a, const AtomicString& b) { return ! (a == b); }
210 211
211 inline bool equalIgnoringCase(const AtomicString& a, const AtomicString& b) { re turn equalIgnoringCase(a.impl(), b.impl()); } 212 inline bool equalIgnoringCase(const AtomicString& a, const AtomicString& b) { re turn equalIgnoringCase(a.impl(), b.impl()); }
212 inline bool equalIgnoringCase(const AtomicString& a, const LChar* b) { return eq ualIgnoringCase(a.impl(), b); } 213 inline bool equalIgnoringCase(const AtomicString& a, const LChar* b) { return eq ualIgnoringCase(a.impl(), b); }
213 inline bool equalIgnoringCase(const AtomicString& a, const char* b) { return equ alIgnoringCase(a.impl(), reinterpret_cast<const LChar*>(b)); } 214 inline bool equalIgnoringCase(const AtomicString& a, const char* b) { return equ alIgnoringCase(a.impl(), reinterpret_cast<const LChar*>(b)); }
214 inline bool equalIgnoringCase(const AtomicString& a, const String& b) { return e qualIgnoringCase(a.impl(), b.impl()); } 215 inline bool equalIgnoringCase(const AtomicString& a, const String& b) { return e qualIgnoringCase(a.impl(), b.impl()); }
215 inline bool equalIgnoringCase(const LChar* a, const AtomicString& b) { return eq ualIgnoringCase(a, b.impl()); } 216 inline bool equalIgnoringCase(const LChar* a, const AtomicString& b) { return eq ualIgnoringCase(a, b.impl()); }
216 inline bool equalIgnoringCase(const char* a, const AtomicString& b) { return equ alIgnoringCase(reinterpret_cast<const LChar*>(a), b.impl()); } 217 inline bool equalIgnoringCase(const char* a, const AtomicString& b) { return equ alIgnoringCase(reinterpret_cast<const LChar*>(a), b.impl()); }
217 inline bool equalIgnoringCase(const String& a, const AtomicString& b) { return e qualIgnoringCase(a.impl(), b.impl()); } 218 inline bool equalIgnoringCase(const String& a, const AtomicString& b) { return e qualIgnoringCase(a.impl(), b.impl()); }
218 219
219 // Define external global variables for the commonly used atomic strings. 220 // Define external global variables for the commonly used atomic strings.
220 // These are only usable from the main thread. 221 // These are only usable from the main thread.
221 #ifndef ATOMICSTRING_HIDE_GLOBALS 222 #ifndef ATOMICSTRING_HIDE_GLOBALS
222 extern const AtomicString nullAtom; 223 WTF_EXPORT extern const AtomicString nullAtom;
223 extern const AtomicString emptyAtom; 224 WTF_EXPORT extern const AtomicString emptyAtom;
224 extern const AtomicString textAtom; 225 WTF_EXPORT extern const AtomicString textAtom;
225 extern const AtomicString commentAtom; 226 WTF_EXPORT extern const AtomicString commentAtom;
226 extern const AtomicString starAtom; 227 WTF_EXPORT extern const AtomicString starAtom;
227 extern const AtomicString xmlAtom; 228 WTF_EXPORT extern const AtomicString xmlAtom;
228 extern const AtomicString xmlnsAtom; 229 WTF_EXPORT extern const AtomicString xmlnsAtom;
229 extern const AtomicString xlinkAtom; 230 WTF_EXPORT extern const AtomicString xlinkAtom;
230 231
231 inline AtomicString AtomicString::fromUTF8(const char* characters, size_t length ) 232 inline AtomicString AtomicString::fromUTF8(const char* characters, size_t length )
232 { 233 {
233 if (!characters) 234 if (!characters)
234 return nullAtom; 235 return nullAtom;
235 if (!length) 236 if (!length)
236 return emptyAtom; 237 return emptyAtom;
237 return fromUTF8Internal(characters, characters + length); 238 return fromUTF8Internal(characters, characters + length);
238 } 239 }
239 240
(...skipping 22 matching lines...) Expand all
262 using WTF::textAtom; 263 using WTF::textAtom;
263 using WTF::commentAtom; 264 using WTF::commentAtom;
264 using WTF::starAtom; 265 using WTF::starAtom;
265 using WTF::xmlAtom; 266 using WTF::xmlAtom;
266 using WTF::xmlnsAtom; 267 using WTF::xmlnsAtom;
267 using WTF::xlinkAtom; 268 using WTF::xlinkAtom;
268 #endif 269 #endif
269 270
270 #include <wtf/text/StringConcatenate.h> 271 #include <wtf/text/StringConcatenate.h>
271 #endif // AtomicString_h 272 #endif // AtomicString_h
OLDNEW
« no previous file with comments | « Source/wtf/dtoa.h ('k') | Source/wtf/text/Base64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698