Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:27:01

0001 /*
0002  * Licensed to the Apache Software Foundation (ASF) under one or more
0003  * contributor license agreements.  See the NOTICE file distributed with
0004  * this work for additional information regarding copyright ownership.
0005  * The ASF licenses this file to You under the Apache License, Version 2.0
0006  * (the "License"); you may not use this file except in compliance with
0007  * the License.  You may obtain a copy of the License at
0008  * 
0009  *      http://www.apache.org/licenses/LICENSE-2.0
0010  * 
0011  * Unless required by applicable law or agreed to in writing, software
0012  * distributed under the License is distributed on an "AS IS" BASIS,
0013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014  * See the License for the specific language governing permissions and
0015  * limitations under the License.
0016  */
0017 
0018 /*
0019  * $Id$
0020  */
0021 
0022 #if !defined(XERCESC_INCLUDE_GUARD_DOMELEMENTIMPL_HPP)
0023 #define XERCESC_INCLUDE_GUARD_DOMELEMENTIMPL_HPP
0024 
0025 //
0026 //  This file is part of the internal implementation of the C++ XML DOM.
0027 //  It should NOT be included or used directly by application programs.
0028 //
0029 //  Applications should include the file <xercesc/dom/DOM.hpp> for the entire
0030 //  DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class
0031 //  name is substituded for the *.
0032 //
0033 
0034 
0035 #include <xercesc/util/XercesDefs.hpp>
0036 #include <xercesc/util/XMLString.hpp>
0037 #include <xercesc/dom/DOMElement.hpp>
0038 
0039 #include "DOMNodeBase.hpp"
0040 #include "DOMChildNode.hpp"
0041 #include "DOMNodeImpl.hpp"
0042 #include "DOMParentNode.hpp"
0043 
0044 #include "DOMAttrMapImpl.hpp"
0045 
0046 XERCES_CPP_NAMESPACE_BEGIN
0047 
0048 class DOMTypeInfo;
0049 class DOMNodeList;
0050 class DOMAttrMapImpl;
0051 class DOMDocument;
0052 
0053 
0054 
0055 
0056 class CDOM_EXPORT DOMElementImpl: public DOMElement,
0057         public HasDOMNodeImpl, public HasDOMParentImpl, public HasDOMChildImpl {
0058 public:
0059     DOMNodeImpl       fNode;
0060     DOMParentNode     fParent;
0061     DOMChildNode      fChild;
0062     DOMAttrMapImpl    *fAttributes;
0063     DOMAttrMapImpl    *fDefaultAttributes;
0064     const XMLCh      *fName;
0065 
0066 public:
0067     DOMElementImpl(DOMDocument *ownerDoc, const XMLCh *name);
0068 
0069     DOMElementImpl(const DOMElementImpl &other, bool deep=false);
0070     virtual ~DOMElementImpl();
0071 
0072 public:
0073     // Declare functions from DOMNode.  They all must be implemented by this class
0074     DOMNODE_FUNCTIONS;
0075 
0076     // Add accessors for implementation bits.
0077     DOMNODEIMPL_DECL;
0078     DOMPARENTIMPL_DECL;
0079     DOMCHILDIMPL_DECL;
0080 
0081 public:
0082     // Functions introduced on Element...
0083     virtual const XMLCh*      getAttribute(const XMLCh *name) const;
0084     virtual DOMAttr*          getAttributeNode(const XMLCh *name) const;
0085     virtual DOMNodeList*      getElementsByTagName(const XMLCh *tagname) const;
0086     virtual const XMLCh*      getTagName() const;
0087     virtual void              removeAttribute(const XMLCh *name);
0088     virtual DOMAttr*          removeAttributeNode(DOMAttr * oldAttr);
0089     virtual void              setAttribute(const XMLCh *name, const XMLCh *value);
0090     virtual DOMAttr*          setAttributeNode(DOMAttr *newAttr);
0091     virtual void              setReadOnly(bool readOnly, bool deep);
0092 
0093     //Introduced in DOM Level 2
0094     virtual const XMLCh*      getAttributeNS(const XMLCh *namespaceURI,
0095                                              const XMLCh *localName) const;
0096     virtual void              setAttributeNS(const XMLCh *namespaceURI,
0097                                              const XMLCh *qualifiedName,
0098                                              const XMLCh *value);
0099     virtual void              removeAttributeNS(const XMLCh *namespaceURI,
0100                                                 const XMLCh *localName);
0101     virtual DOMAttr*          getAttributeNodeNS(const XMLCh *namespaceURI,
0102                                                  const XMLCh *localName) const;
0103     virtual DOMAttr*          setAttributeNodeNS(DOMAttr *newAttr);
0104     virtual DOMNodeList*      getElementsByTagNameNS(const XMLCh *namespaceURI,
0105                                                      const XMLCh *localName) const;
0106     virtual bool              hasAttribute(const XMLCh *name) const;
0107     virtual bool              hasAttributeNS(const XMLCh *namespaceURI,
0108                                              const XMLCh *localName) const;
0109 
0110     //Introduced in DOM level 3
0111     virtual void setIdAttribute(const XMLCh* name, bool isId);
0112     virtual void setIdAttributeNS(const XMLCh* namespaceURI, const XMLCh* localName, bool isId);
0113     virtual void setIdAttributeNode(const DOMAttr *idAttr, bool isId);
0114     virtual const DOMTypeInfo * getSchemaTypeInfo() const;
0115 
0116     // for handling of default attribute
0117     virtual DOMAttr*          setDefaultAttributeNode(DOMAttr *newAttr);
0118     virtual DOMAttr*          setDefaultAttributeNodeNS(DOMAttr *newAttr);
0119     virtual DOMAttrMapImpl*   getDefaultAttributes() const;
0120 
0121     // helper function for DOM Level 3 renameNode
0122     virtual DOMNode* rename(const XMLCh* namespaceURI, const XMLCh* name);
0123 
0124     // DOMElementTraversal
0125     virtual DOMElement *         getFirstElementChild() const;
0126     virtual DOMElement *         getLastElementChild() const;
0127     virtual DOMElement *         getPreviousElementSibling() const;
0128     virtual DOMElement *         getNextElementSibling() const;
0129     virtual XMLSize_t            getChildElementCount() const;
0130 
0131 protected:
0132     // default attribute helper functions
0133     virtual void setupDefaultAttributes();
0134 
0135     // helper function for DOMElementTraversal methods
0136     DOMElement* getFirstElementChild(const DOMNode* n) const;
0137     DOMElement* getLastElementChild(const DOMNode* n) const;
0138     DOMNode* getNextLogicalSibling(const DOMNode* n) const;
0139     DOMNode* getPreviousLogicalSibling(const DOMNode* n) const;
0140 
0141 private:
0142     // -----------------------------------------------------------------------
0143     // Unimplemented constructors and operators
0144     // -----------------------------------------------------------------------    
0145     DOMElementImpl & operator = (const DOMElementImpl &);
0146 };
0147 
0148 XERCES_CPP_NAMESPACE_END
0149 
0150 #endif