tag/Tag: Merge() returns Tag, MergePtr() returns std::unique_ptr<Tag>
This commit is contained in:
@@ -53,8 +53,16 @@ Tag::Tag(const Tag &other) noexcept
|
||||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<Tag>
|
||||
Tag
|
||||
Tag::Merge(const Tag &base, const Tag &add) noexcept
|
||||
{
|
||||
TagBuilder builder(add);
|
||||
builder.Complement(base);
|
||||
return builder.Commit();
|
||||
}
|
||||
|
||||
std::unique_ptr<Tag>
|
||||
Tag::MergePtr(const Tag &base, const Tag &add) noexcept
|
||||
{
|
||||
TagBuilder builder(add);
|
||||
builder.Complement(base);
|
||||
@@ -70,7 +78,7 @@ Tag::Merge(std::unique_ptr<Tag> base, std::unique_ptr<Tag> add) noexcept
|
||||
if (base == nullptr)
|
||||
return add;
|
||||
|
||||
return Merge(*base, *add);
|
||||
return MergePtr(*base, *add);
|
||||
}
|
||||
|
||||
const char *
|
||||
|
||||
@@ -117,8 +117,11 @@ struct Tag {
|
||||
*
|
||||
* @return a newly allocated tag
|
||||
*/
|
||||
static std::unique_ptr<Tag> Merge(const Tag &base,
|
||||
const Tag &add) noexcept;
|
||||
static Tag Merge(const Tag &base,
|
||||
const Tag &add) noexcept;
|
||||
|
||||
static std::unique_ptr<Tag> MergePtr(const Tag &base,
|
||||
const Tag &add) noexcept;
|
||||
|
||||
/**
|
||||
* Merges the data from two tags. Any of the two may be nullptr. Both
|
||||
|
||||
Reference in New Issue
Block a user