1 | /* |
2 | * (C) 1999-2003 Lars Knoll (knoll@kde.org) |
3 | * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. |
4 | * |
5 | * This library is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU Library General Public |
7 | * License as published by the Free Software Foundation; either |
8 | * version 2 of the License, or (at your option) any later version. |
9 | * |
10 | * This library is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | * Library General Public License for more details. |
14 | * |
15 | * You should have received a copy of the GNU Library General Public License |
16 | * along with this library; see the file COPYING.LIB. If not, write to |
17 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 | * Boston, MA 02110-1301, USA. |
19 | */ |
20 | |
21 | #pragma once |
22 | |
23 | #include "CSSPrimitiveValue.h" |
24 | #include <wtf/text/WTFString.h> |
25 | |
26 | namespace WebCore { |
27 | |
28 | class Counter final : public RefCounted<Counter> { |
29 | public: |
30 | static Ref<Counter> create(Ref<CSSPrimitiveValue>&& identifier, Ref<CSSPrimitiveValue>&& listStyle, Ref<CSSPrimitiveValue>&& separator) |
31 | { |
32 | return adoptRef(*new Counter(WTFMove(identifier), WTFMove(listStyle), WTFMove(separator))); |
33 | } |
34 | |
35 | String identifier() const { return m_identifier->stringValue(); } |
36 | String listStyle() const { return m_listStyle->stringValue(); } |
37 | String separator() const { return m_separator->stringValue(); } |
38 | |
39 | const CSSPrimitiveValue& identifierValue() const { return m_identifier; } |
40 | const CSSPrimitiveValue& listStyleValue() const { return m_listStyle; } |
41 | const CSSPrimitiveValue& separatorValue() const { return m_separator; } |
42 | |
43 | CSSValueID listStyleIdent() const { return m_listStyle->valueID(); } |
44 | |
45 | void setIdentifier(Ref<CSSPrimitiveValue>&& identifier) { m_identifier = WTFMove(identifier); } |
46 | void setListStyle(Ref<CSSPrimitiveValue>&& listStyle) { m_listStyle = WTFMove(listStyle); } |
47 | void setSeparator(Ref<CSSPrimitiveValue>&& separator) { m_separator = WTFMove(separator); } |
48 | |
49 | bool equals(const Counter& other) const |
50 | { |
51 | return identifier() == other.identifier() |
52 | && listStyle() == other.listStyle() |
53 | && separator() == other.separator(); |
54 | } |
55 | |
56 | private: |
57 | Counter(Ref<CSSPrimitiveValue>&& identifier, Ref<CSSPrimitiveValue>&& listStyle, Ref<CSSPrimitiveValue>&& separator) |
58 | : m_identifier(WTFMove(identifier)) |
59 | , m_listStyle(WTFMove(listStyle)) |
60 | , m_separator(WTFMove(separator)) |
61 | { |
62 | } |
63 | |
64 | Ref<CSSPrimitiveValue> m_identifier; // string |
65 | Ref<CSSPrimitiveValue> m_listStyle; // ident |
66 | Ref<CSSPrimitiveValue> m_separator; // string |
67 | }; |
68 | |
69 | } // namespace WebCore |
70 | |