Convert C++ exceptions to a qFatal
Annotate for file src/lib/qt-smoke.cpp
2010-01-10 tobias 1 #include <qnamespace.h>
08:52:49 ' 2 #include <QEvent>
' 3 #include <QtDebug>
' 4
' 5 #include "cl_smoke_qt.h"
' 6
' 7 /** @file
' 8 * @brief Qt support functions */
' 9
2009-12-13 tobias 10 #include <exception>
10:49:35 ' 11
' 12 static void
' 13 terminate()
' 14 {
' 15 qFatal("caught an exception.");
' 16 }
' 17
2010-01-10 tobias 18 extern "C" {
08:52:49 ' 19
' 20 /** Registers a callback to be invoked for every QEvent.
' 21 * @see QCoreApplication::notifyInternal
' 22 *
' 23 * @param callback the callback
' 24 *
' 25 * @return @c true on success and @c false otherwise
' 26 */
' 27 CL_SMOKE_QT_EXPORT int
' 28 qt_smoke_register_event_notify(void* callback)
' 29 {
' 30 Q_ASSERT(callback);
2009-12-13 tobias 31 std::set_terminate(terminate);
2010-01-10 tobias 32
08:52:49 ' 33 return QInternal::registerCallback(QInternal::EventNotifyCallback,
' 34 reinterpret_cast<qInternalCallback>(callback));
' 35 }
' 36
' 37 /** Returns the most specific QMetaObject of the QObject instance @a object.
' 38 * Used to determine the actual class of an object. Smoke can not be used since it calls the
' 39 * metaObject() of the class the method was called for.
' 40 *
' 41 * @param object A QObject
' 42 *
' 43 * @return QMetaObject
' 44 */
' 45 CL_SMOKE_QT_EXPORT void*
' 46 qt_smoke_meta_object(void* object)
' 47 {
' 48 Q_ASSERT(object);
' 49 static_cast<QObject*>(object)->metaObject();
' 50 }
' 51
' 52
' 53 } // extern "C"