Browse Source

Defaulted some constructors and copy assignment operators in AttributedString

tags/2021-05-28
ed 6 years ago
parent
commit
c723e56952
2 changed files with 10 additions and 46 deletions
  1. +0
    -40
      modules/juce_graphics/fonts/juce_AttributedString.cpp
  2. +10
    -6
      modules/juce_graphics/fonts/juce_AttributedString.h

+ 0
- 40
modules/juce_graphics/fonts/juce_AttributedString.cpp View File

@@ -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<int> 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),


+ 10
- 6
modules/juce_graphics/fonts/juce_AttributedString.h View File

@@ -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;


Loading…
Cancel
Save