KTextEditor casts

Christoph Cullmann cullmann at babylon2k.de
Sat May 25 19:35:06 UTC 2002


Hi,
some KTextEditor news:
Now each interfaces has a global "cast function":
For example PrintInterface:

namespace KTextEditor
{

static PrintInterface *printInterface (Document *doc)
{
  return 
static_cast<PrintInterface*>(doc->qt_cast("KTextEditor::PrintInterface"));
};

};

Usage would be for example:
KTextEditor::printInterface(kateView->document())->print ();

What would we win:
- shorter to type than using qt_cast manually (even shorter than dyn. cast)
- uses save qt_cast, will avoid failure of dynamic_cast usage (which has been 
discussed some time ago on kde-core-devel I guess)
- only applyable to the right class (no chance to use doc where view is needed
and the other way around)

cu
Christoph

-- 
Christoph Cullmann
Kate/KDE developer
cullmann at kde.org
http://kate.kde.org




More information about the KDevelop-devel mailing list