diff options
author | Janne Anttila <janne.anttila@digia.com> | 2009-06-15 11:28:33 (GMT) |
---|---|---|
committer | Janne Anttila <janne.anttila@digia.com> | 2009-06-15 11:28:33 (GMT) |
commit | cd65205801f1be59d336e68d33a0e819b7f1170b (patch) | |
tree | 1f1e7e3ea7cbad721018822c891543c13fa4c368 | |
parent | 7887079cbb5e543728d205b8358163c25d31fbfa (diff) | |
parent | 4471ca95875e90de98c62072bb018fbd3d4d6ebe (diff) | |
download | Qt-cd65205801f1be59d336e68d33a0e819b7f1170b.zip Qt-cd65205801f1be59d336e68d33a0e819b7f1170b.tar.gz Qt-cd65205801f1be59d336e68d33a0e819b7f1170b.tar.bz2 |
Merge branch 'master' of git@scm.dev.troll.no:qt/qt-s60-public
-rw-r--r-- | doc/src/platform-notes.qdoc | 2 | ||||
-rw-r--r-- | doc/src/symbian-exceptionsafety.qdoc | 12 | ||||
-rw-r--r-- | src/corelib/global/qglobal.cpp | 48 | ||||
-rw-r--r-- | src/corelib/global/qglobal.h | 12 |
4 files changed, 26 insertions, 48 deletions
diff --git a/doc/src/platform-notes.qdoc b/doc/src/platform-notes.qdoc index 63b721a..53db855 100644 --- a/doc/src/platform-notes.qdoc +++ b/doc/src/platform-notes.qdoc @@ -521,7 +521,7 @@ supported by Qt can be found on the \l{Supported Platforms} page. For information about mixing exceptions with symbian leaves, - see \l QSymbianLeaveException. + see \l{Exception Safety with Symbian} */ /*! diff --git a/doc/src/symbian-exceptionsafety.qdoc b/doc/src/symbian-exceptionsafety.qdoc index 212f707..ea9e9b8 100644 --- a/doc/src/symbian-exceptionsafety.qdoc +++ b/doc/src/symbian-exceptionsafety.qdoc @@ -80,11 +80,11 @@ Symbian leaves to standard C++ exceptions. The following help is provided: \list - \o \l qt_translateSymbianErrorToException(int error) takes a Symbian + \o \l qt_translateSymbianErrorToException() takes a Symbian error code and throws an appropriate exception to represent it. This will do nothing if the error code is not in fact an error. The function is equivalent to Symbian's \c User::LeaveIfError. - \o \l QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION(f) takes a Symbian leaving + \o \l QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION() takes a Symbian leaving code fragment f and runs it under a trap harness converting any resulting error into an exception. \o \c TRAP and \c TRAPD from the Symbian libraries can be used to convert @@ -113,18 +113,18 @@ provided: \list - \o \l qt_translateExceptionToSymbianError(const std::exception& ex) - + \o \l qt_translateExceptionToSymbianError() - this takes a standard exception and gives an appropriate Symbian error code. If no mapping is known for the exception type, \c KErrGeneral is returned. - \o \l qt_translateExceptionToSymbianErrorL(const std::exception& ex) - + \o \l qt_translateExceptionToSymbianErrorL() - this takes a standard exception and generates an appropriate Symbian leave. - \o \l QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_ERROR(err, f) - this macro + \o \l QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_ERROR() - this macro takes the standard C++ code fragment \c f, catches any std::exceptions thrown from it, and sets err to the corresponding Symbian error code. err is set to \c KErrNone otherwise. - \o \l QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_LEAVE(f) - this macro takes the + \o \l QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_LEAVE() - this macro takes the standard C++ code fragment \c f, catches any std::exceptions thrown from it, and throws a corresponding Symbian leave. \endlist diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 6590ea6..e53fd2d 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -3215,7 +3215,8 @@ bool QInternal::callFunction(InternalFunction func, void **args) #include <typeinfo> /*! \macro QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION(function) - \relates QSymbianLeaveException + \relates <QtGlobal> + \ingroup qts60 TRAP leaves from Symbian \a function and throws an appropriate standard C++ exception instead. @@ -3241,7 +3242,7 @@ bool QInternal::callFunction(InternalFunction func, void **args) */ /*! \macro QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_ERROR(error, function) - \relates QSymbianLeaveException + \relates <QtGlobal> \ingroup qts60 Catch standard C++ exceptions from a \a function and convert them to a Symbian OS @@ -3272,7 +3273,7 @@ bool QInternal::callFunction(InternalFunction func, void **args) */ /*! \macro QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_LEAVE(function) - \relates QSymbianLeaveException + \relates <QtGlobal> \ingroup qts60 Catch standard C++ exceptions from \a function and convert them to Symbian OS @@ -3298,37 +3299,22 @@ bool QInternal::callFunction(InternalFunction func, void **args) \sa QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION(), QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_ERROR() */ -/*! \class QSymbianLeaveException - \ingroup qts60 - \brief The QSymbianLeaveException class represents a block of Symbian leave code. - - \warning This class is only available on Symbian. -*/ - -/*! \fn QSymbianLeaveException::QSymbianLeaveException(int error) +#include <stdexcept> - Constructs a QSymbianLeaveException object that stores the given - Symbian \a error code. -*/ - -/*! \fn const char *QSymbianLeaveException::what() const - - Returns a C-style character string describing the general - cause of the current error. - - The string is not localized. -*/ -const char *QSymbianLeaveException::what() const throw() +class QSymbianLeaveException : public std::exception { - static char msg[36]; - snprintf(msg, sizeof(msg), "Symbian leave exception %d", error); - return msg; -} +public: + inline QSymbianLeaveException(int err) : error(err) {} + inline const char* what() const throw() { return "Symbian leave exception"; } + +public: + int error; +}; -/*! \relates QSymbianLeaveException +/*! \relates <QtGlobal> \ingroup qts60 - Throws a QSymbianLeaveException if the \a error parameter is a symbian error code. + Throws an exception if the \a error parameter is a symbian error code. This is the exception throwing equivalent of Symbian's User::LeaveIfError. \warning This function is only available on Symbian. @@ -3347,7 +3333,7 @@ void qt_translateSymbianErrorToException(int error) } } -/*! \relates QSymbianLeaveException +/*! \relates <QtGlobal> \ingroup qts60 Convert a caught standard C++ exception \a aThrow to a Symbian leave @@ -3361,7 +3347,7 @@ void qt_translateExceptionToSymbianErrorL(const std::exception& aThrow) User::Leave(qt_translateExceptionToSymbianError(aThrow)); } -/*! \relates QSymbianLeaveException +/*! \relates <QtGlobal> \ingroup qts60 Convert a caught standard C++ exception \a aThrow to a Symbian error code diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 10dee86..825b7e8 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -2312,16 +2312,8 @@ QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathSysconf(); #if defined(Q_OS_SYMBIAN) -#include <stdexcept> - -class Q_CORE_EXPORT QSymbianLeaveException : public std::exception -{ -public: - inline QSymbianLeaveException(int err) : error(err) {} - const char* what() const throw(); -public: - int error; -}; +// forward declare std::exception +namespace std { class exception; } Q_CORE_EXPORT void qt_translateSymbianErrorToException(int error); Q_CORE_EXPORT void qt_translateExceptionToSymbianErrorL(const std::exception& ex); |