| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | // Copyright 2019 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #pragma once |
| 5 | |
| 6 | #include "core/profilepart.h" |
| 7 | #include <string> |
| 8 | #include <string_view> |
| 9 | |
| 10 | class GraphItemProfilePart : public ProfilePart |
| 11 | { |
| 12 | public: |
| 13 | class Importer : public IProfilePart::Importer |
| 14 | { |
| 15 | public: |
| 16 | virtual std::string const &provideColor() const = 0; |
| 17 | }; |
| 18 | |
| 19 | class Exporter : public IProfilePart::Exporter |
| 20 | { |
| 21 | public: |
| 22 | virtual void takeColor(std::string const &color) = 0; |
| 23 | }; |
| 24 | |
| 25 | GraphItemProfilePart(std::string_view id, std::string_view color) noexcept; |
| 26 | |
| 27 | std::unique_ptr<Exportable::Exporter> |
| 28 | factory(IProfilePartProvider const &profilePartProvider) override; |
| 29 | std::unique_ptr<Exportable::Exporter> initializer() override; |
| 30 | |
| 31 | std::string const &ID() const override; |
| 32 | |
| 33 | protected: |
| 34 | void importProfilePart(IProfilePart::Importer &i) override; |
| 35 | void exportProfilePart(IProfilePart::Exporter &e) const override; |
| 36 | std::unique_ptr<IProfilePart> cloneProfilePart() const override; |
| 37 | |
| 38 | private: |
| 39 | std::string id_; |
| 40 | std::string color_; |
| 41 | }; |