| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2010, 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2010, 2011, 2012 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 11 matching lines...) Expand all Loading... |
| 22 #define SpaceSplitString_h | 22 #define SpaceSplitString_h |
| 23 | 23 |
| 24 #include "wtf/RefCounted.h" | 24 #include "wtf/RefCounted.h" |
| 25 #include "wtf/Vector.h" | 25 #include "wtf/Vector.h" |
| 26 #include "wtf/text/AtomicString.h" | 26 #include "wtf/text/AtomicString.h" |
| 27 | 27 |
| 28 namespace blink { | 28 namespace blink { |
| 29 | 29 |
| 30 class SpaceSplitString { | 30 class SpaceSplitString { |
| 31 public: | 31 public: |
| 32 enum CaseFolding { ShouldNotFoldCase, ShouldFoldCase }; |
| 32 SpaceSplitString() { } | 33 SpaceSplitString() { } |
| 33 SpaceSplitString(const AtomicString& string, bool shouldFoldCase) { set(stri
ng, shouldFoldCase); } | 34 SpaceSplitString(const AtomicString& string, CaseFolding caseFolding) { set(
string, caseFolding); } |
| 34 | 35 |
| 35 bool operator!=(const SpaceSplitString& other) const { return m_data != othe
r.m_data; } | 36 bool operator!=(const SpaceSplitString& other) const { return m_data != othe
r.m_data; } |
| 36 | 37 |
| 37 void set(const AtomicString&, bool shouldFoldCase); | 38 void set(const AtomicString&, CaseFolding); |
| 38 void clear() { m_data.clear(); } | 39 void clear() { m_data.clear(); } |
| 39 | 40 |
| 40 bool contains(const AtomicString& string) const { return m_data && m_data->c
ontains(string); } | 41 bool contains(const AtomicString& string) const { return m_data && m_data->c
ontains(string); } |
| 41 bool containsAll(const SpaceSplitString& names) const { return !names.m_data
|| (m_data && m_data->containsAll(*names.m_data)); } | 42 bool containsAll(const SpaceSplitString& names) const { return !names.m_data
|| (m_data && m_data->containsAll(*names.m_data)); } |
| 42 void add(const AtomicString&); | 43 void add(const AtomicString&); |
| 43 bool remove(const AtomicString&); | 44 bool remove(const AtomicString&); |
| 44 | 45 |
| 45 size_t size() const { return m_data ? m_data->size() : 0; } | 46 size_t size() const { return m_data ? m_data->size() : 0; } |
| 46 bool isNull() const { return !m_data; } | 47 bool isNull() const { return !m_data; } |
| 47 const AtomicString& operator[](size_t i) const { ASSERT_WITH_SECURITY_IMPLIC
ATION(i < size()); return (*m_data)[i]; } | 48 const AtomicString& operator[](size_t i) const { ASSERT_WITH_SECURITY_IMPLIC
ATION(i < size()); return (*m_data)[i]; } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 if (m_data && !m_data->isUnique()) | 94 if (m_data && !m_data->isUnique()) |
| 94 m_data = Data::createUnique(*m_data); | 95 m_data = Data::createUnique(*m_data); |
| 95 } | 96 } |
| 96 | 97 |
| 97 RefPtr<Data> m_data; | 98 RefPtr<Data> m_data; |
| 98 }; | 99 }; |
| 99 | 100 |
| 100 } // namespace blink | 101 } // namespace blink |
| 101 | 102 |
| 102 #endif // SpaceSplitString_h | 103 #endif // SpaceSplitString_h |
| OLD | NEW |