Re: [Libxmlplusplus-general] dom_parser example using Visitor pattern
- From: Stefan Seefeld <seefeld sympatico ca>
- To: libxmlplusplus-general lists sourceforge net
- Subject: Re: [Libxmlplusplus-general] dom_parser example using Visitor pattern
- Date: Thu, 06 Feb 2003 11:50:21 -0500
Murray Cumming wrote:
On Tue, 2003-02-04 at 08:21, Stefan Seefeld wrote:
* add a 'Visitor' class to get rid of all the dynamic_casts in the existing
examples
I read that chapter in the Design Patterns book yesterday. It would be
interesting, but I think it should be a separate example (maybe
dom_parser_visitor) because we still need a simple example of the API.
I don't quite see the link between a parser (a document factory), and
a visitor.
I agree that this is quite independent of the rest. It merely addresses
the type safety issue, i.e. it helps us recover the exact type of a
child node.
In terms of API complexity it requires all nodes to have an 'accept'
method, to be implemented as
void Element::accept(Visitor *v) { v->visit_element(this);}
plus a 'Visitor' base class that has one 'visit' method per node type.
(to be implemented by users)
Stefan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]