diff options
author | Max Kellermann <max@musicpd.org> | 2018-01-20 19:41:25 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-01-20 19:53:38 +0100 |
commit | f686e838fefde54adff6a93a754321eaeee4e94e (patch) | |
tree | cdaf5ed7c7decb49d1de211e09869e4d0820c458 /src/tag | |
parent | ea8642dec9b271c0acca2ff3f54a8c6359d1a10a (diff) |
tag/Builder: add "noexcept"
Diffstat (limited to 'src/tag')
-rw-r--r-- | src/tag/Builder.cxx | 28 | ||||
-rw-r--r-- | src/tag/Builder.hxx | 36 |
2 files changed, 32 insertions, 32 deletions
diff --git a/src/tag/Builder.cxx b/src/tag/Builder.cxx index d1e4c75bf..322a7645e 100644 --- a/src/tag/Builder.cxx +++ b/src/tag/Builder.cxx @@ -31,7 +31,7 @@ #include <assert.h> #include <stdlib.h> -TagBuilder::TagBuilder(const Tag &other) +TagBuilder::TagBuilder(const Tag &other) noexcept :duration(other.duration), has_playlist(other.has_playlist) { items.reserve(other.num_items); @@ -42,7 +42,7 @@ TagBuilder::TagBuilder(const Tag &other) tag_pool_lock.unlock(); } -TagBuilder::TagBuilder(Tag &&other) +TagBuilder::TagBuilder(Tag &&other) noexcept :duration(other.duration), has_playlist(other.has_playlist) { /* move all TagItem pointers from the Tag object; we don't @@ -58,7 +58,7 @@ TagBuilder::TagBuilder(Tag &&other) } TagBuilder & -TagBuilder::operator=(const TagBuilder &other) +TagBuilder::operator=(const TagBuilder &other) noexcept { /* copy all attributes */ duration = other.duration; @@ -75,7 +75,7 @@ TagBuilder::operator=(const TagBuilder &other) } TagBuilder & -TagBuilder::operator=(TagBuilder &&other) +TagBuilder::operator=(TagBuilder &&other) noexcept { duration = other.duration; has_playlist = other.has_playlist; @@ -85,7 +85,7 @@ TagBuilder::operator=(TagBuilder &&other) } TagBuilder & -TagBuilder::operator=(Tag &&other) +TagBuilder::operator=(Tag &&other) noexcept { duration = other.duration; has_playlist = other.has_playlist; @@ -106,7 +106,7 @@ TagBuilder::operator=(Tag &&other) } void -TagBuilder::Clear() +TagBuilder::Clear() noexcept { duration = SignedSongTime::Negative(); has_playlist = false; @@ -114,7 +114,7 @@ TagBuilder::Clear() } void -TagBuilder::Commit(Tag &tag) +TagBuilder::Commit(Tag &tag) noexcept { tag.Clear(); @@ -137,7 +137,7 @@ TagBuilder::Commit(Tag &tag) } Tag -TagBuilder::Commit() +TagBuilder::Commit() noexcept { Tag tag; Commit(tag); @@ -145,7 +145,7 @@ TagBuilder::Commit() } std::unique_ptr<Tag> -TagBuilder::CommitNew() +TagBuilder::CommitNew() noexcept { std::unique_ptr<Tag> tag(new Tag()); Commit(*tag); @@ -163,7 +163,7 @@ TagBuilder::HasType(TagType type) const noexcept } void -TagBuilder::Complement(const Tag &other) +TagBuilder::Complement(const Tag &other) noexcept { if (duration.IsNegative()) duration = other.duration; @@ -189,7 +189,7 @@ TagBuilder::Complement(const Tag &other) } inline void -TagBuilder::AddItemInternal(TagType type, StringView value) +TagBuilder::AddItemInternal(TagType type, StringView value) noexcept { assert(!value.empty()); @@ -207,7 +207,7 @@ TagBuilder::AddItemInternal(TagType type, StringView value) } void -TagBuilder::AddItem(TagType type, StringView value) +TagBuilder::AddItem(TagType type, StringView value) noexcept { if (value.empty() || !IsTagEnabled(type)) return; @@ -216,7 +216,7 @@ TagBuilder::AddItem(TagType type, StringView value) } void -TagBuilder::AddItem(TagType type, const char *value) +TagBuilder::AddItem(TagType type, const char *value) noexcept { #if !CLANG_CHECK_VERSION(3,6) /* disabled on clang due to -Wtautological-pointer-compare */ @@ -227,7 +227,7 @@ TagBuilder::AddItem(TagType type, const char *value) } void -TagBuilder::AddEmptyItem(TagType type) +TagBuilder::AddEmptyItem(TagType type) noexcept { tag_pool_lock.lock(); auto i = tag_pool_get_item(type, ""); diff --git a/src/tag/Builder.hxx b/src/tag/Builder.hxx index ef8e56cc6..f0d37990b 100644 --- a/src/tag/Builder.hxx +++ b/src/tag/Builder.hxx @@ -56,19 +56,19 @@ public: */ TagBuilder() = default; - ~TagBuilder() { + ~TagBuilder() noexcept { Clear(); } TagBuilder(const TagBuilder &other) = delete; - explicit TagBuilder(const Tag &other); - explicit TagBuilder(Tag &&other); + explicit TagBuilder(const Tag &other) noexcept; + explicit TagBuilder(Tag &&other) noexcept; - TagBuilder &operator=(const TagBuilder &other); - TagBuilder &operator=(TagBuilder &&other); + TagBuilder &operator=(const TagBuilder &other) noexcept; + TagBuilder &operator=(TagBuilder &&other) noexcept; - TagBuilder &operator=(Tag &&other); + TagBuilder &operator=(Tag &&other) noexcept; /** * Returns true if the tag contains no items. This ignores @@ -86,36 +86,36 @@ public: return !duration.IsNegative() || has_playlist || !empty(); } - void Clear(); + void Clear() noexcept; /** * Move this object to the given #Tag instance. This object * is empty afterwards. */ - void Commit(Tag &tag); + void Commit(Tag &tag) noexcept; /** * Create a new #Tag instance from data in this object. This * object is empty afterwards. */ - Tag Commit(); + Tag Commit() noexcept; /** * Create a new #Tag instance from data in this object. The * returned object is owned by the caller. This object is * empty afterwards. */ - std::unique_ptr<Tag> CommitNew(); + std::unique_ptr<Tag> CommitNew() noexcept; - void SetDuration(SignedSongTime _duration) { + void SetDuration(SignedSongTime _duration) noexcept { duration = _duration; } - void SetHasPlaylist(bool _has_playlist) { + void SetHasPlaylist(bool _has_playlist) noexcept { has_playlist = _has_playlist; } - void Reserve(unsigned n) { + void Reserve(unsigned n) noexcept { items.reserve(n); } @@ -130,7 +130,7 @@ public: * Copy attributes and items from the other object that do not * exist in this object. */ - void Complement(const Tag &other); + void Complement(const Tag &other) noexcept; /** * Appends a new tag item. @@ -140,7 +140,7 @@ public: * @param length the length of #value */ gcc_nonnull_all - void AddItem(TagType type, StringView value); + void AddItem(TagType type, StringView value) noexcept; /** * Appends a new tag item. @@ -149,14 +149,14 @@ public: * @param value the value of the tag item (null-terminated) */ gcc_nonnull_all - void AddItem(TagType type, const char *value); + void AddItem(TagType type, const char *value) noexcept; /** * Appends a new tag item with an empty value. Do not use * this unless you know what you're doing - because usually, * empty values are discarded. */ - void AddEmptyItem(TagType type); + void AddEmptyItem(TagType type) noexcept; /** * Removes all tag items. @@ -170,7 +170,7 @@ public: private: gcc_nonnull_all - void AddItemInternal(TagType type, StringView value); + void AddItemInternal(TagType type, StringView value) noexcept; }; #endif |