diff options
| author | HampusM <hampus@hampusmat.com> | 2022-06-14 18:31:39 +0200 | 
|---|---|---|
| committer | HampusM <hampus@hampusmat.com> | 2022-06-14 18:31:39 +0200 | 
| commit | 845ff3d141553d24d4572738101fce948bf40e67 (patch) | |
| tree | fff2a606ba04bc4526e69df0b7b1e3d28fdf63b3 /include | |
| parent | 9d50e72892f84c602df3c328259cdfdd325bca12 (diff) | |
refactor!: rename Container to DIContainer
Diffstat (limited to 'include')
| -rw-r--r-- | include/yacppdic/auto_wirable.hpp | 6 | ||||
| -rw-r--r-- | include/yacppdic/container.hpp | 15 | ||||
| -rw-r--r-- | include/yacppdic/detail/auto_wirable-impl.hpp | 6 | ||||
| -rw-r--r-- | include/yacppdic/detail/container-impl.hpp | 12 | ||||
| -rw-r--r-- | include/yacppdic/detail/internal/wrapper/object_wrapper.hpp | 6 | 
5 files changed, 25 insertions, 20 deletions
| 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 <typename Interface, typename ObjectImpl, typename... Dependencies>  class AutoWirable  {  public: -	static auto resolve(const Container &container) noexcept +	static auto resolve(const DIContainer &container) noexcept  		-> std::unique_ptr<Interface>;  private:  	template <typename Dependency>  	requires IsTagged<Dependency> -	static auto _get_dependency(const Container &container) noexcept; +	static auto _get_dependency(const DIContainer &container) noexcept;  	template <typename Dependency> -	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<ObjectIdentifier, WrapperPtr<IGenericWrapper  } // namespace internal -class Container; +class DIContainer;  template <typename Interface>  class BindingBuilder; @@ -63,18 +63,21 @@ public:  	auto to_factory(FactoryFunc factory) noexcept -> BindingWhen<Interface>;  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 <class Interface>  	auto bind() noexcept -> BindingBuilder<Interface>; 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 <typename Interface, typename ObjectImpl, typename... Dependencies>  auto AutoWirable<Interface, ObjectImpl, Dependencies...>::resolve( -	const Container &container +	const DIContainer &container  ) noexcept -> std::unique_ptr<Interface>  {  	return std::make_unique<ObjectImpl>(_get_dependency<Dependencies>(container)...); @@ -17,7 +17,7 @@ template <typename Interface, typename ObjectImpl, typename... Dependencies>  template <typename Dependency>  requires IsTagged<Dependency>  auto AutoWirable<Interface, ObjectImpl, Dependencies...>::_get_dependency( -	const Container &container +	const DIContainer &container  ) noexcept  {  	return container.get_tagged<typename Dependency::Target, Dependency::get_tag()>(); @@ -26,7 +26,7 @@ auto AutoWirable<Interface, ObjectImpl, Dependencies...>::_get_dependency(  template <typename Interface, typename ObjectImpl, typename... Dependencies>  template <typename Dependency>  auto AutoWirable<Interface, ObjectImpl, Dependencies...>::_get_dependency( -	const Container &container +	const DIContainer &container  ) noexcept  {  	return container.get<Dependency>(); 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<Interface>::when_tagged() noexcept  template <typename Interface>  BindingBuilder<Interface>::BindingBuilder( -	Container &container, +	DIContainer &container,  	internal::Bindings &bindings  ) noexcept  	: _container(container), _bindings(bindings) @@ -75,14 +75,14 @@ auto BindingBuilder<Interface>::to_factory(FactoryFunc factory) noexcept  }  template <typename Interface> -auto Container::bind() noexcept -> BindingBuilder<Interface> +auto DIContainer::bind() noexcept -> BindingBuilder<Interface>  {  	return BindingBuilder<Interface>(*this, _bindings);  }  template <typename Interface>  requires Abstract<Interface> -auto Container::get() const noexcept -> std::unique_ptr<Interface> +auto DIContainer::get() const noexcept -> std::unique_ptr<Interface>  {  	auto object_identifier = internal::ObjectIdentifier::create<Interface>(); @@ -103,7 +103,7 @@ auto Container::get() const noexcept -> std::unique_ptr<Interface>  template <typename AFactory>  requires IsFactory<AFactory> -auto Container::get() const noexcept -> AFactory +auto DIContainer::get() const noexcept -> AFactory  {  	auto object_identifier = internal::ObjectIdentifier::create<AFactory>(); @@ -123,7 +123,7 @@ auto Container::get() const noexcept -> AFactory  template <class Interface, Tag tag>  requires Abstract<Interface> -auto Container::get_tagged() const noexcept -> std::unique_ptr<Interface> +auto DIContainer::get_tagged() const noexcept -> std::unique_ptr<Interface>  {  	auto object_identifier = internal::ObjectIdentifier::create<Interface, tag>(); @@ -145,7 +145,7 @@ auto Container::get_tagged() const noexcept -> std::unique_ptr<Interface>  template <typename AFactory, Tag tag>  requires IsFactory<AFactory> -auto Container::get_tagged() const noexcept -> AFactory +auto DIContainer::get_tagged() const noexcept -> AFactory  {  	auto object_identifier = internal::ObjectIdentifier::create<AFactory, tag>(); 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 Interface, class ObjectImpl>  class ObjectWrapper : public IWrapper<std::unique_ptr<Interface>>  {  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<Interface> override;  private: -	const Container &_container; +	const DIContainer &_container;  };  } // namespace yacppdic::internal | 
