Code

r11516@tres: ted | 2006-04-26 21:30:18 -0700
[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 class CharacterDataImpl;
50 class AttrImpl;
51 class ElementImpl;
52 class TextImpl;
53 class CommentImpl;
54 class TypeInfoImpl;
55 class UserDataHandlerImpl;
56 class DOMErrorImpl;
57 class DOMErrorHandlerImpl;
58 class DOMLocatorImpl;
59 class DOMConfigurationImpl;
60 class CDATASectionImpl;
61 class DocumentTypeImpl;
62 class NotationImpl;
63 class EntityImpl;
64 class EntityReferenceImpl;
65 class ProcessingInstructionImpl;
66 class DocumentFragmentImpl;
67 class DocumentImpl;
71 /*#########################################################################
72 ## DOMImplementationSourceImpl
73 #########################################################################*/
75 class DOMImplementationSourceImpl : public DOMImplementationSource
76 {
77 public:
79     /**
80      *
81      */
82     virtual DOMImplementation *getDOMImplementation(const DOMString &features);
84     /**
85      *
86      */
87     virtual DOMImplementationList getDOMImplementationList(const DOMString &features);
90     //##################
91     //# Non-API methods
92     //##################
94     /**
95      *
96      */
97     DOMImplementationSourceImpl();
99     /**
100      *
101      */
102     virtual ~DOMImplementationSourceImpl();
104 protected:
107     DOMImplementationImpl *domImpl;
108     DOMImplementationList domImplList;
109 };
115 /*#########################################################################
116 ## DOMImplementationImpl
117 #########################################################################*/
118 /**
119  *
120  */
121 class DOMImplementationImpl : public DOMImplementation
123 public:
126     /**
127      *
128      */
129     DOMImplementationImpl();
131     /**
132      *
133      */
134     virtual ~DOMImplementationImpl();
136     /**
137      *
138      */
139     virtual bool hasFeature(const DOMString& feature, const DOMString& version);
142     /**
143      *
144      */
145     virtual DocumentType *createDocumentType(const DOMString& qualifiedName,
146                                      const DOMString& publicId,
147                                      const DOMString& systemId)
148                                      throw(DOMException);
150     /**
151      *
152      */
153     virtual Document *createDocument(const DOMString& namespaceURI,
154                              const DOMString& qualifiedName,
155                              DocumentType *doctype)
156                              throw(DOMException);
157     /**
158      *
159      */
160     virtual DOMObject *getFeature(const DOMString& feature,
161                              const DOMString& version);
164 protected:
166 };
171 /*#########################################################################
172 ## NodeImpl
173 #########################################################################*/
175 /**
176  *
177  */
178 class NodeImpl : virtual public Node
181     friend class DocumentImpl;
183 public:
185     /**
186      *
187      */
188     virtual DOMString getNodeName();
190     /**
191      *
192      */
193     virtual DOMString getNodeValue() throw (DOMException);
195     /**
196      *
197      */
198     virtual void setNodeValue(const DOMString& val) throw (DOMException);
200     /**
201      *
202      */
203     virtual unsigned short getNodeType();
205     /**
206      *
207      */
208     virtual Node *getParentNode();
210     /**
211      *
212      */
213     virtual NodeList getChildNodes();
215     /**
216      *
217      */
218     virtual Node *getFirstChild();
220     /**
221      *
222      */
223     virtual Node *getLastChild();
225     /**
226      *
227      */
228     virtual Node *getPreviousSibling();
230     /**
231      *
232      */
233     virtual Node *getNextSibling();
235     /**
236      *
237      */
238     virtual NamedNodeMap &getAttributes();
241     /**
242      *
243      */
244     virtual Document *getOwnerDocument();
246     /**
247      *
248      */
249     virtual Node *insertBefore(const Node *newChild,
250                        const Node *refChild)
251                        throw(DOMException);
253     /**
254      *
255      */
256     virtual Node *replaceChild(const Node *newChild,
257                        const Node *oldChild)
258                        throw(DOMException);
260     /**
261      *
262      */
263     virtual Node *removeChild(const Node *oldChild)
264                       throw(DOMException);
266     /**
267      *
268      */
269     virtual Node *appendChild(const Node *newChild)
270                       throw(DOMException);
272     /**
273      *
274      */
275     virtual bool hasChildNodes();
277     /**
278      *
279      */
280     virtual Node *cloneNode(bool deep);
282     /**
283      *
284      */
285     virtual void normalize();
287     /**
288      *
289      */
290     virtual bool isSupported(const DOMString& feature,
291                      const DOMString& version);
293     /**
294      *
295      */
296     virtual DOMString getNamespaceURI();
298     /**
299      *
300      */
301     virtual DOMString getPrefix();
303     /**
304      *
305      */
306     virtual void setPrefix(const DOMString& val) throw(DOMException);
308     /**
309      *
310      */
311     virtual DOMString getLocalName();
313     /**
314      *
315      */
316     virtual bool hasAttributes();
318     /**
319      *
320      */
321     virtual DOMString getBaseURI();
323     /**
324      *
325      */
326     virtual unsigned short compareDocumentPosition(const Node *other);
328     /**
329      *
330      */
331     virtual DOMString getTextContext() throw(DOMException);
334     /**
335      *
336      */
337     virtual void setTextContext(const DOMString &val) throw(DOMException);
340     /**
341      *
342      */
343     virtual DOMString lookupPrefix(const DOMString &namespaceURI);
346     /**
347      *
348      */
349     virtual bool isDefaultNamespace(const DOMString &namespaceURI);
352     /**
353      *
354      */
355     virtual DOMString lookupNamespaceURI(const DOMString &prefix);
358     /**
359      *
360      */
361     virtual bool isEqualNode(const Node *node);
365     /**
366      *
367      */
368     virtual DOMObject *getFeature(const DOMString &feature,
369                                   const DOMString &version);
371     /**
372      *
373      */
374     virtual DOMUserData *setUserData(const DOMString &key,
375                                      const DOMUserData *data,
376                                      const UserDataHandler *handler);
379     /**
380      *
381      */
382     virtual DOMUserData *getUserData(const DOMString &namespaceURI);
385     //##################
386     //# Non-API methods
387     //##################
389     /**
390      *
391      */
392     virtual void bindingsAdd(const DOMString &prefix, const DOMString &namespaceURI)
393         {
394         bindings[prefix] = namespaceURI;
395         }
397     /**
398      *
399      */
400     virtual void bindingsClear()
401         {
402         bindings.clear();
403         }
405     DOMString bindingsFind(const DOMString &prefix)
406         {
407         std::map<DOMString, DOMString>::iterator iter =
408              bindings.find(prefix);
409         if (iter != bindings.end())
410             {
411             DOMString ret = iter->second;
412             return ret;
413             }
414         if (parent)
415             {
416             DOMString ret = parent->bindingsFind(prefix);
417             if (ret.size() > 0)
418                 return ret;
419             }
420         return "";
421         }
423     /**
424      *
425      */
426     virtual void setNodeName(const DOMString &qualifiedName);
428     /**
429      *
430      */
431     virtual void setNamespaceURI(const DOMString &theNamespaceURI);
433     /**
434      *
435      */
436     DOMString lookupNamespacePrefix(const DOMString &namespaceURI,
437                                     Node *originalElement);
438     /**
439      *
440      */
441     NodeImpl();
443     /**
444      *
445      */
446     NodeImpl(const NodeImpl &other);
448     /**
449      *
450      */
451     NodeImpl &operator=(const NodeImpl &other);
453     /**
454      *
455      */
456     NodeImpl(DocumentImpl *owner);
458     /**
459      *
460      */
461     NodeImpl(DocumentImpl *owner, const DOMString &nodeName);
463     /**
464      *
465      */
466     NodeImpl(DocumentImpl *owner, const DOMString &namespaceURI, const DOMString &nodeName);
468     /**
469      *
470      */
471     virtual ~NodeImpl();
474     /**
475      *
476      */
477     void assign(const NodeImpl &other);
479 protected:
481     /**
482      * Set up the internal values
483      */
484     void init();
486     unsigned short nodeType;
488     NodeImpl *parent;
490     NodeImpl *prev;
492     NodeImpl *next;
494     DOMUserData *userData;
496     DOMString prefix;
498     DOMString localName;
500     DOMString nodeName;
502     DOMString namespaceURI;
504     DOMString baseURI;
506     DOMString nodeValue;
508     NodeImpl *firstChild;
509     NodeImpl *lastChild;
511     DocumentImpl *ownerDocument;
513     NamedNodeMap attributes;
515     class UserDataEntry
516     {
517     public:
518         UserDataEntry(const DOMString       &theKey,
519                       const DOMUserData     *theData,
520                       const UserDataHandler *theHandler)
521             {
522             next    = NULL;
523             key     = theKey;
524             data    = (DOMUserData *)theData;
525             handler = (UserDataHandler *)theHandler;
526             }
527         ~UserDataEntry()
528             {
529             //delete anything after me, too
530             if (next)
531                 delete next;
532             }
534         UserDataEntry   *next;
535         DOMString       key;
536         DOMUserData     *data;
537         UserDataHandler *handler;
538     };
540     UserDataEntry *userDataEntries;
542     //### Our prefix->namespaceURI bindings
544     std::map<DOMString, DOMString> bindings;
547 };
551 /*#########################################################################
552 ## CharacterDataImpl
553 #########################################################################*/
555 /**
556  *
557  */
558 class CharacterDataImpl : virtual public CharacterData, protected NodeImpl
560 public:
562     /**
563      *
564      */
565     virtual DOMString getData() throw(DOMException);
567     /**
568      *
569      */
570     virtual void setData(const DOMString& val) throw(DOMException);
572     /**
573      *
574      */
575     virtual unsigned long getLength();
577     /**
578      *
579      */
580     virtual DOMString substringData(unsigned long offset,
581                             unsigned long count)
582                             throw(DOMException);
584     /**
585      *
586      */
587     virtual void appendData(const DOMString& arg) throw(DOMException);
589     /**
590      *
591      */
592     virtual void insertData(unsigned long offset,
593                     const DOMString& arg)
594                     throw(DOMException);
596     /**
597      *
598      */
599     virtual void deleteData(unsigned long offset,
600                     unsigned long count)
601                     throw(DOMException);
603     /**
604      *
605      */
606     virtual void  replaceData(unsigned long offset,
607                       unsigned long count,
608                       const DOMString& arg)
609                       throw(DOMException);
612     //##################
613     //# Non-API methods
614     //##################
616     /**
617      *
618      */
619     CharacterDataImpl();
622     /**
623      *
624      */
625     CharacterDataImpl(DocumentImpl *owner, const DOMString &value);
627     /**
628      *
629      */
630     virtual ~CharacterDataImpl();
632 protected:
634    //'data' is the nodeValue
636 };
642 /*#########################################################################
643 ## AttrImpl
644 #########################################################################*/
646 /**
647  *
648  */
649 class AttrImpl : virtual public Attr, public NodeImpl
651 public:
653     /**
654      *
655      */
656     virtual DOMString getName();
658     /**
659      *
660      */
661     virtual bool getSpecified();
663     /**
664      *
665      */
666     virtual DOMString getValue();
668     /**
669      *
670      */
671     virtual void setValue(const DOMString& val) throw(DOMException);
673     /**
674      *
675      */
676     virtual Element *getOwnerElement();
679     /**
680      *
681      */
682     virtual TypeInfo *getSchemaTypeInfo();
685     /**
686      *
687      */
688     virtual bool getIsId();
692     //##################
693     //# Non-API methods
694     //##################
696     /**
697      *
698      */
699     virtual void setOwnerElement(const Element *elem);
701     /**
702      *
703      */
704     AttrImpl(DocumentImpl *owner, const DOMString &name);
706     /**
707      *
708      */
709     AttrImpl(DocumentImpl *owner, const DOMString &namespaceURI, const DOMString &name);
711     /**
712      *
713      */
714     virtual ~AttrImpl();
716 protected:
719     Element *ownerElement;
722 };
728 /*#########################################################################
729 ## ElementImpl
730 #########################################################################*/
732 /**
733  *
734  */
735 class ElementImpl : virtual public Element, public NodeImpl
737 public:
739     /**
740      *
741      */
742     virtual DOMString getTagName();
744     /**
745      *
746      */
747     virtual DOMString getAttribute(const DOMString& name);
749     /**
750      *
751      */
752     virtual void setAttribute(const DOMString& name,
753                       const DOMString& value)
754                       throw(DOMException);
756     /**
757      *
758      */
759     virtual void removeAttribute(const DOMString& name)
760                          throw(DOMException);
762     /**
763      *
764      */
765     virtual Attr *getAttributeNode(const DOMString& name);
767     /**
768      *
769      */
770     virtual Attr *setAttributeNode(Attr *newAttr)
771                           throw(DOMException);
773     /**
774      *
775      */
776     virtual Attr *removeAttributeNode(Attr *oldAttr)
777                              throw(DOMException);
779     /**
780      *
781      */
782     virtual NodeList getElementsByTagName(const DOMString& name);
784     /**
785      *
786      */
787     virtual DOMString getAttributeNS(const DOMString& namespaceURI,
788                              const DOMString& localName);
790     /**
791      *
792      */
793     virtual void setAttributeNS(const DOMString& namespaceURI,
794                         const DOMString& qualifiedName,
795                         const DOMString& value)
796                         throw(DOMException);
798     /**
799      *
800      */
801     virtual void removeAttributeNS(const DOMString& namespaceURI,
802                            const DOMString& localName)
803                            throw(DOMException);
805     /**
806      *
807      */
808     virtual Attr *getAttributeNodeNS(const DOMString& namespaceURI,
809                             const DOMString& localName);
811     /**
812      *
813      */
814     virtual Attr *setAttributeNodeNS(Attr *newAttr)
815                             throw(DOMException);
817     /**
818      *
819      */
820     virtual NodeList getElementsByTagNameNS(const DOMString& namespaceURI,
821                                     const DOMString& localName);
823     /**
824      *
825      */
826     virtual bool hasAttribute(const DOMString& name);
828     /**
829      *
830      */
831     virtual bool hasAttributeNS(const DOMString& namespaceURI,
832                         const DOMString& localName);
834     /**
835      *
836      */
837     virtual TypeInfo *getSchemaTypeInto();
840     /**
841      *
842      */
843     virtual void setIdAttribute(const DOMString &name,
844                                 bool isId) throw (DOMException);
846     /**
847      *
848      */
849     virtual void setIdAttributeNS(const DOMString &namespaceURI,
850                                   const DOMString &localName,
851                                   bool isId) throw (DOMException);
853     /**
854      *
855      */
856     virtual void setIdAttributeNode(const Attr *idAttr,
857                                     bool isId) throw (DOMException);
861     //##################
862     //# Non-API methods
863     //##################
866     /**
867      *
868      */
869     ElementImpl();
871     /**
872      *
873      */
874     ElementImpl(DocumentImpl *owner, const DOMString &tagName);
876     /**
877      *
878      */
879     ElementImpl(DocumentImpl *owner, const DOMString &namespaceURI, const DOMString &tagName);
881     /**
882      *
883      */
884     virtual ~ElementImpl();
886     /**
887      *
888      */
889     void normalizeNamespaces();
891 protected:
893 friend class DocumentImpl;
895     static void getElementsByTagNameRecursive(NodeList &list,
896                         const DOMString& name, Element *elem);
897     static void getElementsByTagNameNSRecursive(NodeList &list,
898              const DOMString& namespaceURI, const DOMString& tagName, Element *elem);
899 };
905 /*#########################################################################
906 ## TextImpl
907 #########################################################################*/
909 /**
910  *
911  */
912 class TextImpl : virtual public Text, protected CharacterDataImpl
914 public:
916     /**
917      *
918      */
919     virtual Text *splitText(unsigned long offset)
920                     throw(DOMException);
922     /**
923      *
924      */
925     virtual bool getIsElementContentWhitespace();
927     /**
928      *
929      */
930     virtual DOMString getWholeText();
933     /**
934      *
935      */
936     virtual Text *replaceWholeText(const DOMString &content)
937                                  throw(DOMException);
939     //##################
940     //# Non-API methods
941     //##################
943     /**
944      *
945      */
946     TextImpl();
949     /**
950      *
951      */
952     TextImpl(DocumentImpl *owner, const DOMString &val);
954     /**
955      *
956      */
957     virtual ~TextImpl();
959 protected:
961 };
965 /*#########################################################################
966 ## CommentImpl
967 #########################################################################*/
969 /**
970  *
971  */
972 class CommentImpl : virtual public Comment, protected CharacterDataImpl
974 public:
976     //##################
977     //# Non-API methods
978     //##################
980     /**
981      *
982      */
983     CommentImpl();
985     /**
986      *
987      */
988     CommentImpl(DocumentImpl *owner, const DOMString &theValue);
990     /**
991      *
992      */
993     virtual ~CommentImpl();
994 };
998 /*#########################################################################
999 ## TypeInfoImpl
1000 #########################################################################*/
1002 /**
1003  *
1004  */
1005 class TypeInfoImpl : public TypeInfo
1007 public:
1009     /**
1010      *
1011      */
1012     virtual DOMString getTypeName();
1014     /**
1015      *
1016      */
1017     virtual DOMString getTypeNamespace();
1019     /**
1020      *
1021      */
1022     virtual bool isDerivedFrom(const DOMString &typeNamespaceArg,
1023                                const DOMString &typeNameArg,
1024                                const DerivationMethod derivationMethod);
1027     //##################
1028     //# Non-API methods
1029     //##################
1032     /**
1033      *
1034      */
1035     TypeInfoImpl(const DOMString &typeNamespaceArg,
1036                  const DOMString &typeNameArg,
1037                  const DerivationMethod derivationMethod);
1039     /**
1040      *
1041      */
1042     virtual ~TypeInfoImpl();
1044 protected:
1046     DOMString typeName;
1048     DOMString typeNamespace;
1050     unsigned short derivationMethod;
1052 };
1057 /*#########################################################################
1058 ## UserDataHandlerImpl
1059 #########################################################################*/
1061 /**
1062  *
1063  */
1064 class UserDataHandlerImpl : public UserDataHandler
1066 public:
1068     /**
1069      *
1070      */
1071     virtual  void handle(unsigned short operation,
1072                          const DOMString &key,
1073                          const DOMUserData *data,
1074                          const Node *src,
1075                          const Node *dst);
1077     //##################
1078     //# Non-API methods
1079     //##################
1082 protected:
1084     /**
1085      *
1086      */
1087     UserDataHandlerImpl();
1089     /**
1090      *
1091      */
1092     virtual ~UserDataHandlerImpl();
1093 };
1096 /*#########################################################################
1097 ## DOMErrorImpl
1098 #########################################################################*/
1100 /**
1101  *
1102  */
1103 class DOMErrorImpl : public DOMError
1105 public:
1107     /**
1108      *
1109      */
1110     virtual unsigned short getSeverity();
1112     /**
1113      *
1114      */
1115     virtual DOMString getMessage();
1117     /**
1118      *
1119      */
1120     virtual DOMString getType();
1122     /**
1123      *
1124      */
1125     virtual DOMObject *getRelatedException();
1127     /**
1128      *
1129      */
1130     virtual DOMObject *getRelatedData();
1132     /**
1133      *
1134      */
1135     virtual DOMLocator *getLocation();
1138     //##################
1139     //# Non-API methods
1140     //##################
1143 protected:
1145     /**
1146      *
1147      */
1148     DOMErrorImpl();
1150     /**
1151      *
1152      */
1153     virtual ~DOMErrorImpl();
1155     unsigned short severity;
1157     DOMString message;
1159     DOMString type;
1162 };
1165 /*#########################################################################
1166 ## DOMErrorHandlerImpl
1167 #########################################################################*/
1169 /**
1170  *
1171  */
1172 class DOMErrorHandlerImpl : public DOMErrorHandler
1174 public:
1176     /**
1177      *
1178      */
1179     virtual bool handleError(const DOMError *error);
1183     //##################
1184     //# Non-API methods
1185     //##################
1189 protected:
1191     /**
1192      *
1193      */
1194     DOMErrorHandlerImpl();
1196     /**
1197      *
1198      */
1199     virtual ~DOMErrorHandlerImpl();
1202 };
1206 /*#########################################################################
1207 ## DOMLocatorImpl
1208 #########################################################################*/
1210 /**
1211  *
1212  */
1213 class DOMLocatorImpl : public DOMLocator
1215 public:
1217     /**
1218      *
1219      */
1220     virtual long getLineNumber();
1222     /**
1223      *
1224      */
1225     virtual long getColumnNumber();
1227     /**
1228      *
1229      */
1230     virtual long getByteOffset();
1232     /**
1233      *
1234      */
1235     virtual long getUtf16Offset();
1238     /**
1239      *
1240      */
1241     virtual Node *getRelatedNode();
1244     /**
1245      *
1246      */
1247     virtual DOMString getUri();
1251     //##################
1252     //# Non-API methods
1253     //##################
1256     /**
1257      *
1258      */
1259     DOMLocatorImpl();
1261     /**
1262      *
1263      */
1264     virtual ~DOMLocatorImpl();
1266 protected:
1269     long lineNumber;
1271     long columnNumber;
1273     long byteOffset;
1275     long utf16Offset;
1277     Node *relatedNode;
1279     DOMString uri;
1280 };
1283 /*#########################################################################
1284 ## DOMConfigurationImpl
1285 #########################################################################*/
1287 /**
1288  *
1289  */
1290 class DOMConfigurationImpl : public DOMConfiguration
1292 public:
1294     /**
1295      *
1296      */
1297     virtual void setParameter(const DOMString &name,
1298                               const DOMUserData *value) throw (DOMException);
1300     /**
1301      *
1302      */
1303     virtual DOMUserData *getParameter(const DOMString &name)
1304                                       throw (DOMException);
1306     /**
1307      *
1308      */
1309     virtual bool canSetParameter(const DOMString &name,
1310                                  const DOMUserData *data);
1312     /**
1313      *
1314      */
1315     virtual DOMStringList *getParameterNames();
1318     //##################
1319     //# Non-API methods
1320     //##################
1322     /**
1323      *
1324      */
1325     DOMConfigurationImpl();
1327     /**
1328      *
1329      */
1330     virtual ~DOMConfigurationImpl();
1332 protected:
1334 };
1341 /*#########################################################################
1342 ## CDATASectionImpl
1343 #########################################################################*/
1344 /**
1345  *
1346  */
1347 class CDATASectionImpl : public CDATASection, public TextImpl
1349 public:
1351     //##################
1352     //# Non-API methods
1353     //##################
1355     /**
1356      *
1357      */
1358     CDATASectionImpl();
1361     /**
1362      *
1363      */
1364     CDATASectionImpl(DocumentImpl *owner, const DOMString &value);
1366     /**
1367      *
1368      */
1369     virtual ~CDATASectionImpl();
1371 };
1376 /*#########################################################################
1377 ## DocumentTypeImpl
1378 #########################################################################*/
1380 /**
1381  *
1382  */
1383 class DocumentTypeImpl : public DocumentType, public NodeImpl
1385 public:
1387     /**
1388      *
1389      */
1390     virtual DOMString getName();
1392     /**
1393      *
1394      */
1395     virtual NamedNodeMap getEntities();
1397     /**
1398      *
1399      */
1400     virtual NamedNodeMap getNotations();
1402     /**
1403      *
1404      */
1405     virtual DOMString getPublicId();
1407     /**
1408      *
1409      */
1410     virtual DOMString getSystemId();
1412     /**
1413      *
1414      */
1415     virtual DOMString getInternalSubset();
1417     //##################
1418     //# Non-API methods
1419     //##################
1421     /**
1422      *
1423      */
1424    DocumentTypeImpl();
1426     /**
1427      *
1428      */
1429    DocumentTypeImpl(const DOMString& name,
1430                     const DOMString& publicId,
1431                     const DOMString& systemId);
1432     /**
1433      *
1434      */
1435    virtual ~DocumentTypeImpl();
1438 protected:
1439    DOMString name;
1440    DOMString publicId;
1441    DOMString systemId;
1443    NamedNodeMap entities;
1444    NamedNodeMap notations;
1446 };
1452 /*#########################################################################
1453 ## NotationImpl
1454 #########################################################################*/
1456 /**
1457  *
1458  */
1459 class NotationImpl : public Notation, public NodeImpl
1461 public:
1463     /**
1464      *
1465      */
1466     virtual DOMString getPublicId();
1468     /**
1469      *
1470      */
1471     virtual DOMString getSystemId();
1474     //##################
1475     //# Non-API methods
1476     //##################
1478     /**
1479      *
1480      */
1481     NotationImpl();
1483     /**
1484      *
1485      */
1486     NotationImpl(DocumentImpl *owner);
1488     /**
1489      *
1490      */
1491     virtual ~NotationImpl();
1494 protected:
1498     DOMString publicId;
1500     DOMString systemId;
1501 };
1508 /*#########################################################################
1509 ## EntityImpl
1510 #########################################################################*/
1512 /**
1513  *
1514  */
1515 class EntityImpl : public Entity, public NodeImpl
1517 public:
1519     /**
1520      *
1521      */
1522     virtual DOMString getPublicId();
1524     /**
1525      *
1526      */
1527     virtual DOMString getSystemId();
1529     /**
1530      *
1531      */
1532     virtual DOMString getNotationName();
1534     /**
1535      *
1536      */
1537     virtual DOMString getInputEncoding();
1539     /**
1540      *
1541      */
1542     virtual DOMString getXmlEncoding();
1544     /**
1545      *
1546      */
1547     virtual DOMString getXmlVersion();
1550     //##################
1551     //# Non-API methods
1552     //##################
1554     /**
1555      *
1556      */
1557     EntityImpl();
1560     /**
1561      *
1562      */
1563     EntityImpl(DocumentImpl *owner);
1565     /**
1566      *
1567      */
1568     virtual ~EntityImpl();
1570 protected:
1574     DOMString publicId;
1576     DOMString systemId;
1578     DOMString notationName;
1580     DOMString inputEncoding;
1582     DOMString xmlEncoding;
1584     DOMString xmlVersion;
1586 };
1592 /*#########################################################################
1593 ## EntityReferenceImpl
1594 #########################################################################*/
1595 /**
1596  *
1597  */
1598 class EntityReferenceImpl : public EntityReference, public NodeImpl
1600 public:
1602     //##################
1603     //# Non-API methods
1604     //##################
1606     /**
1607      *
1608      */
1609     EntityReferenceImpl();
1612     /**
1613      *
1614      */
1615     EntityReferenceImpl(DocumentImpl *owner, const DOMString &theName);
1617     /**
1618      *
1619      */
1620     virtual ~EntityReferenceImpl();
1622 };
1628 /*#########################################################################
1629 ## ProcessingInstructionImpl
1630 #########################################################################*/
1632 /**
1633  *
1634  */
1635 class ProcessingInstructionImpl : public ProcessingInstruction, public NodeImpl
1637 public:
1639     /**
1640      *
1641      */
1642     virtual DOMString getTarget();
1644     /**
1645      *
1646      */
1647     virtual DOMString getData();
1649     /**
1650      *
1651      */
1652    virtual void setData(const DOMString& val) throw(DOMException);
1655     //##################
1656     //# Non-API methods
1657     //##################
1660     /**
1661      *
1662      */
1663     ProcessingInstructionImpl();
1666     /**
1667      *
1668      */
1669     ProcessingInstructionImpl(DocumentImpl *owner,
1670                               const DOMString &target,
1671                               const DOMString &data);
1673     /**
1674      *
1675      */
1676     virtual ~ProcessingInstructionImpl();
1679 protected:
1682     //'target' is nodeName
1684     //'data' is nodeValue
1687 };
1693 /*#########################################################################
1694 ## DocumentFragmentImpl
1695 #########################################################################*/
1696 /**
1697  *
1698  */
1699 class DocumentFragmentImpl : public DocumentFragment, public NodeImpl
1702 public:
1704     //##################
1705     //# Non-API methods
1706     //##################
1708     /**
1709      *
1710      */
1711     DocumentFragmentImpl();
1713     /**
1714      *
1715      */
1716     DocumentFragmentImpl(DocumentImpl *owner);
1718     /**
1719      *
1720      */
1721     virtual ~DocumentFragmentImpl();
1723 };
1730 /*#########################################################################
1731 ## DocumentImpl
1732 #########################################################################*/
1734 /**
1735  *
1736  */
1737 class DocumentImpl : virtual public Document, public NodeImpl
1739 public:
1741     /**
1742      *
1743      */
1744     virtual DocumentType *getDoctype();
1746     /**
1747      *
1748      */
1749     virtual DOMImplementation *getImplementation();
1751     /**
1752      *
1753      */
1754     virtual Element *getDocumentElement();
1756     /**
1757      *
1758      */
1759     virtual Element *createElement(const DOMString& tagName)
1760                            throw(DOMException);
1762     /**
1763      *
1764      */
1765     virtual DocumentFragment *createDocumentFragment();
1767     /**
1768      *
1769      */
1770     virtual Text *createTextNode(const DOMString& data);
1772     /**
1773      *
1774      */
1775     virtual Comment  *createComment(const DOMString& data);
1777     /**
1778      *
1779      */
1780     virtual CDATASection *createCDATASection(const DOMString& data)
1781                                      throw(DOMException);
1783     /**
1784      *
1785      */
1786     virtual ProcessingInstruction *createProcessingInstruction(const DOMString& target,
1787                                                        const DOMString& data)
1788                                                        throw(DOMException);
1790     /**
1791      *
1792      */
1793     virtual Attr *createAttribute(const DOMString& name)
1794                           throw(DOMException);
1796     /**
1797      *
1798      */
1799     virtual EntityReference *createEntityReference(const DOMString& name)
1800                                            throw(DOMException);
1802     /**
1803      *
1804      */
1805     virtual NodeList getElementsByTagName(const DOMString& tagname);
1808     /**
1809      *
1810      */
1811     virtual Node *importNode(const Node *importedNode,
1812                      bool deep)
1813                      throw(DOMException);
1815     /**
1816      *
1817      */
1818     virtual Element *createElementNS(const DOMString& namespaceURI,
1819                              const DOMString& qualifiedName)
1820                              throw(DOMException);
1822     /**
1823      *
1824      */
1825     virtual Attr *createAttributeNS(const DOMString& namespaceURI,
1826                             const DOMString& qualifiedName)
1827                             throw(DOMException);
1829     /**
1830      *
1831      */
1832     virtual NodeList getElementsByTagNameNS(const DOMString& namespaceURI,
1833                                      const DOMString& localName);
1835     /**
1836      *
1837      */
1838     virtual Element *getElementById(const DOMString& elementId);
1841     /**
1842      *
1843      */
1844     virtual DOMString getInputEncoding();
1847     /**
1848      *
1849      */
1850     virtual DOMString getXmlEncoding();
1852     /**
1853      *
1854      */
1855     virtual bool getXmlStandalone();
1857     /**
1858      *
1859      */
1860     virtual void setXmlStandalone(bool val) throw (DOMException);
1862     /**
1863      *
1864      */
1865     virtual DOMString getXmlVersion();
1867     /**
1868      *
1869      */
1870     virtual void setXmlVersion(const DOMString &version) throw (DOMException);
1872     /**
1873      *
1874      */
1875     virtual bool getStrictErrorChecking();
1877     /**
1878      *
1879      */
1880     virtual void setStrictErrorChecking(bool val);
1883     /**
1884      *
1885      */
1886     virtual DOMString getDocumentURI();
1888     /**
1889      *
1890      */
1891     virtual void setDocumentURI(const DOMString &uri);
1893     /**
1894      *
1895      */
1896     virtual Node *adoptNode(const Node *source) throw (DOMException);
1898     /**
1899      *
1900      */
1901     virtual DOMConfiguration *getDomConfig();
1903     /**
1904      *
1905      */
1906     virtual void normalizeDocument();
1908     /**
1909      *
1910      */
1911     virtual Node *renameNode(const Node *n,
1912                              const DOMString &name,
1913                              const DOMString &qualifiedName)
1914                              throw (DOMException);
1917     //##################
1918     //# Non-API methods
1919     //##################
1921     DocumentImpl(const DOMImplementation *domImpl,
1922                  const DOMString    &namespaceURI,
1923                  const DOMString    &qualifiedName,
1924                  const DocumentType *doctype);
1926     virtual ~DocumentImpl();
1929     DOMString *stringCache(const DOMString &val);
1931     int namespaceIndex;
1933 protected:
1935     DOMImplementation *parent;
1937     DOMString *documentURI;
1939     DOMString qualifiedName;
1941     DocumentType *doctype;
1943     ElementImpl *documentElement;
1945     class NamedElementItem
1946     {
1947     public:
1948         NamedElementItem()
1949         {
1950             next = NULL;
1951         }
1952         NamedElementItem(const DOMString &nameArg, Element *elemArg)
1953         {
1954             next = NULL;
1955             name = nameArg;
1956             elem = elemArg;
1957         }
1958         ~NamedElementItem()
1959         {
1960             if (next)
1961                 delete next;
1962         }
1963         NamedElementItem *next;
1964         DOMString        name;
1965         Element          *elem;
1966     };
1968     NamedElementItem elementsById;
1971     DOMString xmlEncoding;
1973     DOMString inputEncoding;
1975     DOMString xmlVersion;
1977     bool xmlStandalone;
1979     bool strictErrorChecking;
1981     DOMConfiguration *domConfig;
1983     NamedNodeMap namespaceURIs;
1986 };
1998 }  //namespace dom
1999 }  //namespace w3c
2000 }  //namespace org
2003 #endif // __DOMIMPL_H__
2006 /*#########################################################################
2007 ## E N D    O F    F I L E
2008 #########################################################################*/