domdocumentimpl.hpp
来自「IBM的解析xml的工具Xerces的源代码」· HPP 代码 · 共 399 行 · 第 1/2 页
HPP
399 行
return errorChecking; } //Introduced in DOM Level 2 virtual DOMNode* importNode(DOMNode *source, bool deep); virtual DOMElement* createElementNS(const XMLCh *namespaceURI, const XMLCh *qualifiedName); virtual DOMElement* createElementNS(const XMLCh *namespaceURI, const XMLCh *qualifiedName, const XMLSSize_t lineNo, const XMLSSize_t columnNo); virtual DOMAttr* createAttributeNS(const XMLCh *namespaceURI, const XMLCh *qualifiedName); virtual DOMNodeList* getElementsByTagNameNS(const XMLCh *namespaceURI, const XMLCh *localName) const; virtual DOMElement* getElementById(const XMLCh *elementId) const; //Introduced in DOM Level 3 virtual const XMLCh* getActualEncoding() const; virtual void setActualEncoding(const XMLCh* actualEncoding); virtual const XMLCh* getEncoding() const; virtual void setEncoding(const XMLCh* encoding); virtual bool getStandalone() const; virtual void setStandalone(bool standalone); virtual const XMLCh* getVersion() const; virtual void setVersion(const XMLCh* version); virtual const XMLCh* getDocumentURI() const; virtual void setDocumentURI(const XMLCh* documentURI); virtual bool getStrictErrorChecking() const; virtual void setStrictErrorChecking(bool strictErrorChecking); virtual DOMNode* adoptNode(DOMNode* source); virtual void normalizeDocument(); virtual DOMConfiguration* getDOMConfiguration() const; virtual void setDOMConfiguration(DOMConfiguration *config); // helper functions to prevent storing userdata pointers on every node. void* setUserData(DOMNodeImpl* n, const XMLCh* key, void* data, DOMUserDataHandler* handler); void* getUserData(const DOMNodeImpl* n, const XMLCh* key) const; void callUserDataHandlers(const DOMNodeImpl* n, DOMUserDataHandler::DOMOperationType operation, const DOMNode* src, const DOMNode* dst) const; void transferUserData(DOMNodeImpl* n1, DOMNodeImpl* n2); DOMNode* renameNode(DOMNode* n, const XMLCh* namespaceURI, const XMLCh* name); //Return the index > 0 of ':' in the given qualified name qName="prefix:localName". //Return 0 if there is no ':', or -1 if qName is malformed such as ":abcd". static int indexofQualifiedName(const XMLCh * qName); static bool isKidOK(DOMNode *parent, DOMNode *child); inline DOMNodeIDMap* getNodeIDMap() {return fNodeIDMap;}; // // Memory Management Functions. All memory is allocated by and owned by // a document, and is not recovered until the // document itself is deleted. // void* allocate(size_t amount); void* allocate(size_t amount, NodeObjectType type); XMLCh* cloneString(const XMLCh *src); const XMLCh* getPooledString(const XMLCh *src); void deleteHeap(); void release(DOMNode* object, NodeObjectType type); void releaseDocNotifyUserData(DOMNode* object); void releaseBuffer(DOMBuffer* buffer); DOMBuffer* popBuffer(); MemoryManager* getMemoryManager() const; // Factory methods for getting/creating node lists. // Because nothing is ever deleted, the implementation caches and recycles // previously used instances of DOMDeepNodeList // DOMNodeList* getDeepNodeList(const DOMNode *rootNode, const XMLCh *tagName); DOMNodeList* getDeepNodeList(const DOMNode *rootNode, //DOM Level 2 const XMLCh *namespaceURI, const XMLCh *localName);private: //Internal helper functions virtual DOMNode* importNode(DOMNode *source, bool deep, bool cloningNode); // ----------------------------------------------------------------------- // Unimplemented constructors and operators // ----------------------------------------------------------------------- DOMDocumentImpl(const DOMDocumentImpl &); DOMDocumentImpl & operator = (const DOMDocumentImpl &);private: // ----------------------------------------------------------------------- // data // ----------------------------------------------------------------------- // New data introduced in DOM Level 3 const XMLCh* fActualEncoding; const XMLCh* fEncoding; bool fStandalone; const XMLCh* fVersion; const XMLCh* fDocumentURI; DOMConfiguration* fDOMConfiguration; XMLStringPool fUserDataTableKeys; RefHash2KeysTableOf<DOMUserDataRecord>* fUserDataTable; // Per-Document heap Variables. // The heap consists of one or more biggish blocks which are // sub-allocated for individual allocations of nodes, strings, etc. // The big blocks form a linked list, allowing them to be located for deletion. // // There is no provision for deleting suballocated blocks, other than // deleting the entire heap when the document is deleted. // // There is no header on individual sub-allocated blocks. // The header on big blocks consists only of a single back pointer to // the previously allocated big block (our linked list of big blocks) // // // revisit - this heap should be encapsulated into its own // class, rather than hanging naked on Document. // void* fCurrentBlock; char* fFreePtr; XMLSize_t fFreeBytesRemaining; // To recycle the DOMNode pointer RefArrayOf<DOMNodePtr>* fRecycleNodePtr; // To recycle DOMBuffer pointer RefStackOf<DOMBuffer>* fRecycleBufferPtr; // Pool of DOMNodeList for getElementsByTagName DOMDeepNodeListPool<DOMDeepNodeListImpl>* fNodeListPool; // Other data DOMDocumentType* fDocType; DOMElement* fDocElement; DOMStringPool* fNamePool; DOMNormalizer* fNormalizer; Ranges* fRanges; NodeIterators* fNodeIterators; MemoryManager* fMemoryManager; // configurable memory manager int fChanges; bool errorChecking; // Bypass error checking.};inline MemoryManager* DOMDocumentImpl::getMemoryManager() const{ return fMemoryManager;}XERCES_CPP_NAMESPACE_END// ---------------------------------------------------------------------------//// Operator new. Global overloaded version, lets any object be allocated on// the heap owned by a document.//// ---------------------------------------------------------------------------inline void * operator new(size_t amt, XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc, XERCES_CPP_NAMESPACE_QUALIFIER DOMDocumentImpl::NodeObjectType type){ // revist. Probably should be a checked cast. void *p = ((XERCES_CPP_NAMESPACE_QUALIFIER DOMDocumentImpl *)doc)->allocate(amt, type); return p;}inline void * operator new(size_t amt, XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc){ // revist. Probably should be a checked cast. void *p = ((XERCES_CPP_NAMESPACE_QUALIFIER DOMDocumentImpl *)doc)->allocate(amt); return p;}// ---------------------------------------------------------------------------// For DOM:// Bypass compiler warning:// no matching operator delete found; memory will not be freed if initialization throws an exception// ---------------------------------------------------------------------------#if _MSC_VER >= 1200 /* VC++ 6.0 */inline void operator delete(void* ptr, XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc){ return;}inline void operator delete(void* ptr, XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc, XERCES_CPP_NAMESPACE_QUALIFIER DOMDocumentImpl::NodeObjectType type){ return;}#endif#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?