This file is indexed.

/usr/include/xercesc/dom/impl/DOMNodeImpl.hpp is in libxerces-c-dev 3.1.1-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*
 * $Id: DOMNodeImpl.hpp 671894 2008-06-26 13:29:21Z borisk $
 */

#if !defined(XERCESC_INCLUDE_GUARD_DOMNODEIMPL_HPP)
#define XERCESC_INCLUDE_GUARD_DOMNODEIMPL_HPP

//
//  This file is part of the internal implementation of the C++ XML DOM.
//  It should NOT be included or used directly by application programs.
//
//  Applications should include the file <xercesc/dom/DOM.hpp> for the entire
//  DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class
//  name is substituded for the *.
//

/**
 * A DOMNodeImpl doesn't have any children, and can therefore only be directly
 * inherited by classes of nodes that never have any, such as Text nodes. For
 * other types, such as Element, classes must inherit from ParentNode.
 * <P>
 * All nodes in a single document must originate
 * in that document. (Note that this is much tighter than "must be
 * same implementation") Nodes are all aware of their ownerDocument,
 * and attempts to mismatch will throw WRONG_DOCUMENT_ERR.
 * <P>
 * However, to save memory not all nodes always have a direct reference
 * to their ownerDocument. When a node is owned by another node it relies
 * on its owner to store its ownerDocument. Parent nodes always store it
 * though, so there is never more than one level of indirection.
 * And when a node doesn't have an owner, ownerNode refers to its
 * ownerDocument.
 **/

#include <xercesc/util/XercesDefs.hpp>
#include <xercesc/dom/DOMUserDataHandler.hpp>

XERCES_CPP_NAMESPACE_BEGIN


class DOMNamedNodeMap;
class DOMNodeList;
class DOMNode;
class DOMDocument;
class DOMElement;

class CDOM_EXPORT DOMNodeImpl {
public:

    // data
    DOMNode                *fOwnerNode; // typically the parent but not always!

    unsigned short flags;

    static const unsigned short READONLY;
    static const unsigned short SYNCDATA;
    static const unsigned short SYNCCHILDREN;
    static const unsigned short OWNED;
    static const unsigned short FIRSTCHILD;
    static const unsigned short SPECIFIED;
    static const unsigned short IGNORABLEWS;
    static const unsigned short SETVALUE;
    static const unsigned short ID_ATTR;
    static const unsigned short USERDATA;
    static const unsigned short LEAFNODETYPE;
    static const unsigned short CHILDNODE;
    static const unsigned short TOBERELEASED;


public:
    DOMNodeImpl(DOMNode *ownerDocument);
    DOMNodeImpl(const DOMNodeImpl &other);
    ~DOMNodeImpl();

    DOMNode         * appendChild(DOMNode *newChild);
    DOMNamedNodeMap * getAttributes() const;
    DOMNodeList     * getChildNodes() const;
    DOMNode         * getFirstChild() const;
    DOMNode         * getLastChild() const;
    const XMLCh     * getLocalName() const;
    const XMLCh     * getNamespaceURI() const;
    DOMNode         * getNextSibling() const;
    const XMLCh     * getNodeValue() const;
    DOMDocument     * getOwnerDocument() const;
    DOMNode         * getParentNode() const;
    const XMLCh     * getPrefix() const;
    DOMNode         * getPreviousSibling() const;
    bool              hasChildNodes() const;
    DOMNode         * insertBefore(DOMNode *newChild, DOMNode *refChild);
    void              normalize();
    DOMNode         * removeChild(DOMNode *oldChild);
    DOMNode         * replaceChild(DOMNode *newChild, DOMNode *oldChild);
    void              setNodeValue(const XMLCh *value);
    void              setPrefix(const XMLCh *fPrefix);
    void              setReadOnly(bool readOnly, bool deep);
    bool              isSupported(const XMLCh *feature, const XMLCh *version) const;
    bool              hasAttributes() const;

    // Introduced in DOM Level 3
    void*             setUserData(const XMLCh* key, void* data, DOMUserDataHandler* handler);
    void*             getUserData(const XMLCh* key) const;
    bool              isSameNode(const DOMNode* other) const;
    bool              isEqualNode(const DOMNode* arg) const;
    const XMLCh*      getBaseURI() const ;
    short             compareDocumentPosition(const DOMNode* other) const;
    const XMLCh*      getTextContent() const ;
    const XMLCh*      getTextContent(XMLCh* pzBuffer, XMLSize_t& rnBufferLength) const;
    void              setTextContent(const XMLCh* textContent) ;
    const XMLCh*      lookupPrefix(const XMLCh* namespaceURI) const ;
    bool              isDefaultNamespace(const XMLCh* namespaceURI) const ;
    const XMLCh*      lookupNamespaceURI(const XMLCh* prefix) const  ;
    void*             getFeature(const XMLCh* feature, const XMLCh* version) const;


    // Helper functions for DOM Level 3
    void              release();
    void              callUserDataHandlers(DOMUserDataHandler::DOMOperationType operation,
                                           const DOMNode* src,
                                           DOMNode* dst) const;
    //reverses the bit pattern given by compareDocumentPosition
    short             reverseTreeOrderBitPattern(short pattern) const;
    const DOMNode*    getTreeParentNode(const DOMNode* node) const;


    //Utility, not part of DOM Level 2 API
    static  bool      isKidOK(DOMNode *parent, DOMNode *child);
    static const XMLCh *mapPrefix(const XMLCh *prefix,
                               const XMLCh *namespaceURI, short nType);

    static const XMLCh *getXmlnsString();
    static const XMLCh *getXmlnsURIString();
    static const XMLCh *getXmlString();
    static const XMLCh *getXmlURIString();

public: // should really be protected - ALH

    DOMNode* getElementAncestor (const DOMNode* currentNode) const;
    const XMLCh* lookupPrefix(const XMLCh* const namespaceURI, DOMElement *el) const ;
    void setOwnerDocument(DOMDocument *doc);

    /*
     * Flags setters and getters
     */

    inline bool isReadOnly() const {
        return (flags & READONLY) != 0;
    }

    inline void isReadOnly(bool value) {
        flags = (value ? flags | READONLY : flags & ~READONLY);
    }

    inline bool needsSyncData() const {
        return (flags & SYNCDATA) != 0;
    }

    inline void needsSyncData(bool value) {
        flags = (value ? flags | SYNCDATA : flags & ~SYNCDATA);
    }

    inline bool needsSyncChildren() const {
        return (flags & SYNCCHILDREN) != 0;
    }

    inline void needsSyncChildren(bool value) {
        flags = (value ? flags | SYNCCHILDREN : flags & ~SYNCCHILDREN);
    }

    // For Attributes, true if the attr node is attached to an element.
    // For all other node types, true if the node has a parent node.
    inline bool isOwned() const {
        return (flags & OWNED) != 0;
    }

    inline void isOwned(bool value) {
        flags = (value ? flags | OWNED : flags & ~OWNED);
    }

    inline bool isFirstChild() const {
        return (flags & FIRSTCHILD) != 0;
    }

    inline void isFirstChild(bool value) {
        flags = (value ? flags | FIRSTCHILD : flags & ~FIRSTCHILD);
    }

    inline bool isSpecified() const {
        return (flags & SPECIFIED) != 0;
    }

    inline void isSpecified(bool value) {
        flags = (value ? flags | SPECIFIED : flags & ~SPECIFIED);
    }

    inline bool ignorableWhitespace() const {
        return (flags & IGNORABLEWS) != 0;
    }

    inline void ignorableWhitespace(bool value) {
        flags = (value ? flags | IGNORABLEWS : flags & ~IGNORABLEWS);
    }

    inline bool setValue() const {
        return (flags & SETVALUE) != 0;
    }

    inline void setValue(bool value) {
        flags = (value ? flags | SETVALUE : flags & ~SETVALUE);
    }

    inline bool isIdAttr() const {
        return (flags & ID_ATTR) != 0;
    }

    inline void isIdAttr(bool value) {
        flags = (value ? flags | ID_ATTR : flags & ~ID_ATTR);
    }

    inline bool hasUserData() const {
        return (flags & USERDATA) != 0;
    }

    inline void hasUserData(bool value) {
        flags = (value ? flags | USERDATA : flags & ~USERDATA);
    }

