From c723e56952f40d9ee38e7080e930bb2c6fd345a1 Mon Sep 17 00:00:00 2001 From: ed Date: Wed, 28 Nov 2018 17:01:45 +0000 Subject: [PATCH] Defaulted some constructors and copy assignment operators in AttributedString --- .../fonts/juce_AttributedString.cpp | 40 ------------------- .../fonts/juce_AttributedString.h | 16 +++++--- 2 files changed, 10 insertions(+), 46 deletions(-) diff --git a/modules/juce_graphics/fonts/juce_AttributedString.cpp b/modules/juce_graphics/fonts/juce_AttributedString.cpp index 8efaeb5b9a..ff36fd151f 100644 --- a/modules/juce_graphics/fonts/juce_AttributedString.cpp +++ b/modules/juce_graphics/fonts/juce_AttributedString.cpp @@ -150,52 +150,12 @@ AttributedString::Attribute& AttributedString::Attribute::operator= (Attribute&& return *this; } -AttributedString::Attribute::Attribute (const Attribute& other) noexcept - : range (other.range), - font (other.font), - colour (other.colour) -{ -} - -AttributedString::Attribute& AttributedString::Attribute::operator= (const Attribute& other) noexcept -{ - range = other.range; - font = other.font; - colour = other.colour; - return *this; -} - AttributedString::Attribute::Attribute (Range r, const Font& f, Colour c) noexcept : range (r), font (f), colour (c) { } //============================================================================== -AttributedString::AttributedString (const AttributedString& other) - : text (other.text), - lineSpacing (other.lineSpacing), - justification (other.justification), - wordWrap (other.wordWrap), - readingDirection (other.readingDirection), - attributes (other.attributes) -{ -} - -AttributedString& AttributedString::operator= (const AttributedString& other) -{ - if (this != &other) - { - text = other.text; - lineSpacing = other.lineSpacing; - justification = other.justification; - wordWrap = other.wordWrap; - readingDirection = other.readingDirection; - attributes = other.attributes; - } - - return *this; -} - AttributedString::AttributedString (AttributedString&& other) noexcept : text (std::move (other.text)), lineSpacing (other.lineSpacing), diff --git a/modules/juce_graphics/fonts/juce_AttributedString.h b/modules/juce_graphics/fonts/juce_AttributedString.h index ac19211fa3..b283b605d4 100644 --- a/modules/juce_graphics/fonts/juce_AttributedString.h +++ b/modules/juce_graphics/fonts/juce_AttributedString.h @@ -43,13 +43,15 @@ class JUCE_API AttributedString { public: /** Creates an empty attributed string. */ - AttributedString() {} + AttributedString() = default; /** Creates an attributed string with the given text. */ explicit AttributedString (const String& newString) { setText (newString); } - AttributedString (const AttributedString&); - AttributedString& operator= (const AttributedString&); + AttributedString (const AttributedString&) = default; + AttributedString& operator= (const AttributedString&) = default; + + // VS2013 can't default move constructors and assignments AttributedString (AttributedString&&) noexcept; AttributedString& operator= (AttributedString&&) noexcept; @@ -148,10 +150,12 @@ public: class JUCE_API Attribute { public: - Attribute() noexcept {} + Attribute() = default; + + Attribute (const Attribute&) = default; + Attribute& operator= (const Attribute&) = default; - Attribute (const Attribute&) noexcept; - Attribute& operator= (const Attribute&) noexcept; + // VS2013 can't default move constructors and assignments Attribute (Attribute&&) noexcept; Attribute& operator= (Attribute&&) noexcept;