From 845ff3d141553d24d4572738101fce948bf40e67 Mon Sep 17 00:00:00 2001 From: HampusM Date: Tue, 14 Jun 2022 18:31:39 +0200 Subject: refactor!: rename Container to DIContainer --- include/yacppdic/auto_wirable.hpp | 6 +++--- include/yacppdic/container.hpp | 15 +++++++++------ include/yacppdic/detail/auto_wirable-impl.hpp | 6 +++--- include/yacppdic/detail/container-impl.hpp | 12 ++++++------ .../yacppdic/detail/internal/wrapper/object_wrapper.hpp | 6 ++++-- 5 files changed, 25 insertions(+), 20 deletions(-) (limited to 'include') diff --git a/include/yacppdic/auto_wirable.hpp b/include/yacppdic/auto_wirable.hpp index ecd240b..288068a 100644 --- a/include/yacppdic/auto_wirable.hpp +++ b/include/yacppdic/auto_wirable.hpp @@ -12,16 +12,16 @@ template class AutoWirable { public: - static auto resolve(const Container &container) noexcept + static auto resolve(const DIContainer &container) noexcept -> std::unique_ptr; private: template requires IsTagged - static auto _get_dependency(const Container &container) noexcept; + static auto _get_dependency(const DIContainer &container) noexcept; template - static auto _get_dependency(const Container &container) noexcept; + static auto _get_dependency(const DIContainer &container) noexcept; }; } // namespace yacppdic diff --git a/include/yacppdic/container.hpp b/include/yacppdic/container.hpp index 6191fed..9e5237c 100644 --- a/include/yacppdic/container.hpp +++ b/include/yacppdic/container.hpp @@ -26,7 +26,7 @@ using Bindings = std::unordered_map class BindingBuilder; @@ -63,18 +63,21 @@ public: auto to_factory(FactoryFunc factory) noexcept -> BindingWhen; private: - Container &_container; + DIContainer &_container; internal::Bindings &_bindings; - explicit BindingBuilder(Container &container, internal::Bindings &bindings) noexcept; + explicit BindingBuilder( + DIContainer &container, + internal::Bindings &bindings + ) noexcept; - friend Container; + friend DIContainer; }; -class Container +class DIContainer { public: - Container() noexcept = default; + DIContainer() noexcept = default; template auto bind() noexcept -> BindingBuilder; diff --git a/include/yacppdic/detail/auto_wirable-impl.hpp b/include/yacppdic/detail/auto_wirable-impl.hpp index a6b1506..13d2cdf 100644 --- a/include/yacppdic/detail/auto_wirable-impl.hpp +++ b/include/yacppdic/detail/auto_wirable-impl.hpp @@ -7,7 +7,7 @@ namespace yacppdic template auto AutoWirable::resolve( - const Container &container + const DIContainer &container ) noexcept -> std::unique_ptr { return std::make_unique(_get_dependency(container)...); @@ -17,7 +17,7 @@ template template requires IsTagged auto AutoWirable::_get_dependency( - const Container &container + const DIContainer &container ) noexcept { return container.get_tagged(); @@ -26,7 +26,7 @@ auto AutoWirable::_get_dependency( template template auto AutoWirable::_get_dependency( - const Container &container + const DIContainer &container ) noexcept { return container.get(); diff --git a/include/yacppdic/detail/container-impl.hpp b/include/yacppdic/detail/container-impl.hpp index 5d74616..3624031 100644 --- a/include/yacppdic/detail/container-impl.hpp +++ b/include/yacppdic/detail/container-impl.hpp @@ -34,7 +34,7 @@ void BindingWhen::when_tagged() noexcept template BindingBuilder::BindingBuilder( - Container &container, + DIContainer &container, internal::Bindings &bindings ) noexcept : _container(container), _bindings(bindings) @@ -75,14 +75,14 @@ auto BindingBuilder::to_factory(FactoryFunc factory) noexcept } template -auto Container::bind() noexcept -> BindingBuilder +auto DIContainer::bind() noexcept -> BindingBuilder { return BindingBuilder(*this, _bindings); } template requires Abstract -auto Container::get() const noexcept -> std::unique_ptr +auto DIContainer::get() const noexcept -> std::unique_ptr { auto object_identifier = internal::ObjectIdentifier::create(); @@ -103,7 +103,7 @@ auto Container::get() const noexcept -> std::unique_ptr template requires IsFactory -auto Container::get() const noexcept -> AFactory +auto DIContainer::get() const noexcept -> AFactory { auto object_identifier = internal::ObjectIdentifier::create(); @@ -123,7 +123,7 @@ auto Container::get() const noexcept -> AFactory template requires Abstract -auto Container::get_tagged() const noexcept -> std::unique_ptr +auto DIContainer::get_tagged() const noexcept -> std::unique_ptr { auto object_identifier = internal::ObjectIdentifier::create(); @@ -145,7 +145,7 @@ auto Container::get_tagged() const noexcept -> std::unique_ptr template requires IsFactory -auto Container::get_tagged() const noexcept -> AFactory +auto DIContainer::get_tagged() const noexcept -> AFactory { auto object_identifier = internal::ObjectIdentifier::create(); diff --git a/include/yacppdic/detail/internal/wrapper/object_wrapper.hpp b/include/yacppdic/detail/internal/wrapper/object_wrapper.hpp index f3c5e87..19bcf1a 100644 --- a/include/yacppdic/detail/internal/wrapper/object_wrapper.hpp +++ b/include/yacppdic/detail/internal/wrapper/object_wrapper.hpp @@ -13,12 +13,14 @@ template class ObjectWrapper : public IWrapper> { public: - explicit ObjectWrapper(const Container &container) noexcept : _container(container) {} + explicit ObjectWrapper(const DIContainer &container) noexcept : _container(container) + { + } [[nodiscard]] auto get() const noexcept -> std::unique_ptr override; private: - const Container &_container; + const DIContainer &_container; }; } // namespace yacppdic::internal -- cgit v1.2.3-18-g5258