00001 #ifndef IDDocumentImpl_HEADER_GUARD_
00002 #define IDDocumentImpl_HEADER_GUARD_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073 #include <string.h>
00074 #include <xercesc/util/XercesDefs.hpp>
00075 #include "xercesc/util/RefVectorOf.hpp"
00076 #include "xercesc/util/RefHashTableOf.hpp"
00077
00078 #include "IDOM_Document.hpp"
00079 #include "IDNodeImpl.hpp"
00080 #include "IDParentNode.hpp"
00081 #include "IDDeepNodeListPool.hpp"
00082
00083
00084 class IDAttrImpl;
00085 class IDCDATASectionImpl;
00086 class IDCommentImpl;
00087 class IDDeepNodeListImpl;
00088 class IDDocumentFragmentImpl;
00089 class IDDocumentTypeImpl;
00090 class IDDStringPool;
00091 class IDElementImpl;
00092 class IDEntityImpl;
00093 class IDEntityReferenceImpl;
00094 class IDNodeImpl;
00095 class IDNotationImpl;
00096 class IDProcessingInstructionImpl;
00097 class IDTextImpl;
00098 class IDNodeIteratorImpl;
00099 class IDTreeWalkerImpl;
00100 class IDOM_NodeFilter;
00101 class IDNodeFilterImpl;
00102 class IDOM_DOMImplementation;
00103 class IDNodeIDMap;
00104 class IDRangeImpl;
00105 class IDParentNode;
00106 class IDStringPool;
00107
00108 typedef RefVectorOf<IDNodeIteratorImpl> NodeIterators;
00109 typedef RefVectorOf<IDTreeWalkerImpl> TreeWalkers;
00110 typedef RefVectorOf<IDRangeImpl> Ranges;
00111
00112
00113 class CDOM_EXPORT IDDocumentImpl: public IDOM_Document {
00114 public:
00115
00116
00117
00118
00119
00120 IDNodeImpl fNode;
00121 IDParentNode fParent;
00122
00123 IDOM_DocumentType *fDocType;
00124 IDOM_Element *fDocElement;
00125 IDStringPool *fNamePool;
00126 IDNodeIDMap *fNodeIDMap;
00127
00128 NodeIterators *fIterators;
00129 TreeWalkers *fTreeWalkers;
00130 Ranges *fRanges;
00131
00132 RefHashTableOf<void> *fUserData;
00133 int fChanges;
00134
00135 bool errorChecking;
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154 void *fCurrentBlock;
00155 char *fFreePtr;
00156 unsigned int fFreeBytesRemaining;
00157
00158
00159
00160
00161 friend class IDNodeImpl;
00162 friend class IDNodeIteratorImpl;
00163 friend class IDTreeWalkerImpl;
00164 friend class IDRangeImpl;
00165 friend class IDDOMParser;
00166
00167
00168
00169 void setDocumentType(IDOM_DocumentType *doctype);
00170
00171
00172
00173 public:
00174 IDDocumentImpl();
00175 IDDocumentImpl(const XMLCh *namespaceURI,
00176 const XMLCh *qualifiedName,
00177 IDOM_DocumentType *doctype);
00178 virtual ~IDDocumentImpl();
00179
00180
00181 IDOM_NODE_FUNCTIONS;
00182
00183 virtual IDOM_Attr *createAttribute(const XMLCh *name);
00184 virtual IDOM_CDATASection *createCDATASection(const XMLCh *data);
00185 virtual IDOM_Comment *createComment(const XMLCh *data);
00186 virtual IDOM_DocumentFragment *createDocumentFragment();
00187 virtual IDOM_DocumentType *createDocumentType(const XMLCh *name);
00188 virtual IDOM_DocumentType *createDocumentType(const XMLCh *qName,
00189 const XMLCh *publicId,
00190 const XMLCh *systemId);
00191 virtual IDOM_Element *createElement(const XMLCh * tagName);
00192 virtual IDOM_Element *createElementNoCheck(const XMLCh *tagName);
00193 virtual IDOM_Entity *createEntity(const XMLCh * name);
00194 virtual IDOM_EntityReference *createEntityReference(const XMLCh * name);
00195 virtual IDOM_Notation *createNotation(const XMLCh * name);
00196 virtual IDOM_ProcessingInstruction *createProcessingInstruction(const XMLCh * target, const XMLCh * data);
00197 virtual IDOM_Text *createTextNode(const XMLCh * data);
00198 virtual IDOM_DocumentType *getDoctype() const;
00199 virtual IDOM_Element *getDocumentElement() const;
00200 virtual IDOM_NodeList *getElementsByTagName(const XMLCh * tagname) const;
00201 virtual IDOM_DOMImplementation *getImplementation() const;
00202 static bool isXMLName(const XMLCh * s);
00203 virtual IDOM_NodeIterator *createNodeIterator(IDOM_Node *root,
00204 unsigned long whatToShow,
00205 IDOM_NodeFilter* filter,
00206 bool entityReferenceExpansion);
00207 virtual IDOM_TreeWalker *createTreeWalker(IDOM_Node *root,
00208 unsigned long whatToShow,
00209 IDOM_NodeFilter* filter,
00210 bool entityReferenceExpansion);
00211
00212 virtual void* getUserData() const;
00213 virtual void setUserData(void* value);
00214 virtual IDOM_Range *createRange();
00215 virtual Ranges* getRanges() const;
00216 virtual void removeRange(IDRangeImpl* range);
00217
00218
00219
00220 virtual void setUserData(IDOM_Node* n, void* data);
00221 virtual void* getUserData(const IDOM_Node* n) const;
00222
00223
00224
00225
00226
00227 virtual void changed();
00228 virtual int changes() const;
00229
00248 inline void setErrorChecking(bool check) {
00249 errorChecking = check;
00250 }
00251
00255 inline bool getErrorChecking() {
00256 return errorChecking;
00257 }
00258
00259
00260 virtual IDOM_Node *importNode(IDOM_Node *source, bool deep);
00261 virtual IDOM_Element *createElementNS(const XMLCh *namespaceURI,
00262 const XMLCh *qualifiedName);
00263 virtual IDOM_Attr *createAttributeNS(const XMLCh *namespaceURI,
00264 const XMLCh *qualifiedName);
00265 virtual IDOM_NodeList *getElementsByTagNameNS(const XMLCh *namespaceURI,
00266 const XMLCh *localName) const;
00267 virtual IDOM_Element *getElementById(const XMLCh *elementId) const;
00268
00269
00270
00271
00272 static int indexofQualifiedName(const XMLCh * qName);
00273 static bool isKidOK(IDOM_Node *parent, IDOM_Node *child);
00274
00275 inline IDNodeIDMap * getNodeIDMap() {return fNodeIDMap;};
00276
00277
00278
00279
00280
00281
00282
00283
00284 void * allocate(size_t amount);
00285 XMLCh * cloneString(const XMLCh *src);
00286 const XMLCh * getPooledString(const XMLCh *src);
00287 void deleteHeap();
00288
00289
00290
00291
00292
00293
00294 IDOM_NodeList *getDeepNodeList(const IDOM_Node *rootNode, const XMLCh *tagName);
00295 IDOM_NodeList *getDeepNodeList(const IDOM_Node *rootNode,
00296 const XMLCh *namespaceURI,
00297 const XMLCh *localName);
00298
00299 private:
00300 IDDeepNodeListPool<IDDeepNodeListImpl> *fNodeListPool;
00301 };
00302
00303
00304
00305
00306
00307 inline void * operator new(size_t amt, IDOM_Document *doc)
00308 {
00309
00310 void *p = ((IDDocumentImpl *)doc)->allocate(amt);
00311 return p;
00312 }
00313
00314 #endif