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