From 0dfaa98e8623fcf897b1bd794a0c690872d4812d Mon Sep 17 00:00:00 2001 From: Tom Poole Date: Fri, 15 Sep 2023 13:53:39 +0100 Subject: [PATCH] Rectangle: Add nodiscard to some methods --- .../juce_graphics/geometry/juce_Rectangle.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/juce_graphics/geometry/juce_Rectangle.h b/modules/juce_graphics/geometry/juce_Rectangle.h index 2e7bf03f2f..830aa7b851 100644 --- a/modules/juce_graphics/geometry/juce_Rectangle.h +++ b/modules/juce_graphics/geometry/juce_Rectangle.h @@ -324,8 +324,8 @@ public: } /** Returns a rectangle which is the same as this one moved by a given amount. */ - Rectangle translated (ValueType deltaX, - ValueType deltaY) const noexcept + [[nodiscard]] Rectangle translated (ValueType deltaX, + ValueType deltaY) const noexcept { return { pos.x + deltaX, pos.y + deltaY, w, h }; } @@ -448,8 +448,8 @@ public: Effectively, the rectangle returned is (x - deltaX, y - deltaY, w + deltaX * 2, h + deltaY * 2). @see expand, reduce, reduced */ - Rectangle expanded (ValueType deltaX, - ValueType deltaY) const noexcept + [[nodiscard]] Rectangle expanded (ValueType deltaX, + ValueType deltaY) const noexcept { auto nw = jmax (ValueType(), w + deltaX * 2); auto nh = jmax (ValueType(), h + deltaY * 2); @@ -461,7 +461,7 @@ public: Effectively, the rectangle returned is (x - delta, y - delta, w + delta * 2, h + delta * 2). @see expand, reduce, reduced */ - Rectangle expanded (ValueType delta) const noexcept + [[nodiscard]] Rectangle expanded (ValueType delta) const noexcept { return expanded (delta, delta); } @@ -482,8 +482,8 @@ public: Effectively, the rectangle returned is (x + deltaX, y + deltaY, w - deltaX * 2, h - deltaY * 2). @see reduce, expand, expanded */ - Rectangle reduced (ValueType deltaX, - ValueType deltaY) const noexcept + [[nodiscard]] Rectangle reduced (ValueType deltaX, + ValueType deltaY) const noexcept { return expanded (-deltaX, -deltaY); } @@ -493,7 +493,7 @@ public: Effectively, the rectangle returned is (x + delta, y + delta, w - delta * 2, h - delta * 2). @see reduce, expand, expanded */ - Rectangle reduced (ValueType delta) const noexcept + [[nodiscard]] Rectangle reduced (ValueType delta) const noexcept { return reduced (delta, delta); } @@ -815,7 +815,7 @@ public: This should only be used on floating point rectangles. */ - Rectangle transformedBy (const AffineTransform& transform) const noexcept + [[nodiscard]] Rectangle transformedBy (const AffineTransform& transform) const noexcept { using FloatType = TypeHelpers::SmallestFloatType;