[Libxmlplusplus-general] Adding STL-container-like methods to Node instead of returning a container instance

On Tue, 2003-02-04 at 08:21, Stefan Seefeld wrote:
> * enhance the tree manipulation API, adding a Node::child_iterator
>    type, as well as new 'insert_child', and 'append_child' methods
>    (in accordance with the usual STL nomenclature)

Why is this necessary/desirable? I'm concerned that, if we decide to
make xmlpp::Node look like std::list or std::vector, we should add _all_
of the common STL-container methods. For instance, we should add a
reverse iterator, and the front() and back() methods. Then lots of
STL-container-like methods will be mixed up with the Node-specific
methods and it won't be clear what is meant to be used for what
functionality. And we might have made the API bigger and less clear
without adding functionality.

I see that you have tried to avoid this by using method names such as
children_begin() instead of begin() but then I think it's less

If it's absolutely necessary then maybe we could consider an auxillary
object, just to separate that part of the API.

For instance,

NodeChildren& nodeChildren = node.children();
for(NodeChildren::iterator iter = nodeChildren.begin(), iter !=
nodeChildren.end(); ++iter)

We do this, fairly successfully, with some gtkmm classes. But it's not

Murray Cumming
murray usa net

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