| 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-configuration.h"cxx . . $ `<file>/src/internal/provider-by-factory-configuration.h`/ |
| 22 | |
| 23 | #include <injeqt/exception/qobject-type.h>cxx . . $ `<file>/include/injeqt/exception/qobject-type.h`/ |
| 24 | #include <injeqt/exception/unique-factory-method-not-found.h>cxx . . $ `<file>/include/injeqt/exception/unique-factory-method-not-found.h`/ |
| 25 | |
| 26 | #include "factory-method.h"cxx . . $ `<file>/src/internal/factory-method.h`/ |
| 27 | #include "provider-by-factory.h"cxx . . $ `<file>/src/internal/provider-by-factory.h`/ |
| 28 | |
| 29 | #include <cassert> |
| 30 | |
| 31 | namespace injeqtcxx . . $ injeqt/ { namespace internalcxx . . $ injeqt/internal/ { |
| 32 | |
| 33 | provider_by_factory_configurationcxx . . $ injeqt/internal/provider_by_factory_configuration#::provider_by_factory_configurationcxx . . $ injeqt/internal/provider_by_factory_configuration#provider_by_factory_configuration(4db51c5aea7c0a3b).(typecxx . . $ injeqt/v1/type# object_type, typecxx . . $ injeqt/v1/type# factory_type) : |
| 34 | _object_typecxx . . $ injeqt/internal/provider_by_factory_configuration#_object_type.{stdcxx . . $ std/::movecxx . . $ std/move(e7c6c0c8363dcc46).(object_type)}, |
| 35 | _factory_typecxx . . $ injeqt/internal/provider_by_factory_configuration#_factory_type.{stdcxx . . $ std/::movecxx . . $ std/move(e7c6c0c8363dcc46).(factory_type)} |
| 36 | { |
| 37 | assertcxx . . $ `/usr/include/assert.h:102:11`!(!_object_type.is_empty()); |
| 38 | assertcxx . . $ `/usr/include/assert.h:102:11`!(!_factory_type.is_empty()); |
| 39 | } |
| 40 | |
| 41 | provider_by_factory_configurationcxx . . $ injeqt/internal/provider_by_factory_configuration#::~cxx . . $ injeqt/internal/provider_by_factory_configuration#`~provider_by_factory_configuration`(49f6e7a06ebc5aa8).provider_by_factory_configurationcxx . . $ injeqt/internal/provider_by_factory_configuration#() |
| 42 | { |
| 43 | } |
| 44 | |
| 45 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<typecxx . . $ injeqt/v1/type#> provider_by_factory_configurationcxx . . $ injeqt/internal/provider_by_factory_configuration#::typescxx . . $ injeqt/internal/provider_by_factory_configuration#types(cf3a392ed5d6b92b).() const |
| 46 | { |
| 47 | return {cxx . . $ std/vector#vector(9619226211e5a241)._object_typecxx . . $ injeqt/internal/provider_by_factory_configuration#_object_type., _factory_typecxx . . $ injeqt/internal/provider_by_factory_configuration#_factory_type.}; |
| 48 | } |
| 49 | |
| 50 | stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<providercxx . . $ injeqt/internal/provider#> provider_by_factory_configurationcxx . . $ injeqt/internal/provider_by_factory_configuration#::create_providercxx . . $ injeqt/internal/provider_by_factory_configuration#create_provider(2c251cf15db9f22d).(const types_by_namecxx . . $ injeqt/internal/types_by_name# &known_types) const |
| 51 | { |
| 52 | if (_object_typecxx . . $ injeqt/internal/provider_by_factory_configuration#_object_type..is_qobjectcxx . . $ injeqt/v1/type#is_qobject(50ce9a9e25b4a850).()) |
| 53 | throw exceptioncxx . . $ injeqt/v1/exception/qobject_type#qobject_type(8d4ab0a187bf9331).::qobject_typecxx . . $ injeqt/v1/exception/qobject_type#(); |
| 54 | if (_factory_typecxx . . $ injeqt/internal/provider_by_factory_configuration#_factory_type..is_qobjectcxx . . $ injeqt/v1/type#is_qobject(50ce9a9e25b4a850).()) |
| 55 | throw exceptioncxx . . $ injeqt/v1/exception/qobject_type#qobject_type(8d4ab0a187bf9331).::qobject_typecxx . . $ injeqt/v1/exception/qobject_type#(); |
| 56 | |
| 57 | auto fm = internalcxx . . $ injeqt/internal/::make_factory_methodcxx . . $ injeqt/internal/make_factory_method(de794affec8a70ca).(known_types, _object_typecxx . . $ injeqt/internal/provider_by_factory_configuration#_object_type., _factory_typecxx . . $ injeqt/internal/provider_by_factory_configuration#_factory_type.); |
| 58 | if (fm.is_emptycxx . . $ injeqt/internal/factory_method#is_empty(50ce9a9e25b4a850).()) |
| 59 | throw exceptioncxx . . $ injeqt/v1/exception/unique_factory_method_not_found#unique_factory_method_not_found(8d4ab0a187bf9331).::unique_factory_method_not_foundcxx . . $ injeqt/v1/exception/unique_factory_method_not_found#{_object_typecxx . . $ std/__cxx11/basic_string#basic_string(3bc0f77cdfbaa67f)..namecxx . . $ injeqt/v1/type#name(219584694fe2b248).() +cxx . . $ std/operator+(900ec9581c410ad9). " in " +cxx . . $ std/operator+(aa1c00e85b87da6b). _factory_typecxx . . $ injeqt/internal/provider_by_factory_configuration#_factory_type..namecxx . . $ injeqt/v1/type#name(219584694fe2b248).()}; |
| 60 | |
| 61 | returncxx . . $ std/unique_ptr#unique_ptr(d6762fce684538e4). stdcxx . . $ std/unique_ptr#unique_ptr(9ad45c7d2296bc38).::unique_ptrcxx . . $ std/unique_ptr#<provider_by_factorycxx . . $ injeqt/internal/provider_by_factory#>{new provider_by_factorycxx . . $ injeqt/internal/provider_by_factory#{stdcxx . . $ std/::movecxx . . $ std/move(e7c6c0c8363dcc46).(fm)}}; |
| 62 | } |
| 63 | |
| 64 | }} |