    //
    //  LeafNode is set true for node types that can not be ParentNodes (can't have children)
    //    This knowledge is used to allow casting from any unknown node type to the
    //    IDParentImpl or IDChildImpl parts of the node.
    //
    inline bool isLeafNode() const {
        return (flags & LEAFNODETYPE) != 0;
    }

    inline void setIsLeafNode(bool value) {
        flags = (value ? flags | LEAFNODETYPE : flags & ~LEAFNODETYPE);
    }


    //
    // ChildNode is set true for node types that can be children of other nodes, and
    //   therefore include a DOMChildNode data member.  Note that all of the leaf
    //   node types (above flag) are also ChildNodes, but not all ChildNodes are
    //   leaf nodes.
    inline bool isChildNode() const {
        return (flags & CHILDNODE) != 0;
    }

    inline void setIsChildNode(bool value) {
        flags = (value ? flags | CHILDNODE : flags & ~CHILDNODE);
    }

    // True if this node has to be released regardless if it has a owner or not
    // This is true if called from fParent->release()
    inline bool isToBeReleased() const {
        return (flags & TOBERELEASED) != 0;
    }

    inline void isToBeReleased(bool value) {
        flags = (value ? flags | TOBERELEASED : flags & ~TOBERELEASED);
    }

};


// This macro lists all of the pure virtual functions declared in DOMNode that must
//   be implemented by all node types.  Since there is no inheritance of implementation,
//   using this macro in the class declaration of the node types make it easier to
//   accurately get all of the functions declared.
//
#define DOMNODE_FUNCTIONS \
    virtual       DOMNode*         appendChild(DOMNode *newChild) ;\
    virtual       DOMNode*         cloneNode(bool deep) const ;\
    virtual       DOMNamedNodeMap* getAttributes() const ;\
    virtual       DOMNodeList*     getChildNodes() const ;\
    virtual       DOMNode*         getFirstChild() const ;\
    virtual       DOMNode*         getLastChild() const ;\
    virtual const XMLCh*           getLocalName() const ;\
    virtual const XMLCh*           getNamespaceURI() const ;\
    virtual       DOMNode*         getNextSibling() const ;\
    virtual const XMLCh*           getNodeName() const ;\
    virtual       NodeType         getNodeType() const ;\
    virtual const XMLCh*           getNodeValue() const ;\
    virtual       DOMDocument*     getOwnerDocument() const ;\
    virtual const XMLCh*           getPrefix() const ;\
    virtual       DOMNode*         getParentNode() const ;\
    virtual       DOMNode*         getPreviousSibling() const ;\
    virtual       bool             hasChildNodes() const ;\
    virtual       DOMNode*         insertBefore(DOMNode *newChild, DOMNode *refChild) ;\
    virtual       void             normalize() ;\
    virtual       DOMNode*         removeChild(DOMNode *oldChild) ;\
    virtual       DOMNode*         replaceChild(DOMNode *newChild, DOMNode *oldChild) ;\
    virtual       void             setNodeValue(const XMLCh  *nodeValue) ;\
    virtual       bool             isSupported(const XMLCh *feature, const XMLCh *version) const ;\
    virtual       bool             hasAttributes() const ;\
    virtual       void             setPrefix(const XMLCh * prefix) ;\
    virtual       void*            setUserData(const XMLCh* key, void* data, DOMUserDataHandler* handler) ;\
    virtual       void*            getUserData(const XMLCh* key) const ;\
    virtual       bool             isSameNode(const DOMNode* other) const;\
    virtual       bool             isEqualNode(const DOMNode* arg) const;\
    virtual const XMLCh*           getBaseURI() const ;\
    virtual short                  compareDocumentPosition(const DOMNode* other) const ;\
    virtual const XMLCh*           getTextContent() const ;\
            const XMLCh*           getTextContent(XMLCh* pzBuffer, unsigned int& rnBufferLength) const;\
    virtual void                   setTextContent(const XMLCh* textContent) ;\
    virtual const XMLCh*           lookupPrefix(const XMLCh* namespaceURI) const  ;\
    virtual bool                   isDefaultNamespace(const XMLCh* namespaceURI) const;\
    virtual const XMLCh*           lookupNamespaceURI(const XMLCh* prefix) const  ;\
    virtual       void*            getFeature(const XMLCh* feature, const XMLCh* version) const ;\
    virtual       void             release()


