| 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 "default-constructor-method.h"cxx . . $ `<file>/src/internal/default-constructor-method.h`/ |
| 22 | |
| 23 | #include <cassert> |
| 24 | |
| 25 | namespace injeqtcxx . . $ injeqt/ { namespace internalcxx . . $ injeqt/internal/ { |
| 26 | |
| 27 | default_constructor_methodcxx . . $ injeqt/internal/default_constructor_method#::default_constructor_methodcxx . . $ injeqt/internal/default_constructor_method#default_constructor_method(49f6e7a06ebc5aa8).() |
| 28 | { |
| 29 | } |
| 30 | |
| 31 | default_constructor_methodcxx . . $ injeqt/internal/default_constructor_method#::default_constructor_methodcxx . . $ injeqt/internal/default_constructor_method#default_constructor_method(77ddf0810175a47c).(QMetaMethodcxx . . $ QMetaMethod# meta_method) : |
| 32 | _object_typecxx . . $ injeqt/internal/default_constructor_method#_object_type.{meta_method.enclosingMetaObjectcxx . . $ QMetaMethod#enclosingMetaObject(216d4151dd9c9333).()}, |
| 33 | _meta_methodcxx . . $ injeqt/internal/default_constructor_method#_meta_method.{stdcxx . . $ std/::movecxx . . $ std/move(e7c6c0c8363dcc46).(meta_method)} |
| 34 | { |
| 35 | assertcxx . . $ `/usr/include/assert.h:102:11`!(meta_method.methodType() == QMetaMethod::Constructor); |
| 36 | assertcxx . . $ `/usr/include/assert.h:102:11`!(meta_method.parameterCount() == 0); |
| 37 | assertcxx . . $ `/usr/include/assert.h:102:11`!(meta_method.enclosingMetaObject() != nullptr); |
| 38 | } |
| 39 | |
| 40 | bool default_constructor_methodcxx . . $ injeqt/internal/default_constructor_method#::is_emptycxx . . $ injeqt/internal/default_constructor_method#is_empty(50ce9a9e25b4a850).() const |
| 41 | { |
| 42 | return !_meta_methodcxx . . $ injeqt/internal/default_constructor_method#_meta_method..isValidcxx . . $ QMetaMethod#isValid(50ce9a9e25b4a850).(); |
| 43 | } |
| 44 | |
| 45 | const typecxx . . $ injeqt/v1/type# & default_constructor_methodcxx . . $ injeqt/internal/default_constructor_method#::object_typecxx . . $ injeqt/internal/default_constructor_method#object_type(7e9f7f4e42b3414e).() const |
| 46 | { |
| 47 | return _object_typecxx . . $ injeqt/internal/default_constructor_method#_object_type.; |
| 48 | } |
| 49 | |
| 50 | const QMetaMethodcxx . . $ QMetaMethod# & default_constructor_methodcxx . . $ injeqt/internal/default_constructor_method#::meta_methodcxx . . $ injeqt/internal/default_constructor_method#meta_method(9ea3a8eb2e51c72d).() const |
| 51 | { |
| 52 | return _meta_methodcxx . . $ injeqt/internal/default_constructor_method#_meta_method.; |
| 53 | } |
| 54 | |
| 55 | stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<QObjectcxx . . $ QObject#> default_constructor_methodcxx . . $ injeqt/internal/default_constructor_method#::invokecxx . . $ injeqt/internal/default_constructor_method#invoke(5b92897074bb3200).() const |
| 56 | { |
| 57 | assertcxx . . $ `/usr/include/assert.h:102:11`!(!is_empty()); |
| 58 | |
| 59 | return stdcxx . . $ std/unique_ptr#unique_ptr(d6762fce684538e4).::unique_ptrcxx . . $ std/unique_ptr#<QObjectcxx . . $ QObject#>{_meta_methodcxx . . $ injeqt/internal/default_constructor_method#_meta_method..enclosingMetaObjectcxx . . $ QMetaMethod#enclosingMetaObject(216d4151dd9c9333).()->newInstancecxx . . $ QMetaObject#newInstance(afdf6bb3d92fdd82).()}; |
| 60 | } |
| 61 | |
| 62 | bool operatorcxx . . $ injeqt/internal/`operator==`(4e0dc7aefa17b10b). == (const default_constructor_methodcxx . . $ injeqt/internal/default_constructor_method# &x, const default_constructor_methodcxx . . $ injeqt/internal/default_constructor_method# &y) |
| 63 | { |
| 64 | if (x.object_typecxx . . $ injeqt/internal/default_constructor_method#object_type(7e9f7f4e42b3414e).() !=cxx . . $ injeqt/v1/`operator!=`(24fd26303071bddf). y.object_typecxx . . $ injeqt/internal/default_constructor_method#object_type(7e9f7f4e42b3414e).()) |
| 65 | return false; |
| 66 | |
| 67 | assertcxx . . $ `/usr/include/assert.h:102:11`!(x.meta_method() == y.meta_method()); |
| 68 | |
| 69 | return true; |
| 70 | } |
| 71 | |
| 72 | bool operatorcxx . . $ injeqt/internal/`operator!=`(4e0dc7aefa17b10b). != (const default_constructor_methodcxx . . $ injeqt/internal/default_constructor_method# &x, const default_constructor_methodcxx . . $ injeqt/internal/default_constructor_method# &y) |
| 73 | { |
| 74 | return !(x ==cxx . . $ injeqt/internal/`operator==`(4e0dc7aefa17b10b). y); |
| 75 | } |
| 76 | |
| 77 | default_constructor_methodcxx . . $ injeqt/internal/default_constructor_method# make_default_constructor_methodcxx . . $ injeqt/internal/make_default_constructor_method(84114e33f83ca37c).(const typecxx . . $ injeqt/v1/type# &t) |
| 78 | { |
| 79 | assertcxx . . $ `/usr/include/assert.h:102:11`!(!t.is_empty()); |
| 80 | assertcxx . . $ `/usr/include/assert.h:102:11`!(!t.is_qobject()); |
| 81 | |
| 82 | auto meta_object = t.meta_objectcxx . . $ injeqt/v1/type#meta_object(216d4151dd9c9333).(); |
| 83 | auto constructor_count = meta_object->constructorCountcxx . . $ QMetaObject#constructorCount(455f465bc33b4cdf).(); |
| 84 | for (decltype(constructor_count) i = 0; i < constructor_count; i++) |
| 85 | { |
| 86 | auto constructor = meta_object->constructorcxx . . $ QMetaObject#constructor(964508606e32bda3).(i); |
| 87 | if (constructor.methodTypecxx . . $ QMetaMethod#methodType(3a13d453cc434175).() != QMetaMethodcxx . . $ QMetaMethod#::Constructorcxx . . $ QMetaMethod#Constructor.) |
| 88 | continue; |
| 89 | if (constructor.parameterCountcxx . . $ QMetaMethod#parameterCount(455f465bc33b4cdf).() != 0) |
| 90 | continue; |
| 91 | return default_constructor_methodcxx . . $ injeqt/internal/default_constructor_method#default_constructor_method(77ddf0810175a47c).{constructor}; |
| 92 | } |
| 93 | |
| 94 | return default_constructor_methodcxx . . $ injeqt/internal/default_constructor_method#default_constructor_method(49f6e7a06ebc5aa8).{}; |
| 95 | } |
| 96 | |
| 97 | }} |