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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 enum ConstructFromLiteralTag { ConstructFromLiteral }; | 58 enum ConstructFromLiteralTag { ConstructFromLiteral }; |
59 AtomicString(const char* characters, unsigned length, ConstructFromLiteralTa
g) | 59 AtomicString(const char* characters, unsigned length, ConstructFromLiteralTa
g) |
60 : m_string(addFromLiteralData(characters, length)) | 60 : m_string(addFromLiteralData(characters, length)) |
61 { | 61 { |
62 } | 62 } |
63 | 63 |
64 template<unsigned charactersCount> | 64 template<unsigned charactersCount> |
65 ALWAYS_INLINE AtomicString(const char (&characters)[charactersCount], Constr
uctFromLiteralTag) | 65 ALWAYS_INLINE AtomicString(const char (&characters)[charactersCount], Constr
uctFromLiteralTag) |
66 : m_string(addFromLiteralData(characters, charactersCount - 1)) | 66 : m_string(addFromLiteralData(characters, charactersCount - 1)) |
67 { | 67 { |
68 COMPILE_ASSERT(charactersCount > 1, AtomicStringFromLiteralNotEmpty); | 68 static_assert(charactersCount > 1, "AtomicString FromLiteralData should
not be empty"); |
69 COMPILE_ASSERT((charactersCount - 1 <= ((unsigned(~0) - sizeof(StringImp
l)) / sizeof(LChar))), AtomicStringFromLiteralCannotOverflow); | 69 static_assert((charactersCount - 1 <= ((unsigned(~0) - sizeof(StringImpl
)) / sizeof(LChar))), "AtomicString FromLiteralData cannot overflow"); |
70 } | 70 } |
71 | 71 |
72 // Hash table deleted values, which are only constructed and never copied or
destroyed. | 72 // Hash table deleted values, which are only constructed and never copied or
destroyed. |
73 AtomicString(WTF::HashTableDeletedValueType) : m_string(WTF::HashTableDelete
dValue) { } | 73 AtomicString(WTF::HashTableDeletedValueType) : m_string(WTF::HashTableDelete
dValue) { } |
74 bool isHashTableDeletedValue() const { return m_string.isHashTableDeletedVal
ue(); } | 74 bool isHashTableDeletedValue() const { return m_string.isHashTableDeletedVal
ue(); } |
75 | 75 |
76 static StringImpl* find(const StringImpl*); | 76 static StringImpl* find(const StringImpl*); |
77 | 77 |
78 operator const String&() const { return m_string; } | 78 operator const String&() const { return m_string; } |
79 const String& string() const { return m_string; }; | 79 const String& string() const { return m_string; }; |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 using WTF::AtomicString; | 248 using WTF::AtomicString; |
249 using WTF::nullAtom; | 249 using WTF::nullAtom; |
250 using WTF::emptyAtom; | 250 using WTF::emptyAtom; |
251 using WTF::starAtom; | 251 using WTF::starAtom; |
252 using WTF::xmlAtom; | 252 using WTF::xmlAtom; |
253 using WTF::xmlnsAtom; | 253 using WTF::xmlnsAtom; |
254 using WTF::xlinkAtom; | 254 using WTF::xlinkAtom; |
255 | 255 |
256 #include "wtf/text/StringConcatenate.h" | 256 #include "wtf/text/StringConcatenate.h" |
257 #endif // AtomicString_h | 257 #endif // AtomicString_h |
OLD | NEW |