File indexing completed on 2024-05-05 16:11:47

0001 /*
0002  * XPathNamespaceImpl.cpp - Copyright 2005 Frerich Raabe <raabe@kde.org>
0003  *
0004  * Redistribution and use in source and binary forms, with or without
0005  * modification, are permitted provided that the following conditions
0006  * are met:
0007  *
0008  * 1. Redistributions of source code must retain the above copyright
0009  *    notice, this list of conditions and the following disclaimer.
0010  * 2. Redistributions in binary form must reproduce the above copyright
0011  *    notice, this list of conditions and the following disclaimer in the
0012  *    documentation and/or other materials provided with the distribution.
0013  *
0014  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
0015  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
0016  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
0017  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
0018  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
0019  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0020  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0021  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0022  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
0023  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0024  */
0025 #include "XPathNamespaceImpl.h"
0026 #include "DocumentImpl.h"
0027 
0028 #include "kdomxpath.h"
0029 
0030 using namespace DOM;
0031 
0032 XPathNamespaceImpl::XPathNamespaceImpl(DocumentImpl *ptr, DOMStringImpl *prefix, DOMStringImpl *uri)
0033     : NodeImpl(ptr),
0034       m_ownerDocument(ptr),
0035       m_prefix(prefix),
0036       m_uri(uri)
0037 {
0038 }
0039 
0040 XPathNamespaceImpl::XPathNamespaceImpl(const XPathNamespaceImpl &other)
0041     : NodeImpl(other)
0042 {
0043     NodeImpl::operator=(other);
0044     *this = other;
0045 }
0046 
0047 XPathNamespaceImpl::~XPathNamespaceImpl()
0048 {
0049 }
0050 
0051 XPathNamespaceImpl &XPathNamespaceImpl::operator=(const XPathNamespaceImpl &other)
0052 {
0053     m_prefix = other.m_prefix;
0054     m_uri = other.m_uri;
0055     return *this;
0056 }
0057 
0058 DocumentImpl *XPathNamespaceImpl::ownerDocument() const
0059 {
0060     return m_ownerDocument;
0061 }
0062 
0063 ElementImpl *XPathNamespaceImpl::ownerElement() const
0064 {
0065     // XXX
0066     return 0;
0067 }
0068 
0069 const AtomicString &XPathNamespaceImpl::prefix() const
0070 {
0071     return m_prefix;
0072 }
0073 
0074 DOMString XPathNamespaceImpl::nodeName() const
0075 {
0076     return DOMString(m_prefix);
0077 }
0078 
0079 const AtomicString &XPathNamespaceImpl::namespaceURI() const
0080 {
0081     return m_uri;
0082 }
0083 
0084 unsigned short XPathNamespaceImpl::nodeType() const
0085 {
0086     return XPATH_NAMESPACE_NODE;
0087 }
0088