KTextEditor casts
Simon Hausmann
hausmann at kde.org
Mon May 27 09:47:02 UTC 2002
On Sun, May 26, 2002 at 06:03:13PM +0200, Christoph Cullmann wrote:
> On Sunday 26 May 2002 16:46, Christoph Cullmann wrote:
> > On Sunday 26 May 2002 16:32, Bernd Gehrmann wrote:
> > > On Saturday 25 May 2002 19:34, you wrote:
> > > > Hi,
> > > > some KTextEditor news:
> > > > Now each interfaces has a global "cast function":
> > >
> > > Nice. But what about making these functions safe against null arguments?
> > > For example, it would be nice if the following would be possible:
> > >
> > > void Foo::activePartChanged(KParts::Part *part)
> > > {
> > > // Return if either no part is active or the interface is not
> > > implemented KTextEditor::EditInterface *iface =
> > > KTextEditor::editInterface(part); if (!iface)
> > > return;
> > > ....
> > > }
> > >
> > > (hypothetical example of course)
> >
> > Yeah, forgotten that, will do that if I get some time ;) (just a if (!doc)
> > return 0 check won' hurt me ;)
>
> Done, 0 check for argument done in the cast functions now.
Probably more important is to check for 0 on the caller side, as
qt_cast itself may fail :)
Simon
More information about the KDevelop-devel
mailing list