From b6d496b1e83853cd272a8ffdea273c59bbf4b87c Mon Sep 17 00:00:00 2001 From: YongDo-Hyun Date: Sat, 27 Dec 2025 13:05:30 +0300 Subject: feat: add numeric tag creation methods and corresponding tests for value assignments Signed-off-by: YongDo-Hyun --- src/value.cpp | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'src/value.cpp') diff --git a/src/value.cpp b/src/value.cpp index f07e28d82c..bf0ffcad78 100644 --- a/src/value.cpp +++ b/src/value.cpp @@ -66,21 +66,6 @@ void value::set(tag&& t) //Primitive assignment namespace // helper functions local to this translation unit { - template - std::unique_ptr make_numeric_tag(tag_type type, T val) - { - switch(type) - { - case tag_type::Byte: return std::unique_ptr(new tag_byte(val)); - case tag_type::Short: return std::unique_ptr(new tag_short(val)); - case tag_type::Int: return std::unique_ptr(new tag_int(val)); - case tag_type::Long: return std::unique_ptr(new tag_long(val)); - case tag_type::Float: return std::unique_ptr(new tag_float(val)); - case tag_type::Double: return std::unique_ptr(new tag_double(val)); - default: return nullptr; - } - } - template void assign_numeric_impl(std::unique_ptr& tag_ptr, T val, tag_type default_type) @@ -88,9 +73,7 @@ namespace // helper functions local to this translation unit using nbt::tag_type; if(!tag_ptr) { - tag_ptr = make_numeric_tag(default_type, val); - if(!tag_ptr) - throw std::invalid_argument("Invalid default_type"); + tag_ptr = tag::create(default_type, val); return; } -- cgit 0.0.5-2-1-g0f52