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

Side by Side Diff: Source/core/dom/SpaceSplitString.h

Issue 1035573005: Change a bool type to an enum type in constructor argument of SpaceSplitString. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Draft Created 5 years, 9 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
OLDNEW
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
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., 59 Temple Place - Suite 330, 16 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA. 17 * Boston, MA 02111-1307, USA.
18 * 18 *
19 */ 19 */
20 20
21 #ifndef SpaceSplitString_h 21 #ifndef SpaceSplitString_h
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 enum SplitStringCase {
Mike West 2015/03/26 19:33:05 I'd prefer you to move this into SpaceSplitString
31 ShouldNotFoldCase,
32 ShouldFoldCase
33 };
34
30 class SpaceSplitString { 35 class SpaceSplitString {
31 public: 36 public:
32 SpaceSplitString() { } 37 SpaceSplitString() { }
33 SpaceSplitString(const AtomicString& string, bool shouldFoldCase) { set(stri ng, shouldFoldCase); } 38 SpaceSplitString(const AtomicString& string, SplitStringCase splitStringCase ) { set(string, splitStringCase); }
34 39
35 bool operator!=(const SpaceSplitString& other) const { return m_data != othe r.m_data; } 40 bool operator!=(const SpaceSplitString& other) const { return m_data != othe r.m_data; }
36 41
37 void set(const AtomicString&, bool shouldFoldCase); 42 void set(const AtomicString&, SplitStringCase);
38 void clear() { m_data.clear(); } 43 void clear() { m_data.clear(); }
39 44
40 bool contains(const AtomicString& string) const { return m_data && m_data->c ontains(string); } 45 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)); } 46 bool containsAll(const SpaceSplitString& names) const { return !names.m_data || (m_data && m_data->containsAll(*names.m_data)); }
42 void add(const AtomicString&); 47 void add(const AtomicString&);
43 bool remove(const AtomicString&); 48 bool remove(const AtomicString&);
44 49
45 size_t size() const { return m_data ? m_data->size() : 0; } 50 size_t size() const { return m_data ? m_data->size() : 0; }
46 bool isNull() const { return !m_data; } 51 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]; } 52 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
93 if (m_data && !m_data->isUnique()) 98 if (m_data && !m_data->isUnique())
94 m_data = Data::createUnique(*m_data); 99 m_data = Data::createUnique(*m_data);
95 } 100 }
96 101
97 RefPtr<Data> m_data; 102 RefPtr<Data> m_data;
98 }; 103 };
99 104
100 } // namespace blink 105 } // namespace blink
101 106
102 #endif // SpaceSplitString_h 107 #endif // SpaceSplitString_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698