File indexing completed on 2024-04-28 15:23:03

0001 /*
0002  * This file is part of the DOM implementation for KDE.
0003  *
0004  * Copyright (C) 2005 Apple Computer, Inc.
0005  * Copyright (C) 2008 Vyacheslav Tokarev (tsjoker@gmail.com)
0006  *
0007  * This library is free software; you can redistribute it and/or
0008  * modify it under the terms of the GNU Library General Public
0009  * License as published by the Free Software Foundation; either
0010  * version 2 of the License, or (at your option) any later version.
0011  *
0012  * This library is distributed in the hope that it will be useful,
0013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0015  * Library General Public License for more details.
0016  *
0017  * You should have received a copy of the GNU Library General Public License
0018  * along with this library; see the file COPYING.LIB.  If not, write to
0019  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0020  * Boston, MA 02110-1301, USA.
0021  *
0022  */
0023 #ifndef _DOM_QUALIFIEDNAME_h_
0024 #define _DOM_QUALIFIEDNAME_h_
0025 
0026 #include "misc/idstring.h"
0027 #include "misc/htmlnames.h"
0028 
0029 namespace DOM
0030 {
0031 
0032 /*class DOMString;
0033 class PrefixName;
0034 class LocalName;
0035 class NamespaceName;*/
0036 
0037 class QualifiedName
0038 {
0039 public:
0040     QualifiedName() {}
0041     QualifiedName(PrefixName prefix, LocalName localName, NamespaceName namespaceURI) : m_namespace(namespaceURI), m_prefix(prefix), m_localName(localName) {}
0042     QualifiedName(const DOMString &prefix, const DOMString &localName, const DOMString &namespaceURI);
0043     QualifiedName(int prefix, int localName, int namespaceName);
0044     //QualifiedName(DOMString namespaceURI, DOMString prefix, DOMString localName);
0045     QualifiedName(quint32 id, PrefixName prefix);
0046     ~QualifiedName() {}
0047 
0048     QualifiedName(const QualifiedName &name);
0049     const QualifiedName &operator=(const QualifiedName &name);
0050 
0051     bool operator==(const QualifiedName &other) const;
0052     //inline bool operator!=(const QualifiedName& other) const { return (m_prefix != other.prefixId() || m_localName != other.localNameId() || m_namespace != other.namespaceNameId()); }
0053 
0054     bool matches(const QualifiedName &other) const;
0055 
0056     inline bool hasPrefix() const;
0057     void setPrefix(const PrefixName &prefix);
0058     void setPrefix(const DOMString &prefix);
0059 
0060     inline PrefixName prefixId() const
0061     {
0062         return m_prefix;
0063     }
0064     inline LocalName localNameId() const
0065     {
0066         return m_localName;
0067     }
0068     inline NamespaceName namespaceNameId() const
0069     {
0070         return m_namespace;
0071     }
0072     unsigned id() const;
0073 
0074     DOMString tagName() const;
0075 
0076     DOMString prefix() const;
0077     DOMString localName() const;
0078     DOMString namespaceURI() const;
0079 
0080     DOMString toString() const;
0081 
0082 private:
0083     NamespaceName m_namespace;
0084     PrefixName m_prefix;
0085     LocalName m_localName;
0086 };
0087 
0088 }
0089 
0090 #endif