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