From a5574f9189f67e673463cde3d4aa629e638cf298 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 3 Dec 2013 12:08:54 +0100 Subject: TagBuilder: implement the assignment operator --- src/tag/TagBuilder.cxx | 17 +++++++++++++++++ src/tag/TagBuilder.hxx | 3 ++- 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'src/tag') diff --git a/src/tag/TagBuilder.cxx b/src/tag/TagBuilder.cxx index 6ba8c12db..b114e882b 100644 --- a/src/tag/TagBuilder.cxx +++ b/src/tag/TagBuilder.cxx @@ -54,6 +54,23 @@ TagBuilder::TagBuilder(Tag &&other) other.items = nullptr; } +TagBuilder & +TagBuilder::operator=(const TagBuilder &other) +{ + /* copy all attributes */ + time = other.time; + has_playlist = other.has_playlist; + items = other.items; + + /* increment the tag pool refcounters */ + tag_pool_lock.lock(); + for (auto i : items) + tag_pool_dup_item(i); + tag_pool_lock.unlock(); + + return *this; +} + void TagBuilder::Clear() { diff --git a/src/tag/TagBuilder.hxx b/src/tag/TagBuilder.hxx index 52ccf466c..f21b818bb 100644 --- a/src/tag/TagBuilder.hxx +++ b/src/tag/TagBuilder.hxx @@ -63,11 +63,12 @@ public: } TagBuilder(const TagBuilder &other) = delete; - TagBuilder &operator=(const TagBuilder &other) = delete; TagBuilder(const Tag &other); TagBuilder(Tag &&other); + TagBuilder &operator=(const TagBuilder &other); + /** * Returns true if the tag contains no items. This ignores the "time" * attribute. -- cgit v1.2.3