Re: [Libxmlplusplus-general] dom_parser example using Visitor pattern



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Le Jeudi 6 Février 2003 17:50, Stefan Seefeld a écrit :
> 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)

Implemented by users, but with a default empty implementation I think.
We could then make a visitor which will 'see' only the TextNodes of a Document 
for example.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+QptYB+sU3TyOQjARAt7NAJwNjzfZ9zdRvNgIpZer7rDd6cbIuACeOwOk
ecXYt+qPWy/SeRV3K3PZ4/4=
=Pn76
-----END PGP SIGNATURE-----





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