Changeset 65478 in webkit for trunk/JavaScriptCore/runtime/UString.h
- Timestamp:
- Aug 16, 2010, 7:13:02 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/UString.h
r65468 r65478 1 1 /* 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 * 11 * 12 * 13 * 14 * 15 * 16 * 17 * 18 * 19 * 2 * Copyright (C) 1999-2000 Harri Porten ([email protected]) 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 4 * Copyright (C) 2009 Google Inc. All rights reserved. 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Library General Public 8 * License as published by the Free Software Foundation; either 9 * version 2 of the License, or (at your option) any later version. 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Library General Public License for more details. 15 * 16 * You should have received a copy of the GNU Library General Public License 17 * along with this library; see the file COPYING.LIB. If not, write to 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 * Boston, MA 02110-1301, USA. 20 20 * 21 21 */ … … 24 24 #define UString_h 25 25 26 #include "Collector.h"27 #include <stdint.h>28 #include <string.h>29 #include <wtf/Assertions.h>30 #include <wtf/CrossThreadRefCounted.h>31 #include <wtf/OwnFastMallocPtr.h>32 #include <wtf/PassRefPtr.h>33 #include <wtf/RefPtr.h>34 #include <wtf/Vector.h>35 #include <wtf/text/CString.h>36 26 #include <wtf/text/StringImpl.h> 37 #include <wtf/unicode/Unicode.h>38 27 39 28 namespace JSC { … … 51 40 52 41 // Construct a string with latin1 data. 42 UString(const char* characters, unsigned length); 43 44 // Construct a string with latin1 data, from a null-terminated source. 53 45 UString(const char* characters); 54 55 // Construct a string with latin1 data, from a null-terminated source.56 UString(const char* characters, unsigned length);57 46 58 47 // Construct a string referencing an existing StringImpl. … … 206 195 } 207 196 208 // We'd rather not do shared substring append for small strings, since209 // this runs too much risk of a tiny initial string holding down a210 // huge buffer.211 static const unsigned minShareSize = Heap::minExtraCost / sizeof(UChar);212 213 struct IdentifierRepHash : PtrHash<RefPtr<StringImpl> > {214 static unsigned hash(const RefPtr<StringImpl>& key) { return key->existingHash(); }215 static unsigned hash(StringImpl* key) { return key->existingHash(); }216 };217 218 197 } // namespace JSC 219 198 220 199 namespace WTF { 221 222 template<typename T> struct DefaultHash;223 template<typename T> struct StrHash;224 225 template<> struct StrHash<StringImpl*> {226 static unsigned hash(const StringImpl* key) { return key->hash(); }227 static bool equal(const StringImpl* a, const StringImpl* b) { return ::equal(a, b); }228 static const bool safeToCompareToEmptyOrDeleted = false;229 };230 231 template<> struct StrHash<RefPtr<StringImpl> > : public StrHash<StringImpl*> {232 using StrHash<StringImpl*>::hash;233 static unsigned hash(const RefPtr<StringImpl>& key) { return key->hash(); }234 using StrHash<StringImpl*>::equal;235 static bool equal(const RefPtr<StringImpl>& a, const RefPtr<StringImpl>& b) { return ::equal(a.get(), b.get()); }236 static bool equal(const StringImpl* a, const RefPtr<StringImpl>& b) { return ::equal(a, b.get()); }237 static bool equal(const RefPtr<StringImpl>& a, const StringImpl* b) { return ::equal(a.get(), b); }238 239 static const bool safeToCompareToEmptyOrDeleted = false;240 };241 200 242 201 template <> struct VectorTraits<JSC::UString> : SimpleClassVectorTraits … … 244 203 static const bool canInitializeWithMemset = true; 245 204 }; 246 205 247 206 } // namespace WTF 248 207
Note:
See TracChangeset
for help on using the changeset viewer.