summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qsize.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2014-12-26 21:43:40 +0100
committerMarc Mutz <marc.mutz@kdab.com>2015-01-08 00:12:26 +0100
commitceb753626f694c8539c1155528886feb6dc18c80 (patch)
treeabdb2e84bef82bb9c0eb45c09785bf0c7e57f545 /src/corelib/tools/qsize.cpp
parentd72544ea1192d520dd6af1a0c1cec42e2636b67f (diff)
QSize: plaster API with Q_DECL_NOTHROW
This is mostly straight-forward, but some things are worth noting: 1. Yes, this is necessary. The noexcept operator looks for noexcept tagging, not at the contents of the function to determine whether to return true. The more conditionally-noexcept functions are used, the more important it becomes that low-level classes are correctly marked noexcept. In that, it is like constexpr. 2. In accordance with the rules governing noexcept specifications for the standard library itself, the operator/-family of functions are not marked as noexcept, since they have preconditions and thus a narrow contract. Narrow-contract functions should not be noexcept. All other functions have wide contracts (ie. no preconditions). Change-Id: I9fc94218a2728c272483f9c2826c265f5b11c9b4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qsize.cpp')
-rw-r--r--src/corelib/tools/qsize.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/tools/qsize.cpp b/src/corelib/tools/qsize.cpp
index 4c124162a1..12673ccd0c 100644
--- a/src/corelib/tools/qsize.cpp
+++ b/src/corelib/tools/qsize.cpp
@@ -156,7 +156,7 @@ QT_BEGIN_NAMESPACE
\sa setWidth(), setHeight(), transposed()
*/
-void QSize::transpose()
+void QSize::transpose() Q_DECL_NOTHROW
{
int tmp = wd;
wd = ht;
@@ -217,7 +217,7 @@ void QSize::transpose()
Return a size scaled to a rectangle with the given size \a s,
according to the specified \a mode.
*/
-QSize QSize::scaled(const QSize &s, Qt::AspectRatioMode mode) const
+QSize QSize::scaled(const QSize &s, Qt::AspectRatioMode mode) const Q_DECL_NOTHROW
{
if (mode == Qt::IgnoreAspectRatio || wd == 0 || ht == 0) {
return s;
@@ -590,7 +590,7 @@ QDebug operator<<(QDebug dbg, const QSize &s)
\sa setWidth(), setHeight(), transposed()
*/
-void QSizeF::transpose()
+void QSizeF::transpose() Q_DECL_NOTHROW
{
qreal tmp = wd;
wd = ht;
@@ -651,7 +651,7 @@ void QSizeF::transpose()
Returns a size scaled to a rectangle with the given size \a s,
according to the specified \a mode.
*/
-QSizeF QSizeF::scaled(const QSizeF &s, Qt::AspectRatioMode mode) const
+QSizeF QSizeF::scaled(const QSizeF &s, Qt::AspectRatioMode mode) const Q_DECL_NOTHROW
{
if (mode == Qt::IgnoreAspectRatio || qIsNull(wd) || qIsNull(ht)) {
return s;