• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KHTML

dom2_traversal.cpp

Go to the documentation of this file.
00001 
00023 #include "dom/dom_exception.h"
00024 #include "dom/dom_string.h"
00025 #include "xml/dom_nodeimpl.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     void* dummy;
00090     if (!impl)
00091     throw DOMException(DOMException::INVALID_STATE_ERR);
00092 
00093     int exceptioncode = 0;
00094     SharedPtr<NodeImpl> r = impl->nextNode(exceptioncode, dummy);
00095     if (exceptioncode)
00096     throw DOMException(exceptioncode);
00097     return r.get();
00098 }
00099 
00100 Node NodeIterator::previousNode(  )
00101 {
00102     void* dummy; // ### rely on C++ exception propagation --- might not be safe
00103                  // we could probably proxy the DOM exceptions at the very least
00104     if (!impl)
00105     throw DOMException(DOMException::INVALID_STATE_ERR);
00106 
00107     int exceptioncode = 0;
00108     SharedPtr<NodeImpl> r = impl->previousNode(exceptioncode, dummy);
00109     if (exceptioncode)
00110     throw DOMException(exceptioncode);
00111     return r.get();
00112 }
00113 
00114 void NodeIterator::detach()
00115 {
00116     if (!impl)
00117     throw DOMException(DOMException::INVALID_STATE_ERR);
00118 
00119     int exceptioncode = 0;
00120     impl->detach(exceptioncode);
00121     if (exceptioncode)
00122     throw DOMException(exceptioncode);
00123 }
00124 
00125 NodeIteratorImpl *NodeIterator::handle() const
00126 {
00127     return impl;
00128 }
00129 
00130 bool NodeIterator::isNull() const
00131 {
00132     return (impl == 0);
00133 }
00134 
00135 // -----------------------------------------------------------
00136 
00137 NodeFilter::NodeFilter()
00138 {
00139     impl = 0;
00140 }
00141 
00142 NodeFilter::NodeFilter(const NodeFilter &other)
00143 {
00144     impl = other.impl;
00145     if (impl) impl->ref();
00146 }
00147 
00148 NodeFilter::NodeFilter(NodeFilterImpl *i)
00149 {
00150     impl = i;
00151     if (impl) impl->ref();
00152 }
00153 
00154 NodeFilter &NodeFilter::operator = (const NodeFilter &other)
00155 {
00156     if ( impl != other.impl ) {
00157     if (impl) impl->deref();
00158     impl = other.impl;
00159     if (impl) impl->ref();
00160     }
00161     return *this;
00162 }
00163 
00164 NodeFilter::~NodeFilter()
00165 {
00166     if (impl) impl->deref();
00167 }
00168 
00169 short NodeFilter::acceptNode(const Node &n)
00170 {
00171     void* dummy;
00172     if (impl) return impl->acceptNode(n, dummy);
00173     return 0;
00174 }
00175 
00176 void NodeFilter::setCustomNodeFilter(CustomNodeFilter *custom)
00177 {
00178     if (impl) impl->setCustomNodeFilter(custom);
00179 }
00180 
00181 CustomNodeFilter *NodeFilter::customNodeFilter()
00182 {
00183     if (impl) return impl->customNodeFilter();
00184     return 0;
00185 }
00186 
00187 NodeFilterImpl *NodeFilter::handle() const
00188 {
00189     return impl;
00190 }
00191 
00192 bool NodeFilter::isNull() const
00193 {
00194     return (impl == 0);
00195 }
00196 
00197 NodeFilter NodeFilter::createCustom(CustomNodeFilter *custom)
00198 {
00199     NodeFilterImpl *i = new NodeFilterImpl();
00200     i->setCustomNodeFilter(custom);
00201     return i;
00202 }
00203 
00204 // --------------------------------------------------------------
00205 CustomNodeFilter::CustomNodeFilter()
00206 {
00207     impl = 0;
00208 }
00209 
00210 CustomNodeFilter::~CustomNodeFilter()
00211 {
00212 }
00213 
00214 short CustomNodeFilter::acceptNode (const Node &/*n*/)
00215 {
00216     return NodeFilter::FILTER_ACCEPT;
00217 }
00218 
00219 bool CustomNodeFilter::isNull()
00220 {
00221     return false;
00222 }
00223 
00224 DOMString CustomNodeFilter::customNodeFilterType()
00225 {
00226     return "";
00227 }
00228 
00229 // --------------------------------------------------------------
00230 
00231 TreeWalker::TreeWalker()
00232 {
00233     impl = 0;
00234 }
00235 
00236 TreeWalker::TreeWalker(const TreeWalker &other)
00237 {
00238     impl = other.impl;
00239     if (impl) impl->ref();
00240 }
00241 
00242 TreeWalker::TreeWalker(TreeWalkerImpl *i)
00243 {
00244     impl = i;
00245     if (impl) impl->ref();
00246 }
00247 
00248 TreeWalker & TreeWalker::operator = (const TreeWalker &other)
00249 {
00250     if ( impl != other.impl ) {
00251     if (impl) impl->deref();
00252     impl = other.impl;
00253     if (impl) impl->ref();
00254     }
00255 
00256     return *this;
00257 }
00258 
00259 TreeWalker::~TreeWalker()
00260 {
00261     if (impl) impl->deref();
00262 }
00263 
00264 Node TreeWalker::root()
00265 {
00266     if (impl) return impl->getRoot();
00267     return 0;
00268 }
00269 
00270 unsigned long TreeWalker::whatToShow()
00271 {
00272     if (impl) return impl->getWhatToShow();
00273     return 0;
00274 }
00275 
00276 NodeFilter TreeWalker::filter()
00277 {
00278     if (impl) return impl->getFilter();
00279     return 0;
00280 }
00281 
00282 bool TreeWalker::expandEntityReferences()
00283 {
00284     if (impl) return impl->getExpandEntityReferences();
00285     return false;
00286 }
00287 
00288 Node TreeWalker::currentNode()
00289 {
00290     if (impl) return impl->getCurrentNode();
00291     return 0;
00292 }
00293 
00294 void TreeWalker::setCurrentNode(const Node& _currentNode)
00295 {
00296     int exceptionCode = 0;
00297     if (impl) impl->setCurrentNode(_currentNode.handle(), exceptionCode);
00298     if (exceptionCode)
00299         throw DOMException(exceptionCode);
00300 }
00301 
00302 Node TreeWalker::parentNode()
00303 {
00304     void *dummy;
00305     if (impl) return impl->parentNode(dummy);
00306     return 0;
00307 }
00308 
00309 Node TreeWalker::firstChild()
00310 {
00311     void *dummy;
00312     if (impl) return impl->firstChild(dummy);
00313     return 0;
00314 }
00315 
00316 Node TreeWalker::lastChild()
00317 {
00318     void *dummy;
00319     if (impl) return impl->lastChild(dummy);
00320     return 0;
00321 }
00322 
00323 Node TreeWalker::previousSibling()
00324 {
00325     void *dummy;
00326     if (impl) return impl->previousSibling(dummy);
00327     return 0;
00328 }
00329 
00330 Node TreeWalker::nextSibling()
00331 {
00332     void *dummy;
00333     if (impl) return impl->nextSibling(dummy);
00334     return 0;
00335 }
00336 
00337 Node TreeWalker::previousNode()
00338 {
00339     void *dummy;
00340     if (impl) return impl->previousNode(dummy);
00341     return 0;
00342 }
00343 
00344 Node TreeWalker::nextNode()
00345 {
00346     void *dummy;
00347     if (impl) return impl->nextNode(dummy);
00348     return 0;
00349 }
00350 
00351 TreeWalkerImpl *TreeWalker::handle() const
00352 {
00353     return impl;
00354 }
00355 
00356 bool TreeWalker::isNull() const
00357 {
00358     return (impl == 0);
00359 }
00360 

KHTML

Skip menu "KHTML"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal