2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
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.
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.
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.
21 #ifndef CSSParserValues_h
22 #define CSSParserValues_h
24 #include "AtomicString.h"
30 struct CSSParserString {
36 operator String() const { return String(characters, length); }
37 operator AtomicString() const { return AtomicString(characters, length); }
40 struct CSSParserFunction;
42 struct CSSParserValue {
48 CSSParserString string;
49 CSSParserFunction* function;
58 bool isVariable() const;
60 PassRefPtr<CSSValue> createCSSValue();
63 class CSSParserValueList : public FastAllocBase {
70 ~CSSParserValueList();
72 void addValue(const CSSParserValue&);
73 void deleteValueAt(unsigned);
75 unsigned size() const { return m_values.size(); }
76 CSSParserValue* current() { return m_current < m_values.size() ? &m_values[m_current] : 0; }
77 CSSParserValue* next() { ++m_current; return current(); }
79 CSSParserValue* valueAt(unsigned i) { return i < m_values.size() ? &m_values[i] : 0; }
81 void clear() { m_values.clear(); }
83 bool containsVariables() const { return m_variablesCount; }
87 unsigned m_variablesCount;
88 Vector<CSSParserValue, 4> m_values;
91 struct CSSParserFunction : FastAllocBase {
93 CSSParserValueList* args;
95 ~CSSParserFunction() { delete args; }