?? domnodeimpl.hpp
字號:
#ifndef DOMNodeImpl_HEADER_GUARD_#define DOMNodeImpl_HEADER_GUARD_/* * Copyright 2001-2002,2004 The Apache Software Foundation. * * Licensed 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,v 1.13 2004/09/08 13:55:52 peiyongz Exp $ *///// 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_BEGINclass 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 compareTreePosition(const DOMNode* other) const; const XMLCh* getTextContent() const ; const XMLCh* getTextContent(XMLCh* pzBuffer, unsigned int& rnBufferLength) const; void setTextContent(const XMLCh* textContent) ; const XMLCh* lookupNamespacePrefix(const XMLCh* namespaceURI, bool useDefault) const ; bool isDefaultNamespace(const XMLCh* namespaceURI) const ; const XMLCh* lookupNamespaceURI(const XMLCh* prefix) const ; DOMNode* getInterface(const XMLCh* feature) ; // Helper functions for DOM Level 3 void release(); void callUserDataHandlers(DOMUserDataHandler::DOMOperationType operation, const DOMNode* src, const DOMNode* dst) const; //reverses the bit pattern given by compareTreePosition short reverseTreeOrderBitPattern(short pattern) 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* lookupNamespacePrefix(const XMLCh* const namespaceURI, bool useDefaultx, 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);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -