| 1 | /* |
| 2 | * %injeqt copyright begin% |
| 3 | * Copyright 2015 Rafał Malinowski ([email protected]) |
| 4 | * %injeqt copyright end% |
| 5 | * |
| 6 | * This library is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU Lesser General Public |
| 8 | * License as published by the Free Software Foundation; either |
| 9 | * version 2.1 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This library is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * Lesser General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Lesser General Public |
| 17 | * License along with this library; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | */ |
| 20 | |
| 21 | #include "provider-by-parent-injector-configuration.h" |
| 22 | |
| 23 | #include "provider-by-parent-injector.h" |
| 24 | |
| 25 | #include <cassert> |
| 26 | |
| 27 | namespace injeqt { namespace internal { |
| 28 | |
| 29 | provider_by_parent_injector_configuration::provider_by_parent_injector_configuration(injector_impl *parent_injector, type object_type) : |
| 30 | _parent_injector{parent_injector}, |
| 31 | _object_type{std::move(object_type)} |
| 32 | { |
| 33 | assert(_parent_injector); |
| 34 | assert(!_object_type.is_empty()); |
| 35 | } |
| 36 | |
| 37 | provider_by_parent_injector_configuration::~provider_by_parent_injector_configuration() |
| 38 | { |
| 39 | } |
| 40 | |
| 41 | std::vector<type> provider_by_parent_injector_configuration::types() const |
| 42 | { |
| 43 | return {_object_type}; |
| 44 | } |
| 45 | |
| 46 | std::unique_ptr<provider> provider_by_parent_injector_configuration::create_provider(const types_by_name &) const |
| 47 | { |
| 48 | return std::unique_ptr<provider>{new provider_by_parent_injector{_parent_injector, _object_type}}; |
| 49 | } |
| 50 | |
| 51 | }} |