| 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/Allocator.h" | 24 #include "wtf/Allocator.h" |
| 25 #include "wtf/HashTableDeletedValueType.h" | 25 #include "wtf/HashTableDeletedValueType.h" |
| 26 #include "wtf/WTFExport.h" | 26 #include "wtf/WTFExport.h" |
| 27 #include "wtf/text/CString.h" | 27 #include "wtf/text/CString.h" |
| 28 #include "wtf/text/StringView.h" |
| 28 #include "wtf/text/WTFString.h" | 29 #include "wtf/text/WTFString.h" |
| 29 #include <cstring> | 30 #include <cstring> |
| 30 #include <iosfwd> | 31 #include <iosfwd> |
| 31 | 32 |
| 32 namespace WTF { | 33 namespace WTF { |
| 33 | 34 |
| 34 struct AtomicStringHash; | 35 struct AtomicStringHash; |
| 35 | 36 |
| 36 class WTF_EXPORT AtomicString { | 37 class WTF_EXPORT AtomicString { |
| 37 USING_FAST_MALLOC(AtomicString); | 38 USING_FAST_MALLOC(AtomicString); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 | 227 |
| 227 inline AtomicString AtomicString::fromUTF8(const char* characters) | 228 inline AtomicString AtomicString::fromUTF8(const char* characters) |
| 228 { | 229 { |
| 229 if (!characters) | 230 if (!characters) |
| 230 return nullAtom; | 231 return nullAtom; |
| 231 if (!*characters) | 232 if (!*characters) |
| 232 return emptyAtom; | 233 return emptyAtom; |
| 233 return fromUTF8Internal(characters, 0); | 234 return fromUTF8Internal(characters, 0); |
| 234 } | 235 } |
| 235 | 236 |
| 237 inline StringView::StringView(const AtomicString& string) |
| 238 : StringView(string, 0, string.length()) {} |
| 239 inline StringView::StringView(const AtomicString& string, unsigned offset, unsig
ned length) |
| 240 : StringView(string.impl(), offset, length) {} |
| 241 inline StringView::StringView(const AtomicString& string, unsigned offset) |
| 242 : StringView(string.impl(), offset) {} |
| 243 |
| 236 // AtomicStringHash is the default hash for AtomicString | 244 // AtomicStringHash is the default hash for AtomicString |
| 237 template<typename T> struct DefaultHash; | 245 template<typename T> struct DefaultHash; |
| 238 template<> struct DefaultHash<AtomicString> { | 246 template<> struct DefaultHash<AtomicString> { |
| 239 typedef AtomicStringHash Hash; | 247 typedef AtomicStringHash Hash; |
| 240 }; | 248 }; |
| 241 | 249 |
| 242 // Pretty printer for gtest and base/logging.*. It prepends and appends | 250 // Pretty printer for gtest and base/logging.*. It prepends and appends |
| 243 // double-quotes, and escapes chracters other than ASCII printables. | 251 // double-quotes, and escapes chracters other than ASCII printables. |
| 244 WTF_EXPORT std::ostream& operator<<(std::ostream&, const AtomicString&); | 252 WTF_EXPORT std::ostream& operator<<(std::ostream&, const AtomicString&); |
| 245 | 253 |
| 246 } // namespace WTF | 254 } // namespace WTF |
| 247 | 255 |
| 248 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(AtomicString); | 256 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(AtomicString); |
| 249 | 257 |
| 250 using WTF::AtomicString; | 258 using WTF::AtomicString; |
| 251 using WTF::nullAtom; | 259 using WTF::nullAtom; |
| 252 using WTF::emptyAtom; | 260 using WTF::emptyAtom; |
| 253 using WTF::starAtom; | 261 using WTF::starAtom; |
| 254 using WTF::xmlAtom; | 262 using WTF::xmlAtom; |
| 255 using WTF::xmlnsAtom; | 263 using WTF::xmlnsAtom; |
| 256 using WTF::xlinkAtom; | 264 using WTF::xlinkAtom; |
| 257 | 265 |
| 258 #include "wtf/text/StringConcatenate.h" | 266 #include "wtf/text/StringConcatenate.h" |
| 259 #endif // AtomicString_h | 267 #endif // AtomicString_h |
| OLD | NEW |