tag/Tag: add "noexcept"
This commit is contained in:
parent
1de68b72b9
commit
eef5b58211
|
@ -40,7 +40,7 @@ Tag::Clear() noexcept
|
|||
num_items = 0;
|
||||
}
|
||||
|
||||
Tag::Tag(const Tag &other)
|
||||
Tag::Tag(const Tag &other) noexcept
|
||||
:duration(other.duration), has_playlist(other.has_playlist),
|
||||
num_items(other.num_items),
|
||||
items(nullptr)
|
||||
|
@ -64,7 +64,7 @@ Tag::Merge(const Tag &base, const Tag &add) noexcept
|
|||
}
|
||||
|
||||
std::unique_ptr<Tag>
|
||||
Tag::Merge(std::unique_ptr<Tag> base, std::unique_ptr<Tag> add)
|
||||
Tag::Merge(std::unique_ptr<Tag> base, std::unique_ptr<Tag> add) noexcept
|
||||
{
|
||||
if (add == nullptr)
|
||||
return base;
|
||||
|
|
|
@ -56,9 +56,9 @@ struct Tag {
|
|||
*/
|
||||
Tag() = default;
|
||||
|
||||
Tag(const Tag &other);
|
||||
Tag(const Tag &other) noexcept;
|
||||
|
||||
Tag(Tag &&other)
|
||||
Tag(Tag &&other) noexcept
|
||||
:duration(other.duration), has_playlist(other.has_playlist),
|
||||
num_items(other.num_items), items(other.items) {
|
||||
other.items = nullptr;
|
||||
|
@ -68,13 +68,13 @@ struct Tag {
|
|||
/**
|
||||
* Free the tag object and all its items.
|
||||
*/
|
||||
~Tag() {
|
||||
~Tag() noexcept {
|
||||
Clear();
|
||||
}
|
||||
|
||||
Tag &operator=(const Tag &other) = delete;
|
||||
|
||||
Tag &operator=(Tag &&other) {
|
||||
Tag &operator=(Tag &&other) noexcept {
|
||||
duration = other.duration;
|
||||
has_playlist = other.has_playlist;
|
||||
MoveItemsFrom(std::move(other));
|
||||
|
@ -126,7 +126,7 @@ struct Tag {
|
|||
* @return a newly allocated tag
|
||||
*/
|
||||
static std::unique_ptr<Tag> Merge(std::unique_ptr<Tag> base,
|
||||
std::unique_ptr<Tag> add);
|
||||
std::unique_ptr<Tag> add) noexcept;
|
||||
|
||||
/**
|
||||
* Returns the first value of the specified tag type, or
|
||||
|
@ -155,52 +155,52 @@ struct Tag {
|
|||
friend struct Tag;
|
||||
const TagItem *const*cursor;
|
||||
|
||||
constexpr const_iterator(const TagItem *const*_cursor)
|
||||
constexpr const_iterator(const TagItem *const*_cursor) noexcept
|
||||
:cursor(_cursor) {}
|
||||
|
||||
public:
|
||||
constexpr const TagItem &operator*() const {
|
||||
constexpr const TagItem &operator*() const noexcept {
|
||||
return **cursor;
|
||||
}
|
||||
|
||||
constexpr const TagItem *operator->() const {
|
||||
constexpr const TagItem *operator->() const noexcept {
|
||||
return *cursor;
|
||||
}
|
||||
|
||||
const_iterator &operator++() {
|
||||
const_iterator &operator++() noexcept {
|
||||
++cursor;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const_iterator operator++(int) {
|
||||
const_iterator operator++(int) noexcept {
|
||||
auto result = cursor++;
|
||||
return const_iterator{result};
|
||||
}
|
||||
|
||||
const_iterator &operator--() {
|
||||
const_iterator &operator--() noexcept {
|
||||
--cursor;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const_iterator operator--(int) {
|
||||
const_iterator operator--(int) noexcept {
|
||||
auto result = cursor--;
|
||||
return const_iterator{result};
|
||||
}
|
||||
|
||||
constexpr bool operator==(const_iterator other) const {
|
||||
constexpr bool operator==(const_iterator other) const noexcept {
|
||||
return cursor == other.cursor;
|
||||
}
|
||||
|
||||
constexpr bool operator!=(const_iterator other) const {
|
||||
constexpr bool operator!=(const_iterator other) const noexcept {
|
||||
return cursor != other.cursor;
|
||||
}
|
||||
};
|
||||
|
||||
const_iterator begin() const {
|
||||
const_iterator begin() const noexcept {
|
||||
return const_iterator{items};
|
||||
}
|
||||
|
||||
const_iterator end() const {
|
||||
const_iterator end() const noexcept {
|
||||
return const_iterator{items + num_items};
|
||||
}
|
||||
};
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include <cppunit/ui/text/TestRunner.h>
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
|
||||
Tag::Tag(const Tag &) {}
|
||||
Tag::Tag(const Tag &) noexcept {}
|
||||
void Tag::Clear() noexcept {}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in New Issue