| 1 | /* |
| 2 | * %injeqt copyright begin% |
| 3 | * Copyright 2014 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-factory.h"cxx . . $ `<file>/src/internal/provider-by-factory.h`/ |
| 22 | |
| 23 | #include <injeqt/exception/instantiation-failed.h>cxx . . $ `<file>/include/injeqt/exception/instantiation-failed.h`/ |
| 24 | |
| 25 | #include "injector-impl.h"cxx . . $ `<file>/src/internal/injector-impl.h`/ |
| 26 | |
| 27 | namespace injeqtcxx . . $ injeqt/ { namespace internalcxx . . $ injeqt/internal/ { |
| 28 | |
| 29 | provider_by_factorycxx . . $ injeqt/internal/provider_by_factory#::provider_by_factorycxx . . $ injeqt/internal/provider_by_factory#provider_by_factory(1fa9f39a5bd862df).(factory_methodcxx . . $ injeqt/internal/factory_method# factory) : |
| 30 | _factorycxx . . $ injeqt/internal/provider_by_factory#_factory.{stdcxx . . $ std/::movecxx . . $ std/move(e7c6c0c8363dcc46).(factory)} |
| 31 | { |
| 32 | } |
| 33 | |
| 34 | provider_by_factorycxx . . $ injeqt/internal/provider_by_factory#::~cxx . . $ injeqt/internal/provider_by_factory#`~provider_by_factory`(49f6e7a06ebc5aa8).provider_by_factorycxx . . $ injeqt/internal/provider_by_factory#() |
| 35 | { |
| 36 | } |
| 37 | |
| 38 | const typecxx . . $ injeqt/v1/type# & provider_by_factorycxx . . $ injeqt/internal/provider_by_factory#::provided_typecxx . . $ injeqt/internal/provider_by_factory#provided_type(7e9f7f4e42b3414e).() const |
| 39 | { |
| 40 | return _factorycxx . . $ injeqt/internal/provider_by_factory#_factory..result_typecxx . . $ injeqt/internal/factory_method#result_type(7e9f7f4e42b3414e).(); |
| 41 | } |
| 42 | |
| 43 | const factory_methodcxx . . $ injeqt/internal/factory_method# & provider_by_factorycxx . . $ injeqt/internal/provider_by_factory#::factorycxx . . $ injeqt/internal/provider_by_factory#factory(95f19e0517a98a5d).() const |
| 44 | { |
| 45 | return _factorycxx . . $ injeqt/internal/provider_by_factory#_factory.; |
| 46 | } |
| 47 | |
| 48 | QObjectcxx . . $ QObject# * provider_by_factorycxx . . $ injeqt/internal/provider_by_factory#::providecxx . . $ injeqt/internal/provider_by_factory#provide(51123600412ca135).(injector_corecxx . . $ injeqt/internal/injector_core# &i) |
| 49 | { |
| 50 | if (!_objectcxx . . $ injeqt/internal/provider_by_factory#_object.) |
| 51 | { |
| 52 | auto factory_object = i.getcxx . . $ injeqt/internal/injector_core#get(e1ed43d1af855660).(_factorycxx . . $ injeqt/internal/provider_by_factory#_factory..object_typecxx . . $ injeqt/internal/factory_method#object_type(7e9f7f4e42b3414e).()); |
| 53 | _objectcxx . . $ injeqt/internal/provider_by_factory#_object. =cxx . . $ std/unique_ptr#`operator=`(1b63e42eaa758a73). _factorycxx . . $ injeqt/internal/provider_by_factory#_factory..invokecxx . . $ injeqt/internal/factory_method#invoke(a7ea179cf2951a58).(factory_object); |
| 54 | if (!_objectcxx . . $ injeqt/internal/provider_by_factory#_object.) |
| 55 | throw exceptioncxx . . $ injeqt/v1/exception/instantiation_failed#instantiation_failed(8d4ab0a187bf9331).::instantiation_failedcxx . . $ injeqt/v1/exception/instantiation_failed#{provided_typecxx . . $ std/__cxx11/basic_string#basic_string(3bc0f77cdfbaa67f).().namecxx . . $ injeqt/v1/type#name(219584694fe2b248).()}; |
| 56 | } |
| 57 | |
| 58 | return _objectcxx . . $ injeqt/internal/provider_by_factory#_object..getcxx . . $ std/unique_ptr#get(ca399b2b6292c808).(); |
| 59 | } |
| 60 | |
| 61 | typescxx . . $ injeqt/internal/types# provider_by_factorycxx . . $ injeqt/internal/provider_by_factory#::required_typescxx . . $ injeqt/internal/provider_by_factory#required_types(6f3e1a4b3e1e60c4).() const |
| 62 | { |
| 63 | return typescxx . . $ injeqt/internal/sorted_unique_vector#sorted_unique_vector(27fd641105185d40).{_factorycxx . . $ injeqt/internal/provider_by_factory#_factory..object_typecxx . . $ injeqt/internal/factory_method#object_type(7e9f7f4e42b3414e).()}; |
| 64 | } |
| 65 | |
| 66 | bool provider_by_factorycxx . . $ injeqt/internal/provider_by_factory#::require_resolvingcxx . . $ injeqt/internal/provider_by_factory#require_resolving(50ce9a9e25b4a850).() const |
| 67 | { |
| 68 | return false; |
| 69 | } |
| 70 | |
| 71 | }} |