diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/tag_compound.cpp | 2 | ||||
| -rw-r--r-- | src/value.cpp | 24 |
2 files changed, 20 insertions, 6 deletions
diff --git a/src/tag_compound.cpp b/src/tag_compound.cpp index 6bc83301e2..94dc2dd6f1 100644 --- a/src/tag_compound.cpp +++ b/src/tag_compound.cpp @@ -42,7 +42,7 @@ bool tag_compound::put(const std::string& key, std::unique_ptr<tag>&& t) auto it = tags.find(key); if(it != tags.end()) { - it->second = std::move(t); + it->second.set_ptr(std::move(t)); return false; } else diff --git a/src/value.cpp b/src/value.cpp index a5f8e3c894..f062e08a09 100644 --- a/src/value.cpp +++ b/src/value.cpp @@ -28,16 +28,30 @@ value::value(std::unique_ptr<tag>&& t): tag_(std::move(t)) {} -value& value::operator=(std::unique_ptr<tag>&& t) +value& value::operator=(tag&& t) { - tag_ = std::move(t); + tag_->assign(std::move(t)); return *this; } -value& value::operator=(tag&& t) +value::operator bool() const { - tag_->assign(std::move(t)); - return *this; + return tag_ != nullptr; +} + +std::unique_ptr<tag>& value::get_ptr() +{ + return tag_; +} + +const std::unique_ptr<tag>& value::get_ptr() const +{ + return tag_; +} + +void value::set_ptr(std::unique_ptr<tag>&& t) +{ + tag_ = std::move(t); } tag_type value::get_type() const |
