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 {
00228 impl = 0;
00229 }
00230
00231 TreeWalker::TreeWalker(
const TreeWalker &other)
00232 {
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.
handle());
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