~ubuntu-branches/ubuntu/precise/xerces-c/precise

« back to all changes in this revision

Viewing changes to src/xercesc/dom/impl/DOMNotationImpl.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jay Berkenbilt
  • Date: 2009-02-22 16:52:23 UTC
  • Revision ID: james.westby@ubuntu.com-20090222165223-klimp8u8m73yn9zp
Tags: upstream-3.0.1
ImportĀ upstreamĀ versionĀ 3.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
 
3
 * contributor license agreements.  See the NOTICE file distributed with
 
4
 * this work for additional information regarding copyright ownership.
 
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
 
6
 * (the "License"); you may not use this file except in compliance with
 
7
 * the License.  You may obtain a copy of the License at
 
8
 *
 
9
 *      http://www.apache.org/licenses/LICENSE-2.0
 
10
 *
 
11
 * Unless required by applicable law or agreed to in writing, software
 
12
 * distributed under the License is distributed on an "AS IS" BASIS,
 
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
14
 * See the License for the specific language governing permissions and
 
15
 * limitations under the License.
 
16
 */
 
17
 
 
18
/*
 
19
 * $Id: DOMNotationImpl.cpp 671894 2008-06-26 13:29:21Z borisk $
 
20
 */
 
21
 
 
22
#include "DOMDocumentImpl.hpp"
 
23
#include "DOMNotationImpl.hpp"
 
24
#include <xercesc/dom/DOMException.hpp>
 
25
#include <xercesc/dom/DOMNode.hpp>
 
26
 
 
27
XERCES_CPP_NAMESPACE_BEGIN
 
28
 
 
29
DOMNotationImpl::DOMNotationImpl(DOMDocument *ownerDoc, const XMLCh *nName)
 
30
    : fNode(ownerDoc), fName(0), fPublicId(0), fSystemId(0), fBaseURI(0)
 
31
{
 
32
    fNode.setIsLeafNode(true);
 
33
    fName = ((DOMDocumentImpl *)ownerDoc)->getPooledString(nName);
 
34
}
 
35
 
 
36
DOMNotationImpl::DOMNotationImpl(const DOMNotationImpl &other, bool /*deep*/)
 
37
    : DOMNotation(other),
 
38
      fNode(other.fNode),
 
39
      fName(other.fName),
 
40
      fPublicId(other.fPublicId),
 
41
      fSystemId(other.fSystemId),
 
42
      fBaseURI(other.fBaseURI)
 
43
{
 
44
    fNode.setIsLeafNode(true);
 
45
}
 
46
 
 
47
 
 
48
DOMNotationImpl::~DOMNotationImpl()
 
49
{
 
50
}
 
51
 
 
52
 
 
53
DOMNode *DOMNotationImpl::cloneNode(bool deep) const
 
54
{
 
55
    DOMNode* newNode = new (getOwnerDocument(), DOMMemoryManager::NOTATION_OBJECT) DOMNotationImpl(*this, deep);
 
56
    fNode.callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, this, newNode);
 
57
    return newNode;
 
58
}
 
59
 
 
60
 
 
61
const XMLCh * DOMNotationImpl::getNodeName() const {
 
62
    return fName;
 
63
}
 
64
 
 
65
 
 
66
DOMNode::NodeType DOMNotationImpl::getNodeType() const {
 
67
    return DOMNode::NOTATION_NODE;
 
68
}
 
69
 
 
70
 
 
71
 
 
72
const XMLCh * DOMNotationImpl::getPublicId() const
 
73
{
 
74
    return fPublicId;
 
75
}
 
76
 
 
77
 
 
78
const XMLCh * DOMNotationImpl::getSystemId() const
 
79
{
 
80
    return fSystemId;
 
81
}
 
82
 
 
83
 
 
84
void DOMNotationImpl::setNodeValue(const XMLCh *arg)
 
85
{
 
86
    fNode.setNodeValue(arg);
 
87
}
 
88
 
 
89
 
 
90
void DOMNotationImpl::setPublicId(const XMLCh *arg)
 
91
{
 
92
    if(fNode.isReadOnly())
 
93
        throw DOMException(
 
94
        DOMException::NO_MODIFICATION_ALLOWED_ERR,0, GetDOMNodeMemoryManager);
 
95
 
 
96
    fPublicId = ((DOMDocumentImpl *)getOwnerDocument())->cloneString(arg);
 
97
}
 
98
 
 
99
 
 
100
void DOMNotationImpl::setSystemId(const XMLCh *arg)
 
101
{
 
102
    if(fNode.isReadOnly())
 
103
        throw DOMException(
 
104
        DOMException::NO_MODIFICATION_ALLOWED_ERR,0, GetDOMNodeMemoryManager);
 
105
 
 
106
    fSystemId = ((DOMDocumentImpl *)getOwnerDocument())->cloneString(arg);
 
107
}
 
108
 
 
109
void DOMNotationImpl::release()
 
110
{
 
111
    if (fNode.isOwned() && !fNode.isToBeReleased())
 
112
        throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
 
113
 
 
114
    DOMDocumentImpl* doc = (DOMDocumentImpl*) getOwnerDocument();
 
115
    if (doc) {
 
116
        fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0);
 
117
        doc->release(this, DOMMemoryManager::NOTATION_OBJECT);
 
118
    }
 
