Debian Codegraph @

src/internal/provider-by-default-constructor.h

raw symbols SCIP
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 #pragma once
22
23 #include <injeqt/injeqt.h>cxx . . $ `<file>/include/injeqt/injeqt.h`/
24
25 #include "internal.h"cxx . . $ `<file>/src/internal/internal.h`/
26 #include "provider.h"cxx . . $ `<file>/src/internal/provider.h`/
27 #include "default-constructor-method.h"cxx . . $ `<file>/src/internal/default-constructor-method.h`/
28
29 /**
30 * @file
31 * @brief Contains classes and functions for representing provider working on default constructor.
32 */
33
34 namespace injeqtcxx . . $ injeqt/ { namespace internalcxx . . $ injeqt/internal/ {
35
36 /**
37 * @brief Provider that returns default-constructed object.
38 *
39 * This provider implementation will return object using default constructor of some type.
40 * Its provided_type() returns type of object that contains passed constructor. Its required_types()
41 * returns empty set of types no other objects are required for construction.
42 *
43 * Once created, object will be stored inside and return on subsequents calls to provide(injector_core &).
44 * This provider has ownershipd over created object and will destroy it at own destruction.
45 */
46 class INJEQT_INTERNAL_APIcxx . . $ `src/internal/internal.h:24:9`! provider_by_default_constructorcxx . . $ injeqt/internal/provider_by_default_constructor# final : public providercxx . . $ injeqt/internal/provider#
47 {
48
49 public:
50 /**
51 * @brief Create provider instance with default constructor to call.
52 * @param constructor constructor method used to create object
53 * @pre !constructor.is_empty()
54 */
55 explicit provider_by_default_constructorcxx . . $ injeqt/internal/provider_by_default_constructor#provider_by_default_constructor(5cc42903b1b3d70).(default_constructor_methodcxx . . $ injeqt/internal/default_constructor_method# constructor);
56 virtual ~cxx . . $ injeqt/internal/provider_by_default_constructor#`~provider_by_default_constructor`(49f6e7a06ebc5aa8).provider_by_default_constructorcxx . . $ injeqt/internal/provider_by_default_constructor#();
57
58 provider_by_default_constructorcxx . . $ injeqt/internal/provider_by_default_constructor#provider_by_default_constructor(f5bbaaca0c6c3233).(provider_by_default_constructorcxx . . $ injeqt/internal/provider_by_default_constructor# &&x) = delete;
59 provider_by_default_constructorcxx . . $ injeqt/internal/provider_by_default_constructor# & operatorcxx . . $ injeqt/internal/provider_by_default_constructor#`operator=`(f8856ba9f0492fdc). = (provider_by_default_constructorcxx . . $ injeqt/internal/provider_by_default_constructor# &&x) = delete;
60
61 /**
62 * @return default_constructor_method::object_type() of object passed to construtor
63 */
64 virtual const typecxx . . $ injeqt/v1/type# & provided_typecxx . . $ injeqt/internal/provider_by_default_constructor#provided_type(7e9f7f4e42b3414e).() const override;
65
66 /**
67 * @return object created by default constructor
68 * @post result != nullptr
69 * @post implements(type{result->metaObject()}, provided_type())
70 * @throw instantiation_failed if instantiation of provided type failed
71 *
72 * If object was not yet created the constructor() method is called and object is stored
73 * in internal cache. Then object from cache is returned.
74 */
75 virtual QObjectcxx . . $ QObject# * providecxx . . $ injeqt/internal/provider_by_default_constructor#provide(51123600412ca135).(injector_corecxx . . $ injeqt/internal/injector_core# &i) override;
76
77 /**
78 * @return empty set of object - this provider does not require another object to instantiate
79 */
80 virtual typescxx . . $ injeqt/internal/types# required_typescxx . . $ injeqt/internal/provider_by_default_constructor#required_types(6f3e1a4b3e1e60c4).() const { return typescxx . . $ injeqt/internal/sorted_unique_vector#sorted_unique_vector(49f6e7a06ebc5aa8).{}; }
81
82 /**
83 * @return true
84 *
85 * Objects created by injector will have its dependencies resolved.
86 */
87 virtual bool require_resolvingcxx . . $ injeqt/internal/provider_by_default_constructor#require_resolving(50ce9a9e25b4a850).() const;
88
89 /**
90 * @return constructor object passed in constructor
91 */
92 const default_constructor_methodcxx . . $ injeqt/internal/default_constructor_method# & constructorcxx . . $ injeqt/internal/provider_by_default_constructor#constructor(172241f62f9a54b0).() const;
93
94 private:
95 default_constructor_methodcxx . . $ injeqt/internal/default_constructor_method# _constructorcxx . . $ injeqt/internal/provider_by_default_constructor#_constructor.;
96 stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<QObjectcxx . . $ QObject#> _objectcxx . . $ injeqt/internal/provider_by_default_constructor#_object.;
97
98 };
99
100 }}