diff options
author | HampusM <hampus@hampusmat.com> | 2022-06-22 19:27:12 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-06-22 19:27:12 +0200 |
commit | 2a0bb102db0a2b29fc2140aa73af2f5d48b50de5 (patch) | |
tree | baa186a42aaea9c95fb84fe9cd026138e9334377 | |
parent | 8f47628ede9775510c00c20f8e4690dff2b3fe6e (diff) |
refactor: use the new yacppdic DI container name
-rw-r--r-- | src/bootstrap.cpp | 46 | ||||
-rw-r--r-- | src/bootstrap.hpp | 2 |
2 files changed, 24 insertions, 24 deletions
diff --git a/src/bootstrap.cpp b/src/bootstrap.cpp index 16d38a3..0b9d972 100644 --- a/src/bootstrap.cpp +++ b/src/bootstrap.cpp @@ -33,34 +33,34 @@ #include <memory> -auto bootstrap() noexcept -> yacppdic::Container +auto bootstrap() noexcept -> yacppdic::DIContainer { - auto container = yacppdic::Container(); + auto di_container = yacppdic::DIContainer(); - container.bind<IUserInputObserver>().to<UserInputObserver>(); - container.bind<ICursorController>().to<CursorController>(); - container.bind<ICLIGameEngine>().to<CLIGameEngine>(); - container.bind<IStatusManager>().to<StatusManager>(); - container.bind<IScene>().to<Scene>(); - container.bind<IRLEReader>().to<RLEReader>(); + di_container.bind<IUserInputObserver>().to<UserInputObserver>(); + di_container.bind<ICursorController>().to<CursorController>(); + di_container.bind<ICLIGameEngine>().to<CLIGameEngine>(); + di_container.bind<IStatusManager>().to<StatusManager>(); + di_container.bind<IScene>().to<Scene>(); + di_container.bind<IRLEReader>().to<RLEReader>(); - container.bind<IGameFactory>().to_factory( - [&container]( + di_container.bind<IGameFactory>().to_factory( + [&di_container]( const std::shared_ptr<IScene> &scene, const std::shared_ptr<ICursorController> &cursor_controller, const std::shared_ptr<IUserInputObserver> &user_input_observer) { - const auto statusline_factory = container.get<IStatusLineFactory>(); + const auto statusline_factory = di_container.get<IStatusLineFactory>(); std::shared_ptr<IStatusManager> status_manager = - container.get<IStatusManager>(); + di_container.get<IStatusManager>(); std::shared_ptr<IGenerationTracker> generation_tracker = - container.get<IGenerationTrackerFactory>()(true); + di_container.get<IGenerationTrackerFactory>()(true); - const auto cell_helper_factory = container.get<ICellHelperFactory<char>>(); + const auto cell_helper_factory = di_container.get<ICellHelperFactory<char>>(); - std::shared_ptr<IRLEReader> rle_reader = container.get<IRLEReader>(); + std::shared_ptr<IRLEReader> rle_reader = di_container.get<IRLEReader>(); return std::make_unique<Game>( statusline_factory, @@ -73,38 +73,38 @@ auto bootstrap() noexcept -> yacppdic::Container rle_reader); }); - container.bind<IMatrixFactory<char>>().to_factory( + di_container.bind<IMatrixFactory<char>>().to_factory( [](const Bounds &bounds) { return std::make_unique<Matrix<char>>(bounds); }); - container.bind<IStatusLineFactory>().to_factory( - [&container](const Bounds &size) + di_container.bind<IStatusLineFactory>().to_factory( + [&di_container](const Bounds &size) { const auto matrix_factory = - container.get<IMatrixFactory<IComponent::ComponentMatrix::Element>>(); + di_container.get<IMatrixFactory<IComponent::ComponentMatrix::Element>>(); return std::make_unique<StatusLine>(matrix_factory(size)); }); - container.bind<IGenerationTrackerFactory>().to_factory( + di_container.bind<IGenerationTrackerFactory>().to_factory( [](bool is_paused) { return std::make_unique<GenerationTracker>(is_paused); }); - container.bind<ICellHelperFactory<char>>().to_factory( + di_container.bind<ICellHelperFactory<char>>().to_factory( [](const IMatrix<char> &matrix) { return std::make_unique<CellHelper<char>>(matrix); }); - container.bind<IComponentRendererFactory>().to_factory( + di_container.bind<IComponentRendererFactory>().to_factory( [](const std::shared_ptr<ICursorController> &cursor_controller) { return std::make_unique<ComponentRenderer>(cursor_controller); }); - return container; + return di_container; } diff --git a/src/bootstrap.hpp b/src/bootstrap.hpp index 3fd3288..bbe4264 100644 --- a/src/bootstrap.hpp +++ b/src/bootstrap.hpp @@ -2,4 +2,4 @@ #include <yacppdic/container.hpp> -auto bootstrap() noexcept -> yacppdic::Container; +auto bootstrap() noexcept -> yacppdic::DIContainer; |