QRect: 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 get*()-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: I82e5d34a0293d73ddc98ee231e17e26463ab6686 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
63cd16d03c
commit
a92dbddac7
@ -295,7 +295,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
\sa isValid(), isEmpty()
|
\sa isValid(), isEmpty()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
QRect QRect::normalized() const
|
QRect QRect::normalized() const Q_DECL_NOTHROW
|
||||||
{
|
{
|
||||||
QRect r;
|
QRect r;
|
||||||
if (x2 < x1 - 1) { // swap bad x values
|
if (x2 < x1 - 1) { // swap bad x values
|
||||||
@ -804,7 +804,7 @@ QRect QRect::normalized() const
|
|||||||
\sa intersects()
|
\sa intersects()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool QRect::contains(const QPoint &p, bool proper) const
|
bool QRect::contains(const QPoint &p, bool proper) const Q_DECL_NOTHROW
|
||||||
{
|
{
|
||||||
int l, r;
|
int l, r;
|
||||||
if (x2 < x1 - 1) {
|
if (x2 < x1 - 1) {
|
||||||
@ -868,7 +868,7 @@ bool QRect::contains(const QPoint &p, bool proper) const
|
|||||||
rectangle (not on the edge).
|
rectangle (not on the edge).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool QRect::contains(const QRect &r, bool proper) const
|
bool QRect::contains(const QRect &r, bool proper) const Q_DECL_NOTHROW
|
||||||
{
|
{
|
||||||
if (isNull() || r.isNull())
|
if (isNull() || r.isNull())
|
||||||
return false;
|
return false;
|
||||||
@ -946,7 +946,7 @@ bool QRect::contains(const QRect &r, bool proper) const
|
|||||||
\sa operator|=(), united()
|
\sa operator|=(), united()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
QRect QRect::operator|(const QRect &r) const
|
QRect QRect::operator|(const QRect &r) const Q_DECL_NOTHROW
|
||||||
{
|
{
|
||||||
if (isNull())
|
if (isNull())
|
||||||
return r;
|
return r;
|
||||||
@ -1017,7 +1017,7 @@ QRect QRect::operator|(const QRect &r) const
|
|||||||
\sa operator&=(), intersected()
|
\sa operator&=(), intersected()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
QRect QRect::operator&(const QRect &r) const
|
QRect QRect::operator&(const QRect &r) const Q_DECL_NOTHROW
|
||||||
{
|
{
|
||||||
if (isNull() || r.isNull())
|
if (isNull() || r.isNull())
|
||||||
return QRect();
|
return QRect();
|
||||||
@ -1096,7 +1096,7 @@ QRect QRect::operator&(const QRect &r) const
|
|||||||
\sa contains()
|
\sa contains()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool QRect::intersects(const QRect &r) const
|
bool QRect::intersects(const QRect &r) const Q_DECL_NOTHROW
|
||||||
{
|
{
|
||||||
if (isNull() || r.isNull())
|
if (isNull() || r.isNull())
|
||||||
return false;
|
return false;
|
||||||
@ -1522,7 +1522,7 @@ QDebug operator<<(QDebug dbg, const QRect &r)
|
|||||||
\sa isValid(), isEmpty()
|
\sa isValid(), isEmpty()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
QRectF QRectF::normalized() const
|
QRectF QRectF::normalized() const Q_DECL_NOTHROW
|
||||||
{
|
{
|
||||||
QRectF r = *this;
|
QRectF r = *this;
|
||||||
if (r.w < 0) {
|
if (r.w < 0) {
|
||||||
@ -1935,7 +1935,7 @@ QRectF QRectF::normalized() const
|
|||||||
\sa intersects()
|
\sa intersects()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool QRectF::contains(const QPointF &p) const
|
bool QRectF::contains(const QPointF &p) const Q_DECL_NOTHROW
|
||||||
{
|
{
|
||||||
qreal l = xp;
|
qreal l = xp;
|
||||||
qreal r = xp;
|
qreal r = xp;
|
||||||
@ -1981,7 +1981,7 @@ bool QRectF::contains(const QPointF &p) const
|
|||||||
otherwise returns \c false.
|
otherwise returns \c false.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool QRectF::contains(const QRectF &r) const
|
bool QRectF::contains(const QRectF &r) const Q_DECL_NOTHROW
|
||||||
{
|
{
|
||||||
qreal l1 = xp;
|
qreal l1 = xp;
|
||||||
qreal r1 = xp;
|
qreal r1 = xp;
|
||||||
@ -2119,7 +2119,7 @@ bool QRectF::contains(const QRectF &r) const
|
|||||||
\sa united(), operator|=()
|
\sa united(), operator|=()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
QRectF QRectF::operator|(const QRectF &r) const
|
QRectF QRectF::operator|(const QRectF &r) const Q_DECL_NOTHROW
|
||||||
{
|
{
|
||||||
if (isNull())
|
if (isNull())
|
||||||
return r;
|
return r;
|
||||||
@ -2188,7 +2188,7 @@ QRectF QRectF::operator|(const QRectF &r) const
|
|||||||
\sa operator&=(), intersected()
|
\sa operator&=(), intersected()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
QRectF QRectF::operator&(const QRectF &r) const
|
QRectF QRectF::operator&(const QRectF &r) const Q_DECL_NOTHROW
|
||||||
{
|
{
|
||||||
qreal l1 = xp;
|
qreal l1 = xp;
|
||||||
qreal r1 = xp;
|
qreal r1 = xp;
|
||||||
@ -2273,7 +2273,7 @@ QRectF QRectF::operator&(const QRectF &r) const
|
|||||||
\sa contains()
|
\sa contains()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool QRectF::intersects(const QRectF &r) const
|
bool QRectF::intersects(const QRectF &r) const Q_DECL_NOTHROW
|
||||||
{
|
{
|
||||||
qreal l1 = xp;
|
qreal l1 = xp;
|
||||||
qreal r1 = xp;
|
qreal r1 = xp;
|
||||||
@ -2340,7 +2340,7 @@ bool QRectF::intersects(const QRectF &r) const
|
|||||||
\sa toRect()
|
\sa toRect()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
QRect QRectF::toAlignedRect() const
|
QRect QRectF::toAlignedRect() const Q_DECL_NOTHROW
|
||||||
{
|
{
|
||||||
int xmin = int(qFloor(xp));
|
int xmin = int(qFloor(xp));
|
||||||
int xmax = int(qCeil(xp + w));
|
int xmax = int(qCeil(xp + w));
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user