dom2_traversal.cpp
00001
00023 #include "dom/dom_exception.h"
00024 #include "dom/dom_string.h"
00025 #include "xml/dom2_traversalimpl.h"
00026
00027 using namespace DOM;
00028
00029
00030 NodeIterator::NodeIterator()
00031 {
00032 impl = 0;
00033 }
00034
00035 NodeIterator::NodeIterator(const NodeIterator &other)
00036 {
00037 impl = other.impl;
00038 if (impl) impl->ref();
00039 }
00040
00041 NodeIterator::NodeIterator(NodeIteratorImpl *i)
00042 {
00043 impl = i;
00044 if (impl) impl->ref();
00045 }
00046
00047 NodeIterator &NodeIterator::operator = (const NodeIterator &other)
00048 {
00049 if ( impl != other.impl ) {
00050 if (impl) impl->deref();
00051 impl = other.impl;
00052 if (impl) impl->ref();
00053 }
00054 return *this;
00055 }
00056
00057 NodeIterator::~NodeIterator()
00058 {
00059 if (impl) impl->deref();
00060 }
00061
00062 Node NodeIterator::root()
00063 {
00064 if (impl) return impl->root();
00065 return 0;
00066 }
00067
00068 unsigned long NodeIterator::whatToShow()
00069 {
00070 if (impl) return impl->whatToShow();
00071 return 0;
00072 }
00073
00074 NodeFilter NodeIterator::filter()
00075 {
00076 if (impl) return impl->filter();
00077 return 0;
00078 }
00079
00080 bool NodeIterator::expandEntityReferences()
00081 {
00082 if (impl) return impl->expandEntityReferences();
00083 return 0;
00084 }
00085
00086 Node NodeIterator::nextNode( )
00087 {
00088 if (!impl)
00089 throw DOMException(DOMException::INVALID_STATE_ERR);
00090
00091 int exceptioncode = 0;
00092 NodeImpl *r = impl->nextNode(exceptioncode);
00093 if (exceptioncode)
00094 throw DOMException(exceptioncode);
00095 return r;
00096 }
00097
00098 Node NodeIterator::previousNode( )
00099 {
00100 if (!impl)
00101 throw DOMException(DOMException::INVALID_STATE_ERR);
00102
00103 int exceptioncode = 0;
00104 NodeImpl *r = impl->previousNode(exceptioncode);
00105 if (exceptioncode)
00106 throw DOMException(exceptioncode);
00107 return r;
00108 }
00109
00110 void NodeIterator::detach()
00111 {
00112 if (!impl)
00113 throw DOMException(DOMException::INVALID_STATE_ERR);
00114
00115 int exceptioncode = 0;
00116 impl->detach(exceptioncode);
00117 if (exceptioncode)
00118 throw DOMException(exceptioncode);
00119 }
00120
00121 NodeIteratorImpl *NodeIterator::handle() const
00122 {
00123 return impl;
00124 }
00125
00126 bool NodeIterator::isNull() const
00127 {
00128 return (impl == 0);
00129 }
00130
00131
00132
00133 NodeFilter::NodeFilter()
00134 {
00135 impl = 0;
00136 }
00137
00138 NodeFilter::NodeFilter(const NodeFilter &other)
00139 {
00140 impl = other.impl;
00141 if (impl) impl->ref();
00142 }
00143
00144 NodeFilter::NodeFilter(NodeFilterImpl *i)
00145 {
00146 impl = i;
00147 if (impl) impl->ref();
00148 }
00149
00150 NodeFilter &NodeFilter::operator = (const NodeFilter &other)
00151 {
00152 if ( impl != other.impl ) {
00153 if (impl) impl->deref();
00154 impl = other.impl;
00155 if (impl) impl->ref();
00156 }
00157 return *this;
00158 }
00159
00160 NodeFilter::~NodeFilter()
00161 {
00162 if (impl) impl->deref();
00163 }
00164
00165 short NodeFilter::acceptNode(const Node &n)
00166 {
00167 if (impl) return impl->acceptNode(n);
00168 return 0;
00169 }
00170
00171 void NodeFilter::setCustomNodeFilter(CustomNodeFilter *custom)
00172 {
00173 if (impl) impl->setCustomNodeFilter(custom);
00174 }
00175
00176 CustomNodeFilter *NodeFilter::customNodeFilter()
00177 {
00178 if (impl) return impl->customNodeFilter();
00179 return 0;
00180 }
00181
00182 NodeFilterImpl *NodeFilter::handle() const
00183 {
00184 return impl;
00185 }
00186
00187 bool NodeFilter::isNull() const
00188 {
00189 return (impl == 0);
00190 }
00191
00192 NodeFilter NodeFilter::createCustom(CustomNodeFilter *custom)
00193 {
00194 NodeFilterImpl *i = new NodeFilterImpl();
00195 i->setCustomNodeFilter(custom);
00196 return i;
00197 }
00198
00199
00200 CustomNodeFilter::CustomNodeFilter()
00201 {
00202 impl = 0;
00203 }
00204
00205 CustomNodeFilter::~CustomNodeFilter()
00206 {
00207 }
00208
00209 short CustomNodeFilter::acceptNode (const Node &)
00210 {
00211 return NodeFilter::FILTER_ACCEPT;
00212 }
00213
00214 bool CustomNodeFilter::isNull()
00215 {
00216 return false;
00217 }
00218
00219 DOMString CustomNodeFilter::customNodeFilterType()
00220 {
00221 return "";
00222 }
00223
00224
00225
00226 TreeWalker::TreeWalker() {
00227 impl = 0;
00228 }
00229
00230 TreeWalker::TreeWalker(const TreeWalker &other) {
00231 impl = other.impl;
00232 if (impl) impl->ref();
00233 }
00234
00235 TreeWalker::TreeWalker(TreeWalkerImpl *i)
00236 {
00237 impl = i;
00238 if (impl) impl->ref();
00239 }
00240
00241 TreeWalker & TreeWalker::operator = (const TreeWalker &other)
00242 {
00243 if ( impl != other.impl ) {
00244 if (impl) impl->deref();
00245 impl = other.impl;
00246 if (impl) impl->ref();
00247 }
00248
00249 return *this;
00250 }
00251
00252 TreeWalker::~TreeWalker()
00253 {
00254 if (impl) impl->deref();
00255 }
00256
00257 Node TreeWalker::root()
00258 {
00259 if (impl) return impl->getRoot();
00260 return 0;
00261 }
00262
00263 unsigned long TreeWalker::whatToShow()
00264 {
00265 if (impl) return impl->getWhatToShow();
00266 return 0;
00267 }
00268
00269 NodeFilter TreeWalker::filter()
00270 {
00271 if (impl) return impl->getFilter();
00272 return 0;
00273 }
00274
00275 bool TreeWalker::expandEntityReferences()
00276 {
00277 if (impl) return impl->getExpandEntityReferences();
00278 return false;
00279 }
00280
00281 Node TreeWalker::currentNode()
00282 {
00283 if (impl) return impl->getCurrentNode();
00284 return 0;
00285 }
00286
00287 void TreeWalker::setCurrentNode(const Node _currentNode)
00288 {
00289 if (impl) impl->setCurrentNode(_currentNode);
00290 }
00291
00292 Node TreeWalker::parentNode()
00293 {
00294 if (impl) return impl->parentNode();
00295 return 0;
00296 }
00297
00298 Node TreeWalker::firstChild()
00299 {
00300 if (impl) return impl->firstChild();
00301 return 0;
00302 }
00303
00304 Node TreeWalker::lastChild()
00305 {
00306 if (impl) return impl->lastChild();
00307 return 0;
00308 }
00309
00310 Node TreeWalker::previousSibling()
00311 {
00312 if (impl) return impl->previousSibling();
00313 return 0;
00314 }
00315
00316 Node TreeWalker::nextSibling()
00317 {
00318 if (impl) return impl->nextSibling();
00319 return 0;
00320 }
00321
00322 Node TreeWalker::previousNode()
00323 {
00324 if (impl) return impl->previousNode();
00325 return 0;
00326 }
00327
00328 Node TreeWalker::nextNode()
00329 {
00330 if (impl) return impl->nextNode();
00331 return 0;
00332 }
00333
00334 TreeWalkerImpl *TreeWalker::handle() const
00335 {
00336 return impl;
00337 }
00338
00339 bool TreeWalker::isNull() const
00340 {
00341 return (impl == 0);
00342 }
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
This file is part of the documentation for khtml Library Version 3.2.0.