QCameraViewFinderSettings: make op== non-member

...and inline op!=. Mark them as nothrow.

More idiomatic C++ (symmetry between lhs and rhs).

Change-Id: I65ecbef961383897e4e17325ad62d45e1772fbb0
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This commit is contained in:
Marc Mutz
2015-06-11 13:55:43 +02:00
committed by Jani Heikkinen
parent c34cf61312
commit 99bda08cb1
2 changed files with 22 additions and 16 deletions

View File

@@ -136,32 +136,35 @@ QCameraViewfinderSettings &QCameraViewfinderSettings::operator=(const QCameraVie
}
/*!
Determines if \a other is of equal value to a viewfinder settings object.
\relates QCameraViewfinderSettings
\since 5.5
Determines if \a lhs is of equal value to \a rhs.
Returns true if the settings objects are of equal value, and false if they
are not of equal value.
*/
bool QCameraViewfinderSettings::operator==(const QCameraViewfinderSettings &other) const
bool operator==(const QCameraViewfinderSettings &lhs, const QCameraViewfinderSettings &rhs) Q_DECL_NOTHROW
{
return (d == other.d) ||
(d->isNull == other.d->isNull &&
d->resolution == other.d->resolution &&
qFuzzyCompare(d->minimumFrameRate, other.d->minimumFrameRate) &&
qFuzzyCompare(d->maximumFrameRate, other.d->maximumFrameRate) &&
d->pixelFormat == other.d->pixelFormat &&
d->pixelAspectRatio == other.d->pixelAspectRatio);
return (lhs.d == rhs.d) ||
(lhs.d->isNull == rhs.d->isNull &&
lhs.d->resolution == rhs.d->resolution &&
qFuzzyCompare(lhs.d->minimumFrameRate, rhs.d->minimumFrameRate) &&
qFuzzyCompare(lhs.d->maximumFrameRate, rhs.d->maximumFrameRate) &&
lhs.d->pixelFormat == rhs.d->pixelFormat &&
lhs.d->pixelAspectRatio == rhs.d->pixelAspectRatio);
}
/*!
Determines if \a other is of equal value to a viewfinder settings object.
\fn bool operator!=(const QCameraViewfinderSettings &lhs, const QCameraViewfinderSettings &rhs)
\relates QCameraViewfinderSettings
\since 5.5
Determines if \a lhs is of equal value to \a rhs.
Returns true if the settings objects are not of equal value, and false if
they are of equal value.
*/
bool QCameraViewfinderSettings::operator!=(const QCameraViewfinderSettings &other) const
{
return !(*this == other);
}
/*!
Identifies if a viewfinder settings object is uninitalized.

View File

@@ -52,9 +52,8 @@ public:
~QCameraViewfinderSettings();
QCameraViewfinderSettings& operator=(const QCameraViewfinderSettings &other);
bool operator==(const QCameraViewfinderSettings &other) const;
bool operator!=(const QCameraViewfinderSettings &other) const;
friend Q_MULTIMEDIA_EXPORT bool operator==(const QCameraViewfinderSettings &lhs, const QCameraViewfinderSettings &rhs) Q_DECL_NOTHROW;
bool isNull() const;
QSize resolution() const;
@@ -80,6 +79,10 @@ private:
QSharedDataPointer<QCameraViewfinderSettingsPrivate> d;
};
inline bool operator!=(const QCameraViewfinderSettings &lhs, const QCameraViewfinderSettings &rhs) Q_DECL_NOTHROW
{ return !operator==(lhs, rhs); }
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QCameraViewfinderSettings)