Code

more unreffing temporary styles properly
[inkscape.git] / src / dom / domimpl.h
1 #ifndef __DOMIMPL_H__
2 #define __DOMIMPL_H__
3 /**
4  * Phoebe DOM Implementation.
5  *
6  * This is a C++ approximation of the W3C DOM model, which follows
7  * fairly closely the specifications in the various .idl files, copies of
8  * which are provided for reference.  Most important is this one:
9  *
10  * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
11  *
12  * Authors:
13  *   Bob Jamison
14  *
15  * Copyright (C) 2005 Bob Jamison
16  *
17  *  This library is free software; you can redistribute it and/or
18  *  modify it under the terms of the GNU Lesser General Public
19  *  License as published by the Free Software Foundation; either
20  *  version 2.1 of the License, or (at your option) any later version.
21  *
22  *  This library is distributed in the hope that it will be useful,
23  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
24  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
25  *  Lesser General Public License for more details.
26  *
27  *  You should have received a copy of the GNU Lesser General Public
28  *  License along with this library; if not, write to the Free Software
29  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
30  */
33 #include "dom.h"
35 #include <map>
37 namespace org
38 {
39 namespace w3c
40 {
41 namespace dom
42 {
46 class DOMImplementationSourceImpl;
47 class DOMImplementationImpl;
48 class NodeImpl;
49 typedef Ptr<NodeImpl> NodeImplPtr;
50 class CharacterDataImpl;
51 class AttrImpl;
52 typedef Ptr<AttrImpl> AttrImplPtr;
53 class ElementImpl;
54 typedef Ptr<ElementImpl> ElementImplPtr;
55 class TextImpl;
56 class CommentImpl;
57 class TypeInfoImpl;
58 class UserDataHandlerImpl;
59 class DOMErrorImpl;
60 class DOMErrorHandlerImpl;
61 class DOMLocatorImpl;
62 class DOMConfigurationImpl;
63 class CDATASectionImpl;
64 class DocumentTypeImpl;
65 typedef Ptr<DocumentTypeImpl> DocumentTypeImplPtr;
66 class NotationImpl;
67 class EntityImpl;
68 class EntityReferenceImpl;
69 class ProcessingInstructionImpl;
70 class DocumentFragmentImpl;
71 class DocumentImpl;
72 typedef Ptr<DocumentImpl> DocumentImplPtr;
76 /*#########################################################################
77 ## DOMImplementationSourceImpl
78 #########################################################################*/
80 class DOMImplementationSourceImpl : public DOMImplementationSource
81 {
82 public:
84     /**
85      *
86      */
87     virtual DOMImplementation *getDOMImplementation(const DOMString &features);
89     /**
90      *
91      */
92     virtual DOMImplementationList getDOMImplementationList(const DOMString &features);
95     //##################
96     //# Non-API methods
97     //##################
99     /**
100      *
101      */
102     DOMImplementationSourceImpl();
104     /**
105      *
106      */
107     virtual ~DOMImplementationSourceImpl();
109 protected:
112     DOMImplementationImpl *domImpl;
113     DOMImplementationList domImplList;
114 };
120 /*#########################################################################
121 ## DOMImplementationImpl
122 #########################################################################*/
123 /**
124  *
125  */
126 class DOMImplementationImpl : public DOMImplementation
128 public:
131     /**
132      *
133      */
134     DOMImplementationImpl();
136     /**
137      *
138      */
139     virtual ~DOMImplementationImpl();
141     /**
142      *
143      */
144     virtual bool hasFeature(const DOMString& feature, const DOMString& version);
147     /**
148      *
149      */
150     virtual DocumentTypePtr createDocumentType(const DOMString& qualifiedName,
151                                      const DOMString& publicId,
152                                      const DOMString& systemId)
153                                      throw(DOMException);
155     /**
156      *
157      */
158     virtual DocumentPtr createDocument(const DOMString& namespaceURI,
159                              const DOMString& qualifiedName,
160                              DocumentTypePtr doctype)
161                              throw(DOMException);
162     /**
163      *
164      */
165     virtual DOMObject *getFeature(const DOMString& feature,
166                              const DOMString& version);
169 protected:
171 };
176 /*#########################################################################
177 ## NodeImpl
178 #########################################################################*/
180 /**
181  *
182  */
183 class NodeImpl : virtual public Node
186     friend class DocumentImpl;
188 public:
190     /**
191      *
192      */
193     virtual DOMString getNodeName();
195     /**
196      *
197      */
198     virtual DOMString getNodeValue() throw (DOMException);
200     /**
201      *
202      */
203     virtual void setNodeValue(const DOMString& val) throw (DOMException);
205     /**
206      *
207      */
208     virtual unsigned short getNodeType();
210     /**
211      *
212      */
213     virtual NodePtr getParentNode();
215     /**
216      *
217      */
218     virtual NodeList getChildNodes();
220     /**
221      *
222      */
223     virtual NodePtr getFirstChild();
225     /**
226      *
227      */
228     virtual NodePtr getLastChild();
230     /**
231      *
232      */
233     virtual NodePtr getPreviousSibling();
235     /**
236      *
237      */
238     virtual NodePtr getNextSibling();
240     /**
241      *
242      */
243     virtual NamedNodeMap &getAttributes();
246     /**
247      *
248      */
249     virtual DocumentPtr getOwnerDocument();
251     /**
252      *
253      */
254     virtual NodePtr insertBefore(const NodePtr newChild,
255                        const NodePtr refChild)
256                        throw(DOMException);
258     /**
259      *
260      */
261     virtual NodePtr replaceChild(const NodePtr newChild,
262                        const NodePtr oldChild)
263                        throw(DOMException);
265     /**
266      *
267      */
268     virtual NodePtr removeChild(const NodePtr oldChild)
269                       throw(DOMException);
271     /**
272      *
273      */
274     virtual NodePtr appendChild(const NodePtr newChild)
275                       throw(DOMException);
277     /**
278      *
279      */
280     virtual bool hasChildNodes();
282     /**
283      *
284      */
285     virtual NodePtr cloneNode(bool deep);
287     /**
288      *
289      */
290     virtual void normalize();
292     /**
293      *
294      */
295     virtual bool isSupported(const DOMString& feature,
296                      const DOMString& version);
298     /**
299      *
300      */
301     virtual DOMString getNamespaceURI();
303     /**
304      *
305      */
306     virtual DOMString getPrefix();
308     /**
309      *
310      */
311     virtual void setPrefix(const DOMString& val) throw(DOMException);
313     /**
314      *
315      */
316     virtual DOMString getLocalName();
318     /**
319      *
320      */
321     virtual bool hasAttributes();
323     /**
324      *
325      */
326     virtual DOMString getBaseURI();
328     /**
329      *
330      */
331     virtual unsigned short compareDocumentPosition(const NodePtr other);
333     /**
334      *
335      */
336     virtual DOMString getTextContent() throw(DOMException);
339     /**
340      *
341      */
342     virtual void setTextContent(const DOMString &val) throw(DOMException);
345     /**
346      *
347      */
348     virtual DOMString lookupPrefix(const DOMString &namespaceURI);
351     /**
352      *
353      */
354     virtual bool isDefaultNamespace(const DOMString &namespaceURI);
357     /**
358      *
359      */
360     virtual DOMString lookupNamespaceURI(const DOMString &prefix);
363     /**
364      *
365      */
366     virtual bool isEqualNode(const NodePtr node);
370     /**
371      *
372      */
373     virtual DOMObject *getFeature(const DOMString &feature,
374                                   const DOMString &version);
376     /**
377      *
378      */
379     virtual DOMUserData *setUserData(const DOMString &key,
380                                      const DOMUserData *data,
381                                      const UserDataHandler *handler);
384     /**
385      *
386      */
387     virtual DOMUserData *getUserData(const DOMString &namespaceURI);
390     //##################
391     //# Non-API methods
392     //##################
394     /**
395      *
396      */
397     virtual void bindingsAdd(const DOMString &prefix, const DOMString &namespaceURI)
398         {
399         bindings[prefix] = namespaceURI;
400         }
402     /**
403      *
404      */
405     virtual void bindingsClear()
406         {
407         bindings.clear();
408         }
410     DOMString bindingsFind(const DOMString &prefix)
411         {
412         std::map<DOMString, DOMString>::iterator iter =
413              bindings.find(prefix);
414         if (iter != bindings.end())
415             {
416             DOMString ret = iter->second;
417             return ret;
418             }
419         if (parent.get())
420             {
421             DOMString ret = parent->bindingsFind(prefix);
422             if (ret.size() > 0)
423                 return ret;
424             }
425         return "";
426         }
428     /**
429      *
430      */
431     virtual void setNodeName(const DOMString &qualifiedName);
433     /**
434      *
435      */
436     virtual void setNamespaceURI(const DOMString &theNamespaceURI);
438     /**
439      *
440      */
441     DOMString lookupNamespacePrefix(const DOMString &namespaceURI,
442                                     NodePtr originalElement);
443     /**
444      *
445      */
446     NodeImpl();
448     /**
449      *
450      */
451     NodeImpl(const NodeImpl &other);
453     /**
454      *
455      */
456     NodeImpl &operator=(const NodeImpl &other);
458     /**
459      *
460      */
461     NodeImpl(DocumentImplPtr owner);
463     /**
464      *
465      */
466     NodeImpl(DocumentImplPtr owner, const DOMString &nodeName);
468     /**
469      *
470      */
471     NodeImpl(DocumentImplPtr owner, const DOMString &namespaceURI,
472                        const DOMString &nodeName);
474     /**
475      *
476      */
477     virtual ~NodeImpl();
480     /**
481      *
482      */
483     void assign(const NodeImpl &other);
485 protected:
487     /**
488      * Set up the internal values
489      */
490     void init();
492     unsigned short nodeType;
494     NodeImplPtr parent;
496     NodeImplPtr prev;
498     NodeImplPtr next;
500     DOMUserData *userData;
502     DOMString prefix;
504     DOMString localName;
506     DOMString nodeName;
508     DOMString namespaceURI;
510     DOMString baseURI;
512     DOMString nodeValue;
514     NodeImplPtr firstChild;
515     NodeImplPtr lastChild;
517     DocumentImplPtr ownerDocument;
519     NamedNodeMap attributes;
521     class UserDataEntry
522     {
523     public:
524         UserDataEntry(const DOMString       &theKey,
525                       const DOMUserData     *theData,
526                       const UserDataHandler *theHandler)
527             {
528             next    = NULL;
529             key     = theKey;
530             data    = (DOMUserData *)theData;
531             handler = (UserDataHandler *)theHandler;
532             }
533         ~UserDataEntry()
534             {
535             //delete anything after me, too
536             if (next)
537                 delete next;
538             }
540         UserDataEntry   *next;
541         DOMString       key;
542         DOMUserData     *data;
543         UserDataHandler *handler;
544     };
546     UserDataEntry *userDataEntries;
547     
548     TypeInfo typeInfo;
550     //### Our prefix->namespaceURI bindings
552     std::map<DOMString, DOMString> bindings;
555 };
559 /*#########################################################################
560 ## CharacterDataImpl
561 #########################################################################*/
563 /**
564  *
565  */
566 class CharacterDataImpl : virtual public CharacterData, protected NodeImpl
568 public:
570     /**
571      *
572      */
573     virtual DOMString getData() throw(DOMException);
575     /**
576      *
577      */
578     virtual void setData(const DOMString& val) throw(DOMException);
580     /**
581      *
582      */
583     virtual unsigned long getLength();
585     /**
586      *
587      */
588     virtual DOMString substringData(unsigned long offset,
589                             unsigned long count)
590                             throw(DOMException);
592     /**
593      *
594      */
595     virtual void appendData(const DOMString& arg) throw(DOMException);
597     /**
598      *
599      */
600     virtual void insertData(unsigned long offset,
601                     const DOMString& arg)
602                     throw(DOMException);
604     /**
605      *
606      */
607     virtual void deleteData(unsigned long offset,
608                     unsigned long count)
609                     throw(DOMException);
611     /**
612      *
613      */
614     virtual void  replaceData(unsigned long offset,
615                       unsigned long count,
616                       const DOMString& arg)
617                       throw(DOMException);
620     //##################
621     //# Non-API methods
622     //##################
624     /**
625      *
626      */
627     CharacterDataImpl();
630     /**
631      *
632      */
633     CharacterDataImpl(DocumentImplPtr owner, const DOMString &value);
635     /**
636      *
637      */
638     virtual ~CharacterDataImpl();
640 protected:
642    //'data' is the nodeValue
644 };
650 /*#########################################################################
651 ## AttrImpl
652 #########################################################################*/
654 /**
655  *
656  */
657 class AttrImpl : virtual public Attr, public NodeImpl
659 public:
661     /**
662      *
663      */
664     virtual DOMString getName();
666     /**
667      *
668      */
669     virtual bool getSpecified();
671     /**
672      *
673      */
674     virtual DOMString getValue();
676     /**
677      *
678      */
679     virtual void setValue(const DOMString& val) throw(DOMException);
681     /**
682      *
683      */
684     virtual ElementPtr getOwnerElement();
687     /**
688      *
689      */
690     virtual TypeInfo &getSchemaTypeInfo();
693     /**
694      *
695      */
696     virtual bool getIsId();
700     //##################
701     //# Non-API methods
702     //##################
704     /**
705      *
706      */
707     virtual void setOwnerElement(const ElementPtr elem);
709     /**
710      *
711      */
712     AttrImpl(DocumentImplPtr owner, const DOMString &name);
714     /**
715      *
716      */
717     AttrImpl(DocumentImplPtr owner, const DOMString &namespaceURI,
718                                const DOMString &name);
720     /**
721      *
722      */
723     virtual ~AttrImpl();
725 protected:
728     ElementPtr ownerElement;
731 };
737 /*#########################################################################
738 ## ElementImpl
739 #########################################################################*/
741 /**
742  *
743  */
744 class ElementImpl : virtual public Element, public NodeImpl
746 public:
748     /**
749      *
750      */
751     virtual DOMString getTagName();
753     /**
754      *
755      */
756     virtual DOMString getAttribute(const DOMString& name);
758     /**
759      *
760      */
761     virtual void setAttribute(const DOMString& name,
762                       const DOMString& value)
763                       throw(DOMException);
765     /**
766      *
767      */
768     virtual void removeAttribute(const DOMString& name)
769                          throw(DOMException);
771     /**
772      *
773      */
774     virtual AttrPtr getAttributeNode(const DOMString& name);
776     /**
777      *
778      */
779     virtual AttrPtr setAttributeNode(AttrPtr newAttr)
780                           throw(DOMException);
782     /**
783      *
784      */
785     virtual AttrPtr removeAttributeNode(AttrPtr oldAttr)
786                              throw(DOMException);
788     /**
789      *
790      */
791     virtual NodeList getElementsByTagName(const DOMString& name);
793     /**
794      *
795      */
796     virtual DOMString getAttributeNS(const DOMString& namespaceURI,
797                              const DOMString& localName);
799     /**
800      *
801      */
802     virtual void setAttributeNS(const DOMString& namespaceURI,
803                         const DOMString& qualifiedName,
804                         const DOMString& value)
805                         throw(DOMException);
807     /**
808      *
809      */
810     virtual void removeAttributeNS(const DOMString& namespaceURI,
811                            const DOMString& localName)
812                            throw(DOMException);
814     /**
815      *
816      */
817     virtual AttrPtr getAttributeNodeNS(const DOMString& namespaceURI,
818                             const DOMString& localName);
820     /**
821      *
822      */
823     virtual AttrPtr setAttributeNodeNS(AttrPtr newAttr)
824                             throw(DOMException);
826     /**
827      *
828      */
829     virtual NodeList getElementsByTagNameNS(const DOMString& namespaceURI,
830                                     const DOMString& localName);
832     /**
833      *
834      */
835     virtual bool hasAttribute(const DOMString& name);
837     /**
838      *
839      */
840     virtual bool hasAttributeNS(const DOMString& namespaceURI,
841                         const DOMString& localName);
843     /**
844      *
845      */
846     virtual TypeInfo &getSchemaTypeInfo();
849     /**
850      *
851      */
852     virtual void setIdAttribute(const DOMString &name,
853                                 bool isId) throw (DOMException);
855     /**
856      *
857      */
858     virtual void setIdAttributeNS(const DOMString &namespaceURI,
859                                   const DOMString &localName,
860                                   bool isId) throw (DOMException);
862     /**
863      *
864      */
865     virtual void setIdAttributeNode(const AttrPtr idAttr,
866                                     bool isId) throw (DOMException);
870     //##################
871     //# Non-API methods
872     //##################
875     /**
876      *
877      */
878     ElementImpl();
880     /**
881      *
882      */
883     ElementImpl(DocumentImplPtr owner, const DOMString &tagName);
885     /**
886      *
887      */
888     ElementImpl(DocumentImplPtr owner, const DOMString &namespaceURI,
889                        const DOMString &tagName);
891     /**
892      *
893      */
894     virtual ~ElementImpl();
896     /**
897      *
898      */
899     void normalizeNamespaces();
901 protected:
903 friend class DocumentImpl;
905     static void getElementsByTagNameRecursive(NodeList &list,
906                         const DOMString& name, ElementPtr elem);
907     static void getElementsByTagNameNSRecursive(NodeList &list,
908              const DOMString& namespaceURI, const DOMString& tagName,
909                           ElementPtr elem);
910 };
916 /*#########################################################################
917 ## TextImpl
918 #########################################################################*/
920 /**
921  *
922  */
923 class TextImpl : virtual public Text, protected CharacterDataImpl
925 public:
927     /**
928      *
929      */
930     virtual TextPtr splitText(unsigned long offset)
931                     throw(DOMException);
933     /**
934      *
935      */
936     virtual bool getIsElementContentWhitespace();
938     /**
939      *
940      */
941     virtual DOMString getWholeText();
944     /**
945      *
946      */
947     virtual TextPtr replaceWholeText(const DOMString &content)
948                                  throw(DOMException);
950     //##################
951     //# Non-API methods
952     //##################
954     /**
955      *
956      */
957     TextImpl();
960     /**
961      *
962      */
963     TextImpl(DocumentImplPtr owner, const DOMString &val);
965     /**
966      *
967      */
968     virtual ~TextImpl();
970 protected:
972 };
976 /*#########################################################################
977 ## CommentImpl
978 #########################################################################*/
980 /**
981  *
982  */
983 class CommentImpl : virtual public Comment, protected CharacterDataImpl
985 public:
987     //##################
988     //# Non-API methods
989     //##################
991     /**
992      *
993      */
994     CommentImpl();
996     /**
997      *
998      */
999     CommentImpl(DocumentImplPtr owner, const DOMString &theValue);
1001     /**
1002      *
1003      */
1004     virtual ~CommentImpl();
1005 };
1009 /*#########################################################################
1010 ## TypeInfoImpl
1011 #########################################################################*/
1013 /**
1014  *
1015  */
1016 class TypeInfoImpl : public TypeInfo
1018 public:
1020     /**
1021      *
1022      */
1023     virtual DOMString getTypeName();
1025     /**
1026      *
1027      */
1028     virtual DOMString getTypeNamespace();
1030     /**
1031      *
1032      */
1033     virtual bool isDerivedFrom(const DOMString &typeNamespaceArg,
1034                                const DOMString &typeNameArg,
1035                                const DerivationMethod derivationMethod);
1038     //##################
1039     //# Non-API methods
1040     //##################
1043     /**
1044      *
1045      */
1046     TypeInfoImpl(const DOMString &typeNamespaceArg,
1047                  const DOMString &typeNameArg,
1048                  const DerivationMethod derivationMethod);
1050     /**
1051      *
1052      */
1053     virtual ~TypeInfoImpl();
1055 protected:
1057     DOMString typeName;
1059     DOMString typeNamespace;
1061     unsigned short derivationMethod;
1063 };
1068 /*#########################################################################
1069 ## UserDataHandlerImpl
1070 #########################################################################*/
1072 /**
1073  *
1074  */
1075 class UserDataHandlerImpl : public UserDataHandler
1077 public:
1079     /**
1080      *
1081      */
1082     virtual  void handle(unsigned short operation,
1083                          const DOMString &key,
1084                          const DOMUserData *data,
1085                          const NodePtr src,
1086                          const NodePtr dst);
1088     //##################
1089     //# Non-API methods
1090     //##################
1093 protected:
1095     /**
1096      *
1097      */
1098     UserDataHandlerImpl();
1100     /**
1101      *
1102      */
1103     virtual ~UserDataHandlerImpl();
1104 };
1107 /*#########################################################################
1108 ## DOMErrorImpl
1109 #########################################################################*/
1111 /**
1112  *
1113  */
1114 class DOMErrorImpl : public DOMError
1116 public:
1118     /**
1119      *
1120      */
1121     virtual unsigned short getSeverity();
1123     /**
1124      *
1125      */
1126     virtual DOMString getMessage();
1128     /**
1129      *
1130      */
1131     virtual DOMString getType();
1133     /**
1134      *
1135      */
1136     virtual DOMObject *getRelatedException();
1138     /**
1139      *
1140      */
1141     virtual DOMObject *getRelatedData();
1143     /**
1144      *
1145      */
1146     virtual DOMLocator *getLocation();
1149     //##################
1150     //# Non-API methods
1151     //##################
1154 protected:
1156     /**
1157      *
1158      */
1159     DOMErrorImpl();
1161     /**
1162      *
1163      */
1164     virtual ~DOMErrorImpl();
1166     unsigned short severity;
1168     DOMString message;
1170     DOMString type;
1173 };
1176 /*#########################################################################
1177 ## DOMErrorHandlerImpl
1178 #########################################################################*/
1180 /**
1181  *
1182  */
1183 class DOMErrorHandlerImpl : public DOMErrorHandler
1185 public:
1187     /**
1188      *
1189      */
1190     virtual bool handleError(const DOMError *error);
1194     //##################
1195     //# Non-API methods
1196     //##################
1200 protected:
1202     /**
1203      *
1204      */
1205     DOMErrorHandlerImpl();
1207     /**
1208      *
1209      */
1210     virtual ~DOMErrorHandlerImpl();
1213 };
1217 /*#########################################################################
1218 ## DOMLocatorImpl
1219 #########################################################################*/
1221 /**
1222  *
1223  */
1224 class DOMLocatorImpl : public DOMLocator
1226 public:
1228     /**
1229      *
1230      */
1231     virtual long getLineNumber();
1233     /**
1234      *
1235      */
1236     virtual long getColumnNumber();
1238     /**
1239      *
1240      */
1241     virtual long getByteOffset();
1243     /**
1244      *
1245      */
1246     virtual long getUtf16Offset();
1249     /**
1250      *
1251      */
1252     virtual NodePtr getRelatedNode();
1255     /**
1256      *
1257      */
1258     virtual DOMString getUri();
1262     //##################
1263     //# Non-API methods
1264     //##################
1267     /**
1268      *
1269      */
1270     DOMLocatorImpl();
1272     /**
1273      *
1274      */
1275     virtual ~DOMLocatorImpl();
1277 protected:
1280     long lineNumber;
1282     long columnNumber;
1284     long byteOffset;
1286     long utf16Offset;
1288     NodePtr relatedNode;
1290     DOMString uri;
1291 };
1294 /*#########################################################################
1295 ## DOMConfigurationImpl
1296 #########################################################################*/
1298 /**
1299  *
1300  */
1301 class DOMConfigurationImpl : public DOMConfiguration
1303 public:
1305     /**
1306      *
1307      */
1308     virtual void setParameter(const DOMString &name,
1309                               const DOMUserData *value) throw (DOMException);
1311     /**
1312      *
1313      */
1314     virtual DOMUserData *getParameter(const DOMString &name)
1315                                       throw (DOMException);
1317     /**
1318      *
1319      */
1320     virtual bool canSetParameter(const DOMString &name,
1321                                  const DOMUserData *data);
1323     /**
1324      *
1325      */
1326     virtual DOMStringList *getParameterNames();
1329     //##################
1330     //# Non-API methods
1331     //##################
1333     /**
1334      *
1335      */
1336     DOMConfigurationImpl();
1338     /**
1339      *
1340      */
1341     virtual ~DOMConfigurationImpl();
1343 protected:
1345 };
1352 /*#########################################################################
1353 ## CDATASectionImpl
1354 #########################################################################*/
1355 /**
1356  *
1357  */
1358 class CDATASectionImpl : public CDATASection, public TextImpl
1360 public:
1362     //##################
1363     //# Non-API methods
1364     //##################
1366     /**
1367      *
1368      */
1369     CDATASectionImpl();
1372     /**
1373      *
1374      */
1375     CDATASectionImpl(DocumentImplPtr owner, const DOMString &value);
1377     /**
1378      *
1379      */
1380     virtual ~CDATASectionImpl();
1382 };
1387 /*#########################################################################
1388 ## DocumentTypeImpl
1389 #########################################################################*/
1391 /**
1392  *
1393  */
1394 class DocumentTypeImpl : public DocumentType, public NodeImpl
1396 public:
1398     /**
1399      *
1400      */
1401     virtual DOMString getName();
1403     /**
1404      *
1405      */
1406     virtual NamedNodeMap getEntities();
1408     /**
1409      *
1410      */
1411     virtual NamedNodeMap getNotations();
1413     /**
1414      *
1415      */
1416     virtual DOMString getPublicId();
1418     /**
1419      *
1420      */
1421     virtual DOMString getSystemId();
1423     /**
1424      *
1425      */
1426     virtual DOMString getInternalSubset();
1428     //##################
1429     //# Non-API methods
1430     //##################
1432     /**
1433      *
1434      */
1435    DocumentTypeImpl();
1437     /**
1438      *
1439      */
1440    DocumentTypeImpl(const DOMString& name,
1441                     const DOMString& publicId,
1442                     const DOMString& systemId);
1443     /**
1444      *
1445      */
1446    virtual ~DocumentTypeImpl();
1449 protected:
1450    DOMString name;
1451    DOMString publicId;
1452    DOMString systemId;
1454    NamedNodeMap entities;
1455    NamedNodeMap notations;
1457 };
1463 /*#########################################################################
1464 ## NotationImpl
1465 #########################################################################*/
1467 /**
1468  *
1469  */
1470 class NotationImpl : public Notation, public NodeImpl
1472 public:
1474     /**
1475      *
1476      */
1477     virtual DOMString getPublicId();
1479     /**
1480      *
1481      */
1482     virtual DOMString getSystemId();
1485     //##################
1486     //# Non-API methods
1487     //##################
1489     /**
1490      *
1491      */
1492     NotationImpl();
1494     /**
1495      *
1496      */
1497     NotationImpl(DocumentImplPtr owner);
1499     /**
1500      *
1501      */
1502     virtual ~NotationImpl();
1505 protected:
1509     DOMString publicId;
1511     DOMString systemId;
1512 };
1519 /*#########################################################################
1520 ## EntityImpl
1521 #########################################################################*/
1523 /**
1524  *
1525  */
1526 class EntityImpl : public Entity, public NodeImpl
1528 public:
1530     /**
1531      *
1532      */
1533     virtual DOMString getPublicId();
1535     /**
1536      *
1537      */
1538     virtual DOMString getSystemId();
1540     /**
1541      *
1542      */
1543     virtual DOMString getNotationName();
1545     /**
1546      *
1547      */
1548     virtual DOMString getInputEncoding();
1550     /**
1551      *
1552      */
1553     virtual DOMString getXmlEncoding();
1555     /**
1556      *
1557      */
1558     virtual DOMString getXmlVersion();
1561     //##################
1562     //# Non-API methods
1563     //##################
1565     /**
1566      *
1567      */
1568     EntityImpl();
1571     /**
1572      *
1573      */
1574     EntityImpl(DocumentImplPtr owner);
1576     /**
1577      *
1578      */
1579     virtual ~EntityImpl();
1581 protected:
1585     DOMString publicId;
1587     DOMString systemId;
1589     DOMString notationName;
1591     DOMString inputEncoding;
1593     DOMString xmlEncoding;
1595     DOMString xmlVersion;
1597 };
1603 /*#########################################################################
1604 ## EntityReferenceImpl
1605 #########################################################################*/
1606 /**
1607  *
1608  */
1609 class EntityReferenceImpl : public EntityReference, public NodeImpl
1611 public:
1613     //##################
1614     //# Non-API methods
1615     //##################
1617     /**
1618      *
1619      */
1620     EntityReferenceImpl();
1623     /**
1624      *
1625      */
1626     EntityReferenceImpl(DocumentImplPtr owner, const DOMString &theName);
1628     /**
1629      *
1630      */
1631     virtual ~EntityReferenceImpl();
1633 };
1639 /*#########################################################################
1640 ## ProcessingInstructionImpl
1641 #########################################################################*/
1643 /**
1644  *
1645  */
1646 class ProcessingInstructionImpl : 
1647               public ProcessingInstruction,
1648                           public NodeImpl
1650 public:
1652     /**
1653      *
1654      */
1655     virtual DOMString getTarget();
1657     /**
1658      *
1659      */
1660     virtual DOMString getData();
1662     /**
1663      *
1664      */
1665    virtual void setData(const DOMString& val) throw(DOMException);
1668     //##################
1669     //# Non-API methods
1670     //##################
1673     /**
1674      *
1675      */
1676     ProcessingInstructionImpl();
1679     /**
1680      *
1681      */
1682     ProcessingInstructionImpl(DocumentImplPtr owner,
1683                               const DOMString &target,
1684                               const DOMString &data);
1686     /**
1687      *
1688      */
1689     virtual ~ProcessingInstructionImpl();
1692 protected:
1695     //'target' is nodeName
1697     //'data' is nodeValue
1700 };
1706 /*#########################################################################
1707 ## DocumentFragmentImpl
1708 #########################################################################*/
1709 /**
1710  *
1711  */
1712 class DocumentFragmentImpl : public DocumentFragment, public NodeImpl
1715 public:
1717     //##################
1718     //# Non-API methods
1719     //##################
1721     /**
1722      *
1723      */
1724     DocumentFragmentImpl();
1726     /**
1727      *
1728      */
1729     DocumentFragmentImpl(DocumentImplPtr owner);
1731     /**
1732      *
1733      */
1734     virtual ~DocumentFragmentImpl();
1736 };
1743 /*#########################################################################
1744 ## DocumentImpl
1745 #########################################################################*/
1747 /**
1748  *
1749  */
1750 class DocumentImpl : virtual public Document, public NodeImpl
1752 public:
1754     /**
1755      *
1756      */
1757     virtual DocumentTypePtr getDoctype();
1759     /**
1760      *
1761      */
1762     virtual DOMImplementation *getImplementation();
1764     /**
1765      *
1766      */
1767     virtual ElementPtr getDocumentElement();
1769     /**
1770      *
1771      */
1772     virtual ElementPtr createElement(const DOMString& tagName)
1773                            throw(DOMException);
1775     /**
1776      *
1777      */
1778     virtual DocumentFragmentPtr createDocumentFragment();
1780     /**
1781      *
1782      */
1783     virtual TextPtr createTextNode(const DOMString& data);
1785     /**
1786      *
1787      */
1788     virtual CommentPtr createComment(const DOMString& data);
1790     /**
1791      *
1792      */
1793     virtual CDATASectionPtr createCDATASection(const DOMString& data)
1794                                      throw(DOMException);
1796     /**
1797      *
1798      */
1799     virtual ProcessingInstructionPtr createProcessingInstruction(
1800                                         const DOMString& target,
1801                                     const DOMString& data)
1802                                     throw(DOMException);
1804     /**
1805      *
1806      */
1807     virtual AttrPtr createAttribute(const DOMString& name)
1808                           throw(DOMException);
1810     /**
1811      *
1812      */
1813     virtual EntityReferencePtr createEntityReference(const DOMString& name)
1814                                            throw(DOMException);
1816     /**
1817      *
1818      */
1819     virtual NodeList getElementsByTagName(const DOMString& tagname);
1822     /**
1823      *
1824      */
1825     virtual NodePtr importNode(const NodePtr importedNode,
1826                      bool deep)
1827                      throw(DOMException);
1829     /**
1830      *
1831      */
1832     virtual ElementPtr createElementNS(const DOMString& namespaceURI,
1833                              const DOMString& qualifiedName)
1834                              throw(DOMException);
1836     /**
1837      *
1838      */
1839     virtual AttrPtr createAttributeNS(const DOMString& namespaceURI,
1840                             const DOMString& qualifiedName)
1841                             throw(DOMException);
1843     /**
1844      *
1845      */
1846     virtual NodeList getElementsByTagNameNS(const DOMString& namespaceURI,
1847                                      const DOMString& localName);
1849     /**
1850      *
1851      */
1852     virtual ElementPtr getElementById(const DOMString& elementId);
1855     /**
1856      *
1857      */
1858     virtual DOMString getInputEncoding();
1861     /**
1862      *
1863      */
1864     virtual DOMString getXmlEncoding();
1866     /**
1867      *
1868      */
1869     virtual bool getXmlStandalone();
1871     /**
1872      *
1873      */
1874     virtual void setXmlStandalone(bool val) throw (DOMException);
1876     /**
1877      *
1878      */
1879     virtual DOMString getXmlVersion();
1881     /**
1882      *
1883      */
1884     virtual void setXmlVersion(const DOMString &version) throw (DOMException);
1886     /**
1887      *
1888      */
1889     virtual bool getStrictErrorChecking();
1891     /**
1892      *
1893      */
1894     virtual void setStrictErrorChecking(bool val);
1897     /**
1898      *
1899      */
1900     virtual DOMString getDocumentURI();
1902     /**
1903      *
1904      */
1905     virtual void setDocumentURI(const DOMString &uri);
1907     /**
1908      *
1909      */
1910     virtual NodePtr adoptNode(const NodePtr source) throw (DOMException);
1912     /**
1913      *
1914      */
1915     virtual DOMConfiguration *getDomConfig();
1917     /**
1918      *
1919      */
1920     virtual void normalizeDocument();
1922     /**
1923      *
1924      */
1925     virtual NodePtr renameNode(const NodePtr n,
1926                              const DOMString &name,
1927                              const DOMString &qualifiedName)
1928                              throw (DOMException);
1931     //##################
1932     //# Non-API methods
1933     //##################
1935     DocumentImpl(const DOMImplementation *domImpl,
1936                  const DOMString       &namespaceURI,
1937                  const DOMString       &qualifiedName,
1938                  const DocumentTypePtr doctype);
1940     virtual ~DocumentImpl();
1943     DOMString *stringCache(const DOMString &val);
1945     int namespaceIndex;
1947 protected:
1949     DOMImplementation *parent;
1951     DOMString documentURI;
1953     DOMString qualifiedName;
1955     DocumentTypePtr doctype;
1957     ElementImplPtr documentElement;
1959     class NamedElementItem
1960     {
1961     public:
1962         NamedElementItem()
1963         {
1964             next = NULL;
1965         }
1966         NamedElementItem(const DOMString &nameArg, ElementPtr elemArg)
1967         {
1968             next = NULL;
1969             name = nameArg;
1970             elem = elemArg;
1971         }
1972         ~NamedElementItem()
1973         {
1974             if (next)
1975                 delete next;
1976         }
1977         NamedElementItem *next;
1978         DOMString        name;
1979         ElementPtr       elem;
1980     };
1982     NamedElementItem elementsById;
1985     DOMString xmlEncoding;
1987     DOMString inputEncoding;
1989     DOMString xmlVersion;
1991     bool xmlStandalone;
1993     bool strictErrorChecking;
1995     DOMConfiguration *domConfig;
1997     NamedNodeMap namespaceURIs;
2000 };
2012 }  //namespace dom
2013 }  //namespace w3c
2014 }  //namespace org
2017 #endif // __DOMIMPL_H__
2020 /*#########################################################################
2021 ## E N D    O F    F I L E
2022 #########################################################################*/