QPtrDict and DOM::Node ...
Peter Kelly
pmk at kde.org
Tue Apr 29 02:48:04 BST 2003
On Tue, 29 Apr 2003, David Faure wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Tuesday 29 April 2003 02:02, Peter Kelly wrote:
> > These are wrappers around the impl classes and you can
> > create a node object by passing in the impl to the constructor, and then
> > perform all of the neccessary operations through the Node wrapper.
>
> I agree with you in principle, but the problem is:
>
> [...]
> protected:
> Element(ElementImpl *_impl);
>
> This isn't public, so you can't do it. khtml/ecma does it with some "friends"
> declarations here and there (e.g. dom_node.h: friend class KJS::HTMLDocument;)
> but this sucks.
>
> IMHO such constructors should be made public, so that it's possible to
> do the above: use the handles as void pointers, from external code, without
> the need to actually use the Impl classes themselves.
>
> Dirk, would that be ok? I remember some objections when I suggested this
> for khtml/ecma (instead of friends), but I think this is the best solution.
I agree they should be public. However I believe this would break BC.
A workaround is to use the Node constructor first then pass that to the
subclass constructor. Each has a Class(const Node &other) constructor that
can be used for this purpose.
e.g.
NodeImpl *e = getHandle();
Element em = Element(Node(e));
Element x = Element(em.firstChild())
>
> - --
> David FAURE, faure at kde.org, sponsored by TrollTech to work on KDE,
> Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
> How to write a Makefile.am for KDE/Qt code:
> http://developer.kde.org/documentation/other/makefile_am_howto.html
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.7 (GNU/Linux)
>
> iD8DBQE+rcke72KcVAmwbhARAjUwAJwLdUkaSUB/qtNYdXXibyn6eF9X6wCfXViS
> bcFdrGZShHWdqzUJiFFFn70=
> =lUVQ
> -----END PGP SIGNATURE-----
>
--
Peter Kelly
pmk at kde.org
More information about the kfm-devel
mailing list