| 1 | // SPDX-License-Identifier: GPL-3.0-or-latercxx . . $ `<file>/src/core/profilepart.cpp`/ |
| 2 | // Copyright 2019 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #include "profilepart.h"cxx . . $ `<file>/src/core/profilepart.h`/ |
| 5 | |
| 6 | #include "iprofilepartprovider.h"cxx . . $ `<file>/src/core/iprofilepartprovider.h`/ |
| 7 | #include <utility> |
| 8 | |
| 9 | bool ProfilePartcxx . . $ ProfilePart#::activecxx . . $ ProfilePart#active(50ce9a9e25b4a850).() const |
| 10 | { |
| 11 | return active_cxx . . $ ProfilePart#active_.; |
| 12 | } |
| 13 | |
| 14 | void ProfilePartcxx . . $ ProfilePart#::activatecxx . . $ ProfilePart#activate(b45ddcbc8423892c).(bool active) |
| 15 | { |
| 16 | active_cxx . . $ ProfilePart#active_. = active; |
| 17 | } |
| 18 | |
| 19 | stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<IProfilePartcxx . . $ IProfilePart#> ProfilePartcxx . . $ ProfilePart#::clonecxx . . $ ProfilePart#clone(1378fcc1caef3e7b).() const |
| 20 | { |
| 21 | auto clone = cloneProfilePartcxx . . $ ProfilePart#cloneProfilePart(1378fcc1caef3e7b).(); |
| 22 | clone->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).activatecxx . . $ IProfilePart#activate(b45ddcbc8423892c).(activecxx . . $ ProfilePart#active(50ce9a9e25b4a850).()); |
| 23 | |
| 24 | return clonecxx . . $ std/unique_ptr#unique_ptr(d6762fce684538e4).; |
| 25 | } |
| 26 | |
| 27 | void ProfilePartcxx . . $ ProfilePart#::importWithcxx . . $ ProfilePart#importWith(94eddebf9440278).(Importablecxx . . $ Importable#::Importercxx . . $ Importable#Importer# &i) |
| 28 | { |
| 29 | auto importer = i.provideImportercxx . . $ Importable#Importer#provideImporter(c13a3bcac0db4745).(*this); |
| 30 | if (importer.has_valuecxx . . $ std/optional#has_value(3482b152b9333168).()) { |
| 31 | auto &profilePartImporter = |
| 32 | dynamic_cast<ProfilePartcxx . . $ ProfilePart#::Importercxx . . $ IProfilePart#Importer# &>(importer->cxx . . $ std/optional#`operator->`(258ee1c9e0a18a5c).getcxx . . $ std/reference_wrapper#get(d426bc7b625886b7).()); |
| 33 | |
| 34 | activatecxx . . $ ProfilePart#activate(b45ddcbc8423892c).(profilePartImporter.provideActivecxx . . $ IProfilePart#Importer#provideActive(50ce9a9e25b4a850).()); |
| 35 | importProfilePartcxx . . $ ProfilePart#importProfilePart(d62b6a6dfe9fe695).(profilePartImporter); |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | void ProfilePartcxx . . $ ProfilePart#::exportWithcxx . . $ ProfilePart#exportWith(5b5c94ff60635419).(Exportablecxx . . $ Exportable#::Exportercxx . . $ Exportable#Exporter# &e) const |
| 40 | { |
| 41 | auto exporter = e.provideExportercxx . . $ Exportable#Exporter#provideExporter(3acccbde2694e33a).(*this); |
| 42 | if (exporter.has_valuecxx . . $ std/optional#has_value(3482b152b9333168).()) { |
| 43 | auto &profilePartExporter = |
| 44 | dynamic_cast<ProfilePartcxx . . $ ProfilePart#::Exportercxx . . $ IProfilePart#Exporter# &>(exporter->cxx . . $ std/optional#`operator->`(258ee1c9e0a18a5c).getcxx . . $ std/reference_wrapper#get(d426bc7b625886b7).()); |
| 45 | |
| 46 | profilePartExporter.takeActivecxx . . $ IProfilePart#Exporter#takeActive(b45ddcbc8423892c).(activecxx . . $ ProfilePart#active(50ce9a9e25b4a850).()); |
| 47 | exportProfilePartcxx . . $ ProfilePart#exportProfilePart(702e13e8794d0da4).(profilePartExporter); |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | ProfilePartcxx . . $ ProfilePart#::Factorycxx . . $ ProfilePart#Factory#::Factorycxx . . $ ProfilePart#Factory#Factory(d795475d23b535dc).(IProfilePartProvidercxx . . $ IProfilePartProvider# const &profilePartProvider) noexcept |
| 52 | : profilePartProvider_cxx . . $ ProfilePart#Factory#profilePartProvider_.(profilePartProvider) |
| 53 | { |
| 54 | } |
| 55 | |
| 56 | stdcxx . . $ std/::optionalcxx . . $ std/optional#<stdcxx . . $ std/::reference_wrappercxx . . $ std/reference_wrapper#<Exportablecxx . . $ Exportable#::Exportercxx . . $ Exportable#Exporter#>> |
| 57 | ProfilePartcxx . . $ ProfilePart#::Factorycxx . . $ ProfilePart#Factory#::factorycxx . . $ ProfilePart#Factory#factory(f4c9227945a043b8).(stdcxx . . $ std/::stringcxx . . $ std/string# const &componentID) |
| 58 | { |
| 59 | auto profilePart = createPartcxx . . $ ProfilePart#Factory#createPart(eebc246fe191e829).(componentID); |
| 60 | if (profilePart != nullptr) { |
| 61 | auto factory = profilePart->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).factorycxx . . $ IProfilePart#factory(af48dc8d4887b70c).(profilePartProvider_cxx . . $ ProfilePart#Factory#profilePartProvider_.); |
| 62 | takeProfilePartcxx . . $ ProfilePart#Factory#takeProfilePart(8c7717026cb6ec4).(stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(profilePart)); |
| 63 | |
| 64 | if (factory != nullptr) { |
| 65 | factories_cxx . . $ ProfilePart#Factory#factories_..emplace_backcxx . . $ std/vector#emplace_back(a1bcdfdabc3a37df).(stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(factory)); |
| 66 | return *cxx . . $ std/optional#optional(e3f0d6382bd52f24).factories_cxx . . $ ProfilePart#Factory#factories_..backcxx . . $ std/vector#back(6baabfa6fc7b3a8e).(); |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | return {cxx . . $ std/optional#optional(ced63f7c635d850d).}; |
| 71 | } |
| 72 | |
| 73 | stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<IProfilePartcxx . . $ IProfilePart#> |
| 74 | ProfilePartcxx . . $ ProfilePart#::Factorycxx . . $ ProfilePart#Factory#::createPartcxx . . $ ProfilePart#Factory#createPart(eebc246fe191e829).(stdcxx . . $ std/::stringcxx . . $ std/string# const &componentID) const |
| 75 | { |
| 76 | auto &partProviders = profilePartProvider_cxx . . $ ProfilePart#Factory#profilePartProvider_..profilePartProviderscxx . . $ IProfilePartProvider#profilePartProviders(ff6d5c41554e1765).(); |
| 77 | auto const providerIt = partProviders.findcxx . . $ std/unordered_map#find(f39fe4bedfa7a693).(componentID); |
| 78 | if (providerIt != partProviders.cendcxx . . $ std/unordered_map#cend(f3c6e12ee1fe7252).()) |
| 79 | return providerIt->cxx . . $ std/__detail/_Node_const_iterator#`operator->`(8e614c7de0b1573e).secondcxx . . $ std/pair#second.(cxx . . $ std/function#`operator()`(39e0826ffb540481).); |
| 80 | |
| 81 | return nullptrcxx . . $ std/unique_ptr#unique_ptr(6d988fd07f070dfc).; |
| 82 | } |