Re: [libxml++] node iterators



Christophe de VIENNE wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


ok. What are the remaining issues with the iterator proposal ? Could
you please sum up so we can get ahead with this ?



Personnaly I think that implement strictly one of the STL container idiom would be nice. Jonathan proposed sequence. Since it is quite simple and probably complete enough I think it is a reasonnable choice.

It seems there are two ways to do this without creating too much
overhead:

1) let the 'Node' object itself act as the container (which it actually
   is in libxml2), using 'child_iterator' and 'attribute_iterator'.

2) provide a thin 'NodeList' interface that provides the STL API. 'Node'
   would then have two methods 'NodeList get_children()' and
   'NodeList get_attributes()'.


1) is what I currently propose, while 2) is a slight modification of
what a) exists now and b) Jonathan suggests. The advantages over the
original suggestion (just using an STL container 'NodeList') is that it
could avoid unnecessary copying. So, while 2) still uses one (IMO) unnecessary indirection (you have to access the 'children' container
to iterate it, instead of directly accessing the 'child_iterators')
It seems to be quite reasonable performance-wise.

Comments ?

Stefan





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]