From 40d02748924aa7c48b04cf948204d8dacdfbbc74 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sat, 30 Apr 2022 16:28:13 +0200 Subject: refactor: replace DI files with the yacppdic library --- src/DI/container.hpp | 60 ---------------------------------------------------- 1 file changed, 60 deletions(-) delete mode 100644 src/DI/container.hpp (limited to 'src/DI/container.hpp') diff --git a/src/DI/container.hpp b/src/DI/container.hpp deleted file mode 100644 index d5f52b8..0000000 --- a/src/DI/container.hpp +++ /dev/null @@ -1,60 +0,0 @@ -#pragma once - -#include "DI/interfaces/wrapper.hpp" - -#include "DI/concepts.hpp" -#include "DI/factory.hpp" -#include "DI/object_type.hpp" - -#include -#include -#include -#include - -class Container; - -template -class BindingBuilder -{ -public: - explicit BindingBuilder(Container *container) noexcept; - - template - requires Abstract && std::derived_from - void to() noexcept; - - template - requires IsFactory && std::constructible_from - void to_factory(FactoryFunc factory) noexcept; - -private: - Container *_container; -}; - -class Container -{ -public: - Container() noexcept = default; - - template - using WrapperPtr = std::shared_ptr; - - template - auto bind() noexcept -> BindingBuilder; - - template - requires Abstract - auto get() const noexcept -> std::unique_ptr; - - template - requires IsFactory - auto get() const noexcept -> AFactory; - - void add(BaseObjectType type, const WrapperPtr &wrapper) noexcept; - -private: - std::unordered_map, ObjectTypeHasher> - _bindings; -}; - -#include "container.tpp" -- cgit v1.2.3-18-g5258