Debian Codegraph @

src/core/components/controls/noopprofilepart.cpp

raw symbols SCIP
1 // SPDX-License-Identifier: GPL-3.0-or-later
2 // Copyright 2021 Juan Palacios <[email protected]>
3
4 #include "noopprofilepart.h"
5
6 #include "core/profilepartprovider.h"
7 #include <memory>
8
9 class NoopProfilePart::Initializer final : public Noop::Exporter
10 {
11 public:
12 Initializer(NoopProfilePart &outer) noexcept
13 : outer_(outer)
14 {
15 }
16
17 std::optional<std::reference_wrapper<Exportable::Exporter>>
18 provideExporter(Item const &) override
19 {
20 return {};
21 }
22
23 void takeActive(bool active) override;
24
25 private:
26 NoopProfilePart &outer_;
27 };
28
29 void NoopProfilePart::Initializer::takeActive(bool active)
30 {
31 outer_.activate(active);
32 }
33
34 NoopProfilePart::NoopProfilePart() noexcept
35 : id_(Noop::ItemID)
36 {
37 }
38
39 std::unique_ptr<Exportable::Exporter>
40 NoopProfilePart::factory(IProfilePartProvider const &)
41 {
42 return nullptr;
43 }
44
45 std::unique_ptr<Exportable::Exporter> NoopProfilePart::initializer()
46 {
47 return std::make_unique<NoopProfilePart::Initializer>(*this);
48 }
49
50 std::string const &NoopProfilePart::ID() const
51 {
52 return id_;
53 }
54
55 std::optional<std::reference_wrapper<Importable::Importer>>
56 NoopProfilePart::provideImporter(Item const &)
57 {
58 return {};
59 }
60
61 bool NoopProfilePart::provideActive() const
62 {
63 return active();
64 }
65
66 void NoopProfilePart::importProfilePart(IProfilePart::Importer &)
67 {
68 }
69
70 void NoopProfilePart::exportProfilePart(IProfilePart::Exporter &) const
71 {
72 }
73
74 std::unique_ptr<IProfilePart> NoopProfilePart::cloneProfilePart() const
75 {
76 return std::make_unique<NoopProfilePart>();
77 }
78
79 bool const NoopProfilePart::registered_ = ProfilePartProvider::registerProvider(
80 Noop::ItemID, []() { return std::make_unique<NoopProfilePart>(); });