/*
 *  Here are dummy stubs for most of the functions introduced by DOMNode.
 *    Each subclass of DOMNode will have something like this that delegates each
 *    function to the appropriate implementation.
 *    Functions that must be supplied by every node class are omitted.
 *
           DOMNode*         xxx::appendChild(DOMNode *newChild)          {return fParent.appendChild (newChild); };
           DOMNamedNodeMap* xxx::getAttributes() const                   {return fNode.getAttributes (); };
           DOMNodeList*     xxx::getChildNodes() const                   {return fParent.getChildNodes (); };
           DOMNode*         xxx::getFirstChild() const                   {return fParent.getFirstChild (); };
           DOMNode*         xxx::getLastChild() const                    {return fParent.getLastChild (); };
     const XMLCh*           xxx::getLocalName() const                    {return fNode.getLocalName (); };
     const XMLCh*           xxx::getNamespaceURI() const                 {return fNode.getNamespaceURI (); };
           DOMNode*         xxx::getNextSibling() const                  {return fChild.getNextSibling (); };
     const XMLCh*           xxx::getNodeValue() const                    {return fNode.getNodeValue (); };
           DOMDocument*     xxx::getOwnerDocument() const                {return fNode.getOwnerDocument (); };
     const XMLCh*           xxx::getPrefix() const                       {return fNode.getPrefix (); };
           DOMNode*         xxx::getParentNode() const                   {return fChild.getParentNode (this); };
           DOMNode*         xxx::getPreviousSibling() const              {return fChild.getPreviousSibling (this); };
           bool             xxx::hasChildNodes() const                   {return fParent.hasChildNodes (); };
           DOMNode*         xxx::insertBefore(DOMNode *newChild, DOMNode *refChild)
                                                                         {return fParent.insertBefore (newChild, refChild); };
           void             xxx::normalize()                             {fParent.normalize(); };
           DOMNode*         xxx::removeChild(DOMNode *oldChild)          {return fParent.removeChild (oldChild); };
           DOMNode*         xxx::replaceChild(DOMNode *newChild, DOMNode *oldChild)
                                                                         {return fParent.replaceChild (newChild, oldChild); };
           bool             xxx::isSupported(const XMLCh *feature, const XMLCh *version) const
                                                                         {return fNode.isSupported (feature, version); };
           void             xxx::setPrefix(const XMLCh  *prefix)         {fNode.setPrefix(prefix); };
           bool             xxx::hasAttributes() const                   {return fNode.hasAttributes(); };
           bool             xxx::isSameNode(const DOMNode* other) const  {return fNode.isSameNode(other); };
           bool             xxx::isEqualNode(const DOMNode* arg) const   {return fNode.isEqualNode(arg); };
           void*            xxx::setUserData(const XMLCh* key, void* data, DOMUserDataHandler* handler)
                                                                         {return fNode.setUserData(key, data, handler); };
           void*            xxx::getUserData(const XMLCh* key) const     {return fNode.getUserData(key); };
           const XMLCh*     xxx::getBaseURI() const                      {return fNode.getBaseURI(); };
           short            xxx::compareDocumentPosition(const DOMNode* other) const {return fNode.compareDocumentPosition(other); };
           const XMLCh*     xxx::getTextContent() const                  {return fNode.getTextContent(); };
           void             xxx::setTextContent(const XMLCh* textContent){fNode.setTextContent(textContent); };
           const XMLCh*     xxx::lookupPrefix(const XMLCh* namespaceURI) const {return fNode.lookupPrefix(namespaceURI); };
           bool             xxx::isDefaultNamespace(const XMLCh* namespaceURI) const {return fNode.isDefaultNamespace(namespaceURI); };
           const XMLCh*     xxx::lookupNamespaceURI(const XMLCh* prefix) const {return fNode.lookupNamespaceURI(prefix); };
           void*            xxx::getFeature(const XMLCh* feature, const XMLCh* version) const {return fNode.getFeature(feature, version); };


*/



XERCES_CPP_NAMESPACE_END

#endif