From 59d8202868364b6efeb92dbd694d961723b74cc0 Mon Sep 17 00:00:00 2001 From: HampusM Date: Thu, 9 Jun 2022 17:46:24 +0200 Subject: refactor: replace BaseObjectType with static ObjectType method --- src/object_type.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/object_type.cpp') diff --git a/src/object_type.cpp b/src/object_type.cpp index bd61e09..15b798c 100644 --- a/src/object_type.cpp +++ b/src/object_type.cpp @@ -7,12 +7,11 @@ namespace yacppdic { -BaseObjectType::BaseObjectType(const std::type_info &type_info) noexcept - : _type_info(type_info) +ObjectType::ObjectType(const std::type_info &type_info) noexcept : _type_info(type_info) { } -BaseObjectType::BaseObjectType( +ObjectType::ObjectType( const std::type_info &type_info, const std::string_view tag ) noexcept @@ -20,12 +19,12 @@ BaseObjectType::BaseObjectType( { } -auto BaseObjectType::operator==(const BaseObjectType &object_type) const noexcept -> bool +auto ObjectType::operator==(const ObjectType &object_type) const noexcept -> bool { return hash() == object_type.hash(); } -auto BaseObjectType::hash() const noexcept -> std::size_t +auto ObjectType::hash() const noexcept -> std::size_t { const auto type_hash = _type_info.hash_code(); @@ -33,17 +32,17 @@ auto BaseObjectType::hash() const noexcept -> std::size_t : combine_hashes(type_hash, std::hash()(_tag)); } -auto BaseObjectType::name() const noexcept -> std::string_view +auto ObjectType::name() const noexcept -> std::string_view { return { _type_info.name() }; } -auto BaseObjectType::tag() const noexcept -> std::string_view +auto ObjectType::tag() const noexcept -> std::string_view { return _tag; } -auto ObjectTypeHasher::operator()(const BaseObjectType &object_type) const noexcept +auto ObjectTypeHasher::operator()(const ObjectType &object_type) const noexcept -> std::size_t { return object_type.hash(); -- cgit v1.2.3-18-g5258