Debian Codegraph @

src/core/components/sensors/graphitemprofilepart.cpp

raw symbols SCIP
1 // SPDX-License-Identifier: GPL-3.0-or-later
2 // Copyright 2019 Juan Palacios <[email protected]>
3
4 #include "graphitemprofilepart.h"
5
6 #include <memory>
7
8 GraphItemProfilePart::GraphItemProfilePart(std::string_view id,
9 std::string_view color) noexcept
10 : id_(id)
11 , color_(color)
12 {
13 }
14
15 std::unique_ptr<Exportable::Exporter>
16 GraphItemProfilePart::factory(IProfilePartProvider const &)
17 {
18 return nullptr;
19 }
20
21 std::unique_ptr<Exportable::Exporter> GraphItemProfilePart::initializer()
22 {
23 return nullptr;
24 }
25
26 std::string const &GraphItemProfilePart::ID() const
27 {
28 return id_;
29 }
30
31 void GraphItemProfilePart::importProfilePart(IProfilePart::Importer &i)
32 {
33 auto &itemImporter = dynamic_cast<GraphItemProfilePart::Importer &>(i);
34 color_ = itemImporter.provideColor();
35 }
36
37 void GraphItemProfilePart::exportProfilePart(IProfilePart::Exporter &e) const
38 {
39 auto &itemExporter = dynamic_cast<GraphItemProfilePart::Exporter &>(e);
40 itemExporter.takeColor(color_);
41 }
42
43 std::unique_ptr<IProfilePart> GraphItemProfilePart::cloneProfilePart() const
44 {
45 return std::make_unique<GraphItemProfilePart>(id_, color_);
46 }