NamedMappedAttrMap.h revision d8543bb6618c17b12da906afa77d216f58cf4058
1/* 2 * This file is part of the DOM implementation for KDE. 3 * 4 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 5 * (C) 1999 Antti Koivisto (koivisto@kde.org) 6 * (C) 2001 Peter Kelly (pmk@post.com) 7 * (C) 2001 Dirk Mueller (mueller@kde.org) 8 * (C) 2007 David Smith (catfish.man@gmail.com) 9 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc. 10 * 11 * This library is free software; you can redistribute it and/or 12 * modify it under the terms of the GNU Library General Public 13 * License as published by the Free Software Foundation; either 14 * version 2 of the License, or (at your option) any later version. 15 * 16 * This library is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 * Library General Public License for more details. 20 * 21 * You should have received a copy of the GNU Library General Public License 22 * along with this library; see the file COPYING.LIB. If not, write to 23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 24 * Boston, MA 02110-1301, USA. 25 * 26 */ 27 28#ifndef NamedMappedAttrMap_h 29#define NamedMappedAttrMap_h 30 31#include "ClassNames.h" 32#include "MappedAttribute.h" 33#include "NamedAttrMap.h" 34 35namespace WebCore { 36 37class NamedMappedAttrMap : public NamedAttrMap 38{ 39public: 40 NamedMappedAttrMap(Element *e); 41 42 virtual void clearAttributes(); 43 44 virtual bool isMappedAttributeMap() const; 45 46 void parseClassAttribute(const String&); 47 48 const ClassNames* getClassNames() const { return &m_classNames; } 49 50 virtual bool hasMappedAttributes() const { return m_mappedAttributeCount > 0; } 51 void declRemoved() { m_mappedAttributeCount--; } 52 void declAdded() { m_mappedAttributeCount++; } 53 54 bool mapsEquivalent(const NamedMappedAttrMap* otherMap) const; 55 int declCount() const; 56 57 MappedAttribute* attributeItem(unsigned index) const 58 { return static_cast<MappedAttribute*>(NamedAttrMap::attributeItem(index)); } 59 MappedAttribute* getAttributeItem(const QualifiedName& name) const 60 { return static_cast<MappedAttribute*>(NamedAttrMap::getAttributeItem(name)); } 61 MappedAttribute* getAttributeItem(const String& name) const 62 { return static_cast<MappedAttribute*>(NamedAttrMap::getAttributeItem(name)); } 63 64private: 65 ClassNames m_classNames; 66 int m_mappedAttributeCount; 67}; 68 69} //namespace 70 71#endif 72