default some more (#1135)

* remove defaulted constructor

It gets implicitly generated.

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* default some more

swap is not needed here as shared_ptr is copyable.

Signed-off-by: Rosen Penev <rosenp@gmail.com>

---------

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2023-09-15 23:25:04 -07:00 committed by GitHub
parent 97a74ca3d8
commit cf5ad66922
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 17 additions and 60 deletions

View File

@ -58,7 +58,7 @@ ASF::Attribute::Attribute() :
d->type = UnicodeType;
}
ASF::Attribute::Attribute(const ASF::Attribute &other) = default;
ASF::Attribute::Attribute(const ASF::Attribute &) = default;
ASF::Attribute::Attribute(const String &value) :
d(std::make_shared<AttributePrivate>())
@ -109,11 +109,7 @@ ASF::Attribute::Attribute(bool value) :
d->numericValue = value;
}
ASF::Attribute &ASF::Attribute::operator=(const ASF::Attribute &other)
{
Attribute(other).swap(*this);
return *this;
}
ASF::Attribute &ASF::Attribute::operator=(const ASF::Attribute &) = default;
void ASF::Attribute::swap(Attribute &other)
{

View File

@ -50,8 +50,7 @@ ASF::Picture::Picture() :
d->valid = true;
}
ASF::Picture::Picture(const Picture &other) = default;
ASF::Picture::Picture(const Picture &) = default;
ASF::Picture::~Picture() = default;
bool ASF::Picture::isValid() const
@ -106,11 +105,7 @@ int ASF::Picture::dataSize() const
d->picture.size();
}
ASF::Picture& ASF::Picture::operator=(const ASF::Picture& other)
{
Picture(other).swap(*this);
return *this;
}
ASF::Picture &ASF::Picture::operator=(const ASF::Picture &) = default;
void ASF::Picture::swap(Picture &other)
{

View File

@ -341,7 +341,7 @@ FileRef::FileRef(File *file) :
d->file = file;
}
FileRef::FileRef(const FileRef &ref) = default;
FileRef::FileRef(const FileRef &) = default;
FileRef::~FileRef() = default;
@ -427,11 +427,7 @@ bool FileRef::isNull() const
return (!d->file || !d->file->isValid());
}
FileRef &FileRef::operator=(const FileRef &ref)
{
FileRef(ref).swap(*this);
return *this;
}
FileRef &FileRef::operator=(const FileRef &) = default;
void FileRef::swap(FileRef &ref)
{

View File

@ -45,14 +45,8 @@ MP4::CoverArt::CoverArt(Format format, const ByteVector &data) :
d->data = data;
}
MP4::CoverArt::CoverArt(const CoverArt &item) = default;
MP4::CoverArt &
MP4::CoverArt::operator=(const CoverArt &item)
{
CoverArt(item).swap(*this);
return *this;
}
MP4::CoverArt::CoverArt(const CoverArt &) = default;
MP4::CoverArt &MP4::CoverArt::operator=(const CoverArt &) = default;
void
MP4::CoverArt::swap(CoverArt &item)

View File

@ -51,14 +51,8 @@ MP4::Item::Item() :
d->valid = false;
}
MP4::Item::Item(const Item &item) = default;
MP4::Item &
MP4::Item::operator=(const Item &item)
{
Item(item).swap(*this);
return *this;
}
MP4::Item::Item(const Item &) = default;
MP4::Item &MP4::Item::operator=(const Item &) = default;
void
MP4::Item::swap(Item &item)

View File

@ -61,8 +61,7 @@ MPEG::Header::Header(File *file, offset_t offset, bool checkLength) :
parse(file, offset, checkLength);
}
MPEG::Header::Header(const Header &h) = default;
MPEG::Header::Header(const Header &) = default;
MPEG::Header::~Header() = default;
bool MPEG::Header::isValid() const

View File

@ -59,7 +59,7 @@ FileName::FileName(const char *name) :
{
}
FileName::FileName(const FileName &name) = default;
FileName::FileName(const FileName &) = default;
FileName::operator const wchar_t *() const
{

View File

@ -94,9 +94,7 @@ List<T>::List() :
}
template <class T>
List<T>::List(const List<T> &l) : d(l.d)
{
}
List<T>::List(const List<T> &) = default;
template <class T>
List<T>::~List() = default;

View File

@ -51,9 +51,7 @@ Map<Key, T>::Map() :
}
template <class Key, class T>
Map<Key, T>::Map(const Map<Key, T> &m) : d(m.d)
{
}
Map<Key, T>::Map(const Map<Key, T> &) = default;
template <class Key, class T>
Map<Key, T>::~Map() = default;
@ -180,14 +178,7 @@ T &Map<Key, T>::operator[](const Key &key)
}
template <class Key, class T>
Map<Key, T> &Map<Key, T>::operator=(const Map<Key, T> &m)
{
if (this == &m)
return *this;
Map<Key, T>(m).swap(*this);
return *this;
}
Map<Key, T> &Map<Key, T>::operator=(const Map<Key, T> &) = default;
template <class Key, class T>
void Map<Key, T>::swap(Map<Key, T> &m)

View File

@ -158,7 +158,7 @@ String::String() :
{
}
String::String(const String &s) = default;
String::String(const String &) = default;
String::String(const std::string &s, Type t) :
d(std::make_shared<StringPrivate>())
@ -611,11 +611,7 @@ String &String::operator+=(char c)
return *this;
}
String &String::operator=(const String &s)
{
String(s).swap(*this);
return *this;
}
String &String::operator=(const String &) = default;
String &String::operator=(const std::string &s)
{

View File

@ -225,8 +225,6 @@ public:
class StructReader : public Reader
{
public:
StructReader() = default;
/*!
* Add a nested reader. This reader takes ownership.
*/