119
    else {
 
120
        // shouldn't reach here
 
121
        throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
 
122
    }
 
123
}
 
124
 
 
125
void DOMNotationImpl::setBaseURI(const XMLCh* baseURI) {
 
126
    if (baseURI && *baseURI) {
 
127
        XMLCh* temp = (XMLCh*) ((DOMDocumentImpl *)getOwnerDocument())->allocate((XMLString::stringLen(baseURI) + 9)*sizeof(XMLCh));
 
128
        XMLString::fixURI(baseURI, temp);
 
129
        fBaseURI = temp;
 
130
    }
 
131
    else
 
132
        fBaseURI = 0;
 
133
}
 
134
 
 
135
const XMLCh* DOMNotationImpl::getBaseURI() const
 
136
{
 
137
    return fBaseURI;
 
138
}
 
139
 
 
140
 
 
141
           DOMNode*         DOMNotationImpl::appendChild(DOMNode *newChild)          {return fNode.appendChild (newChild); }
 
142
           DOMNamedNodeMap* DOMNotationImpl::getAttributes() const                   {return fNode.getAttributes (); }
 
143
           DOMNodeList*     DOMNotationImpl::getChildNodes() const                   {return fNode.getChildNodes (); }
 
144
           DOMNode*         DOMNotationImpl::getFirstChild() const                   {return fNode.getFirstChild (); }
 
145
           DOMNode*         DOMNotationImpl::getLastChild() const                    {return fNode.getLastChild (); }
 
146
     const XMLCh*           DOMNotationImpl::getLocalName() const                    {return fNode.getLocalName (); }
 
147
     const XMLCh*           DOMNotationImpl::getNamespaceURI() const                 {return fNode.getNamespaceURI (); }
 
148
           DOMNode*         DOMNotationImpl::getNextSibling() const                  {return fNode.getNextSibling (); }
 
149
     const XMLCh*           DOMNotationImpl::getNodeValue() const                    {return fNode.getNodeValue (); }
 
150
           DOMDocument*     DOMNotationImpl::getOwnerDocument() const                {return fNode.getOwnerDocument (); }
 
151
     const XMLCh*           DOMNotationImpl::getPrefix() const                       {return fNode.getPrefix (); }
 
152
           DOMNode*         DOMNotationImpl::getParentNode() const                   {return fNode.getParentNode (); }
 
153
           DOMNode*         DOMNotationImpl::getPreviousSibling() const              {return fNode.getPreviousSibling (); }
 
154
           bool             DOMNotationImpl::hasChildNodes() const                   {return fNode.hasChildNodes (); }
 
155
           DOMNode*         DOMNotationImpl::insertBefore(DOMNode *newChild, DOMNode *refChild)
 
156
                                                                                     {return fNode.insertBefore (newChild, refChild); }
 
157
           void             DOMNotationImpl::normalize()                             {fNode.normalize (); }
 
158
           DOMNode*         DOMNotationImpl::removeChild(DOMNode *oldChild)          {return fNode.removeChild (oldChild); }
 
159
           DOMNode*         DOMNotationImpl::replaceChild(DOMNode *newChild, DOMNode *oldChild)
 
160
                                                                                     {return fNode.replaceChild (newChild, oldChild); }
 
161
           bool             DOMNotationImpl::isSupported(const XMLCh *feature, const XMLCh *version) const
 
162
                                                                                     {return fNode.isSupported (feature, version); }
 
163
           void             DOMNotationImpl::setPrefix(const XMLCh  *prefix)         {fNode.setPrefix(prefix); }
 
164
           bool             DOMNotationImpl::hasAttributes() const                   {return fNode.hasAttributes(); }
 
165
           bool             DOMNotationImpl::isSameNode(const DOMNode* other) const  {return fNode.isSameNode(other); }
 
166
           bool             DOMNotationImpl::isEqualNode(const DOMNode* arg) const   {return fNode.isEqualNode(arg); }
 
167
           void*            DOMNotationImpl::setUserData(const XMLCh* key, void* data, DOMUserDataHandler* handler)
 
168
                                                                                     {return fNode.setUserData(key, data, handler); }
 
169
           void*            DOMNotationImpl::getUserData(const XMLCh* key) const     {return fNode.getUserData(key); }
 
170
           short            DOMNotationImpl::compareDocumentPosition(const DOMNode* other) const {return fNode.compareDocumentPosition(other); }
 
171
           const XMLCh*     DOMNotationImpl::getTextContent() const                  {return fNode.getTextContent(); }
 
172
           void             DOMNotationImpl::setTextContent(const XMLCh* textContent){fNode.setTextContent(textContent); }
 
173
           const XMLCh*     DOMNotationImpl::lookupPrefix(const XMLCh* namespaceURI) const  {return fNode.lookupPrefix(namespaceURI); }
 
174
           bool             DOMNotationImpl::isDefaultNamespace(const XMLCh* namespaceURI) const {return fNode.isDefaultNamespace(namespaceURI); }
 
175
           const XMLCh*     DOMNotationImpl::lookupNamespaceURI(const XMLCh* prefix) const  {return fNode.lookupNamespaceURI(prefix); }
 
176
           void*            DOMNotationImpl::getFeature(const XMLCh* feature, const XMLCh* version) const {return fNode.getFeature(feature, version); }
 
177
 
 
178
 
 
179
XERCES_CPP_NAMESPACE_END