diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/global/qglobal.cpp | 48 | ||||
-rw-r--r-- | src/corelib/global/qglobal.h | 12 | ||||
-rw-r--r-- | src/corelib/tools/qscopedpointer.cpp | 15 | ||||
-rw-r--r-- | src/gui/painting/qpainterpath.cpp | 18 | ||||
-rw-r--r-- | src/gui/painting/qpainterpath.h | 6 |
5 files changed, 55 insertions, 44 deletions
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 450fd86..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 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); diff --git a/src/corelib/tools/qscopedpointer.cpp b/src/corelib/tools/qscopedpointer.cpp index 0239575..6a1ffb6 100644 --- a/src/corelib/tools/qscopedpointer.cpp +++ b/src/corelib/tools/qscopedpointer.cpp @@ -134,6 +134,21 @@ */ /*! + \fn bool QScopedPointer::operator==(const QScopedPointer<T> &other) const + + Equality operator. Returns true if the scoped pointer \a other + is pointing to the same object as this pointer, otherwise returns false. +*/ + + +/*! + \fn bool QScopedPointer::operator!=(const QScopedPointer<T> *other) const + + Inequality operator. Returns true if the scoped pointer \a other + is not pointing to the same object as this pointer, otherwise returns false. +*/ + +/*! \fn bool QScopedPointer::isNull() const Returns \c true if this object is holding a pointer that is \c null. diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index 12dbc62..635218e 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -73,6 +73,24 @@ QT_BEGIN_NAMESPACE +struct QPainterPathPrivateHandler +{ + static inline void cleanup(QPainterPathPrivate *d) + { + // note - we must up-cast to QPainterPathData since QPainterPathPrivate + // has a non-virtual destructor! + if (d && !d->ref.deref()) + delete static_cast<QPainterPathData *>(d); + } + + static inline void reset(QPainterPathPrivate *&d, QPainterPathPrivate *other) + { + QPainterPathPrivate *oldD = d; + d = other; + cleanup(oldD); + } +}; + // This value is used to determine the length of control point vectors // when approximating arc segments as curves. The factor is multiplied // with the radius of the circle. diff --git a/src/gui/painting/qpainterpath.h b/src/gui/painting/qpainterpath.h index 0513593..e12194e 100644 --- a/src/gui/painting/qpainterpath.h +++ b/src/gui/painting/qpainterpath.h @@ -57,6 +57,7 @@ QT_MODULE(Gui) class QFont; class QPainterPathPrivate; +struct QPainterPathPrivateHandler; class QPainterPathData; class QPainterPathStrokerPrivate; class QPolygonF; @@ -196,7 +197,7 @@ public: QPainterPath &operator-=(const QPainterPath &other); private: - QScopedSharedPointer<QPainterPathPrivate> d_ptr; + QScopedCustomPointer<QPainterPathPrivate, QPainterPathPrivateHandler> d_ptr; inline void ensureData() { if (!d_ptr) ensureData_helper(); } void ensureData_helper(); @@ -230,8 +231,7 @@ public: friend class QPainterPathStrokerPrivate; friend class QMatrix; friend class QTransform; - friend class QScopedSharedPointer<QPainterPathPrivate>; - friend class QScopedSharedPointerHandler<QPainterPathPrivate>; + friend struct QPainterPathPrivateHandler; #ifndef QT_NO_DATASTREAM friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPainterPath &); friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPainterPath &); |