00001 #ifndef NodeImpl_HEADER_GUARD_
00002 #define NodeImpl_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
00091 #include <xercesc/util/XercesDefs.hpp>
00092 #include "NodeListImpl.hpp"
00093 #include "DOMString.hpp"
00094
00095
00096 class NamedNodeMapImpl;
00097 class NodeListImpl;
00098 class DocumentImpl;
00099
00100
00101
00102
00103
00104
00105 #if defined(XML_CSET)
00106 const int null = 0;
00107 #else
00108 #define null 0
00109 #endif
00110
00111
00112 class CDOM_EXPORT NodeImpl: public NodeListImpl {
00113 public:
00114 NodeImpl *ownerNode;
00115
00116
00117
00118 unsigned short flags;
00119
00120 static const unsigned short READONLY;
00121 static const unsigned short SYNCDATA;
00122 static const unsigned short SYNCCHILDREN;
00123 static const unsigned short OWNED;
00124 static const unsigned short FIRSTCHILD;
00125 static const unsigned short SPECIFIED;
00126 static const unsigned short IGNORABLEWS;
00127 static const unsigned short SETVALUE;
00128 static const unsigned short ID_ATTR;
00129 static const unsigned short USERDATA;
00130 static const unsigned short HASSTRING;
00131
00132 static int gLiveNodeImpls;
00133 static int gTotalNodeImpls;
00134
00135 public:
00136 NodeImpl(DocumentImpl *ownerDocument);
00137 NodeImpl(const NodeImpl &other);
00138 virtual ~NodeImpl();
00139
00140
00141 virtual bool isAttrImpl();
00142 virtual bool isCDATASectionImpl();
00143 virtual bool isDocumentFragmentImpl();
00144 virtual bool isDocumentImpl();
00145 virtual bool isDocumentTypeImpl();
00146 virtual bool isElementImpl();
00147 virtual bool isEntityReference();
00148 virtual bool isTextImpl();
00149
00150 virtual void changed();
00151 virtual int changes();
00152
00153 virtual NodeImpl *appendChild(NodeImpl *newChild);
00154 virtual NodeImpl * cloneNode(bool deep) = 0;
00155 static void deleteIf(NodeImpl *thisNode);
00156 virtual NamedNodeMapImpl * getAttributes();
00157 virtual NodeListImpl *getChildNodes();
00158 virtual NodeImpl * getFirstChild();
00159 virtual NodeImpl * getLastChild();
00160 virtual unsigned int getLength();
00161 virtual NodeImpl * getNextSibling();
00162 virtual DOMString getNodeName() = 0;
00163 virtual short getNodeType() = 0;
00164 virtual DOMString getNodeValue();
00165 virtual DocumentImpl * getOwnerDocument();
00166 virtual NodeImpl * getParentNode();
00167 virtual NodeImpl* getPreviousSibling();
00168 virtual void *getUserData();
00169 virtual bool hasChildNodes();
00170 virtual NodeImpl *insertBefore(NodeImpl *newChild, NodeImpl *refChild);
00171 static bool isKidOK(NodeImpl *parent, NodeImpl *child);
00172 virtual NodeImpl *item(unsigned int index);
00173 virtual void referenced();
00174 virtual NodeImpl * removeChild(NodeImpl *oldChild);
00175 virtual NodeImpl *replaceChild(NodeImpl *newChild, NodeImpl *oldChild);
00176 virtual void setNodeValue(const DOMString &value);
00177 virtual void setReadOnly(bool readOnly, bool deep);
00178 virtual void setUserData(void *value);
00179 virtual DOMString toString();
00180 virtual void unreferenced();
00181
00182
00183 virtual void normalize();
00184 virtual bool isSupported(const DOMString &feature, const DOMString &version);
00185 virtual DOMString getNamespaceURI();
00186 virtual DOMString getPrefix();
00187 virtual DOMString getLocalName();
00188 virtual void setPrefix(const DOMString &prefix);
00189 virtual bool hasAttributes();
00190
00191 protected:
00192
00193 static const DOMString& mapPrefix(const DOMString &prefix,
00194 const DOMString &namespaceURI, short nType);
00195 static DOMString getXmlnsString();
00196 static DOMString getXmlnsURIString();
00197 static DOMString getXmlString();
00198 static DOMString getXmlURIString();
00199
00200 public:
00201
00202 virtual void setOwnerDocument(DocumentImpl *doc);
00203
00204
00205 virtual DocumentImpl * getDocument();
00206
00207
00208
00209
00210
00211 inline bool isReadOnly() const {
00212 return (flags & READONLY) != 0;
00213 }
00214
00215 inline void isReadOnly(bool value) {
00216 flags = (value ? flags | READONLY : flags & ~READONLY);
00217 }
00218
00219 inline bool needsSyncData() const {
00220 return (flags & SYNCDATA) != 0;
00221 }
00222
00223 inline void needsSyncData(bool value) {
00224 flags = (value ? flags | SYNCDATA : flags & ~SYNCDATA);
00225 }
00226
00227 inline bool needsSyncChildren() const {
00228 return (flags & SYNCCHILDREN) != 0;
00229 }
00230
00231 inline void needsSyncChildren(bool value) {
00232 flags = (value ? flags | SYNCCHILDREN : flags & ~SYNCCHILDREN);
00233 }
00234
00235 inline bool isOwned() const {
00236 return (flags & OWNED) != 0;
00237 }
00238
00239 inline void isOwned(bool value) {
00240 flags = (value ? flags | OWNED : flags & ~OWNED);
00241 }
00242
00243 inline bool isFirstChild() const {
00244 return (flags & FIRSTCHILD) != 0;
00245 }
00246
00247 inline void isFirstChild(bool value) {
00248 flags = (value ? flags | FIRSTCHILD : flags & ~FIRSTCHILD);
00249 }
00250
00251 inline bool isSpecified() const {
00252 return (flags & SPECIFIED) != 0;
00253 }
00254
00255 inline void isSpecified(bool value) {
00256 flags = (value ? flags | SPECIFIED : flags & ~SPECIFIED);
00257 }
00258
00259 inline bool ignorableWhitespace() const {
00260 return (flags & IGNORABLEWS) != 0;
00261 }
00262
00263 inline void ignorableWhitespace(bool value) {
00264 flags = (value ? flags | IGNORABLEWS : flags & ~IGNORABLEWS);
00265 }
00266
00267 inline bool setValueCalled() const {
00268 return (flags & SETVALUE) != 0;
00269 }
00270
00271 inline void setValueCalled(bool value) {
00272 flags = (value ? flags | SETVALUE : flags & ~SETVALUE);
00273 }
00274
00275 inline bool isIdAttr() const {
00276 return (flags & ID_ATTR) != 0;
00277 }
00278
00279 inline void isIdAttr(bool value) {
00280 flags = (value ? flags | ID_ATTR : flags & ~ID_ATTR);
00281 }
00282
00283 inline bool hasUserData() const {
00284 return (flags & USERDATA) != 0;
00285 }
00286
00287 inline void hasUserData(bool value) {
00288 flags = (value ? flags | USERDATA : flags & ~USERDATA);
00289 }
00290
00291 inline bool hasStringValue() const {
00292 return (flags & HASSTRING) != 0;
00293 }
00294
00295 inline void hasStringValue(bool value) {
00296 flags = (value ? flags | HASSTRING : flags & ~HASSTRING);
00297 }
00298
00299
00300
00301
00302 static void reinitNodeImpl();
00303
00304 };
00305
00306
00307 #endif