#ifndef DOMTokenList_h
#define DOMTokenList_h
#include <wtf/text/AtomicString.h>
#include <wtf/Vector.h>
namespace WebCore {
class Element;
typedef int ExceptionCode;
class DOMTokenList {
WTF_MAKE_NONCOPYABLE(DOMTokenList); WTF_MAKE_FAST_ALLOCATED;
public:
DOMTokenList() { }
virtual ~DOMTokenList() {};
virtual void ref() = 0;
virtual void deref() = 0;
virtual unsigned length() const = 0;
virtual const AtomicString item(unsigned index) const = 0;
bool contains(const AtomicString&, ExceptionCode&) const;
void add(const Vector<String>&, ExceptionCode&);
void add(const AtomicString&, ExceptionCode&);
void remove(const Vector<String>&, ExceptionCode&);
void remove(const AtomicString&, ExceptionCode&);
bool toggle(const AtomicString&, ExceptionCode&);
bool toggle(const AtomicString&, bool force, ExceptionCode&);
AtomicString toString() const { return value(); }
virtual Element* element() const { return 0; }
protected:
virtual AtomicString value() const = 0;
virtual void setValue(const AtomicString&) = 0;
void addInternal(const AtomicString&);
virtual bool containsInternal(const AtomicString&) const = 0;
void removeInternal(const AtomicString&);
static bool validateToken(const AtomicString&, ExceptionCode&);
static bool validateTokens(const Vector<String>&, ExceptionCode&);
static String addToken(const AtomicString&, const AtomicString&);
static String addTokens(const AtomicString&, const Vector<String>&);
static String removeToken(const AtomicString&, const AtomicString&);
static String removeTokens(const AtomicString&, const Vector<String>&);
};
}
#endif // DOMTokenList_h