| 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-default-constructor.h"cxx . . $ `<file>/src/internal/provider-by-default-constructor.h`/ |
| 22 | |
| 23 | #include <injeqt/exception/instantiation-failed.h>cxx . . $ `<file>/include/injeqt/exception/instantiation-failed.h`/ |
| 24 | |
| 25 | #include <cassert> |
| 26 | |
| 27 | namespace injeqtcxx . . $ injeqt/ { namespace internalcxx . . $ injeqt/internal/ { |
| 28 | |
| 29 | provider_by_default_constructorcxx . . $ injeqt/internal/provider_by_default_constructor#::provider_by_default_constructorcxx . . $ injeqt/internal/provider_by_default_constructor#provider_by_default_constructor(5cc42903b1b3d70).(default_constructor_methodcxx . . $ injeqt/internal/default_constructor_method# constructor) : |
| 30 | _constructorcxx . . $ injeqt/internal/provider_by_default_constructor#_constructor.{stdcxx . . $ std/::movecxx . . $ std/move(e7c6c0c8363dcc46).(constructor)} |
| 31 | { |
| 32 | assertcxx . . $ `/usr/include/assert.h:102:11`!(!_constructor.is_empty()); |
| 33 | } |
| 34 | |
| 35 | provider_by_default_constructorcxx . . $ injeqt/internal/provider_by_default_constructor#::~cxx . . $ injeqt/internal/provider_by_default_constructor#`~provider_by_default_constructor`(49f6e7a06ebc5aa8).provider_by_default_constructorcxx . . $ injeqt/internal/provider_by_default_constructor#() |
| 36 | { |
| 37 | } |
| 38 | |
| 39 | const typecxx . . $ injeqt/v1/type# & provider_by_default_constructorcxx . . $ injeqt/internal/provider_by_default_constructor#::provided_typecxx . . $ injeqt/internal/provider_by_default_constructor#provided_type(7e9f7f4e42b3414e).() const |
| 40 | { |
| 41 | return _constructorcxx . . $ injeqt/internal/provider_by_default_constructor#_constructor..object_typecxx . . $ injeqt/internal/default_constructor_method#object_type(7e9f7f4e42b3414e).(); |
| 42 | } |
| 43 | |
| 44 | const default_constructor_methodcxx . . $ injeqt/internal/default_constructor_method# & provider_by_default_constructorcxx . . $ injeqt/internal/provider_by_default_constructor#::constructorcxx . . $ injeqt/internal/provider_by_default_constructor#constructor(172241f62f9a54b0).() const |
| 45 | { |
| 46 | return _constructorcxx . . $ injeqt/internal/provider_by_default_constructor#_constructor.; |
| 47 | } |
| 48 | |
| 49 | QObjectcxx . . $ QObject# * provider_by_default_constructorcxx . . $ injeqt/internal/provider_by_default_constructor#::providecxx . . $ injeqt/internal/provider_by_default_constructor#provide(51123600412ca135).(injector_corecxx . . $ injeqt/internal/injector_core# &) |
| 50 | { |
| 51 | if (!_objectcxx . . $ injeqt/internal/provider_by_default_constructor#_object.) |
| 52 | { |
| 53 | _objectcxx . . $ injeqt/internal/provider_by_default_constructor#_object. =cxx . . $ std/unique_ptr#`operator=`(1b63e42eaa758a73). _constructorcxx . . $ injeqt/internal/provider_by_default_constructor#_constructor..invokecxx . . $ injeqt/internal/default_constructor_method#invoke(5b92897074bb3200).(); |
| 54 | if (!_objectcxx . . $ injeqt/internal/provider_by_default_constructor#_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 | return _objectcxx . . $ injeqt/internal/provider_by_default_constructor#_object..getcxx . . $ std/unique_ptr#get(ca399b2b6292c808).(); |
| 58 | } |
| 59 | |
| 60 | bool provider_by_default_constructorcxx . . $ injeqt/internal/provider_by_default_constructor#::require_resolvingcxx . . $ injeqt/internal/provider_by_default_constructor#require_resolving(50ce9a9e25b4a850).() const |
| 61 | { |
| 62 | return true; |
| 63 | } |
| 64 | |
| 65 | }} |