Debian Codegraph @

src/core/profileview.cpp

raw symbols SCIP
1 // SPDX-License-Identifier: GPL-3.0-or-latercxx . . $ `<file>/src/core/profileview.cpp`/
2 // Copyright 2019 Juan Palacios <[email protected]>
3
4 #include "profileview.h"cxx . . $ `<file>/src/core/profileview.h`/
5
6 #include "iprofilepart.h"cxx . . $ `<file>/src/core/iprofilepart.h`/
7 #include "isyscomponentprofilepart.h"cxx . . $ `<file>/src/core/isyscomponentprofilepart.h`/
8 #include "isysmodel.h"cxx . . $ `<file>/src/core/isysmodel.h`/
9 #include "profilepartview.h"cxx . . $ `<file>/src/core/profilepartview.h`/
10 #include <algorithm>
11 #include <utility>
12
13 stdcxx . . $ std/::stringcxx . . $ std/string# const &ProfileViewcxx . . $ ProfileView#::namecxx . . $ ProfileView#name(f4fff0029955a25f).() const
14 {
15 return name_cxx . . $ ProfileView#name_.;
16 }
17
18 stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<IProfilePartViewcxx . . $ IProfilePartView#>> const &ProfileViewcxx . . $ ProfileView#::partscxx . . $ ProfileView#parts(695fa8b7727f8f8b).() const
19 {
20 return parts_cxx . . $ ProfileView#parts_.;
21 }
22
23 stdcxx . . $ std/::optionalcxx . . $ std/optional#<stdcxx . . $ std/::reference_wrappercxx . . $ std/reference_wrapper#<Importablecxx . . $ Importable#::Importercxx . . $ Importable#Importer#>>
24 ProfileViewcxx . . $ ProfileView#::provideImportercxx . . $ ProfileView#provideImporter(c13a3bcac0db4745).(Itemcxx . . $ Item# const &i)
25 {
26 if (i.IDcxx . . $ Item#ID(f4fff0029955a25f).() == ISysModelcxx . . $ std/basic_string_view#basic_string_view(b419d9def655ef02).::ItemIDcxx . . $ ISysModel#ItemID.)
27 return *cxx . . $ std/optional#optional(e3f0d6382bd52f24).this;
28 else {
29 auto partIter = stdcxx . . $ std/::find_ifcxx . . $ std/find_if(f0a0a4f94ee5cb00).(
30 parts_cxx . . $ ProfileView#parts_..cbegincxx . . $ std/vector#cbegin(d1e1699016b9d7e6).(), parts_cxx . . $ ProfileView#parts_..cendcxx . . $ std/vector#cend(d1e1699016b9d7e6).(),
31 [&](stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<IProfilePartViewcxx . . $ IProfilePartView#> const &part) {
32 auto *sysPart = dynamic_cast<ISysComponentProfilePartcxx . . $ ISysComponentProfilePart# const *>(
33 part->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).partcxx . . $ IProfilePartView#part(490d9295cd11a891).().getcxx . . $ std/__shared_ptr#get(68fd140ff244f535).());
34 if (sysPart == nullptr)
35 return false;
36
37 return sysPart->belongsTocxx . . $ ISysComponentProfilePart#belongsTo(744b9d71fca8c8b7).(i);
38 });
39 if (partIter != parts_cxx . . $ ProfileView#parts_..cendcxx . . $ std/vector#cend(d1e1699016b9d7e6).())
40 return dynamic_castcxx . . $ std/optional#optional(e3f0d6382bd52f24).<Importablecxx . . $ Importable#::Importercxx . . $ Importable#Importer# &>(*cxx . . $ std/__shared_ptr_access#`operator*`(d426bc7b625886b7).partIter->cxx . . $ __gnu_cxx/__normal_iterator#`operator->`(65c2ec7035a77d3e).getcxx . . $ std/unique_ptr#get(ea7391e9eeeaf20e).()->partcxx . . $ IProfilePartView#part(490d9295cd11a891).());
41 }
42
43 return {cxx . . $ std/optional#optional(ced63f7c635d850d).};
44 }
45
46 ProfileViewcxx . . $ ProfileView#::Initializercxx . . $ ProfileView#Initializer#::Initializercxx . . $ ProfileView#Initializer#Initializer(c80d60c748f5e9e9).(
47 ProfileViewcxx . . $ ProfileView# &profileView,
48 stdcxx . . $ std/::optionalcxx . . $ std/optional#<stdcxx . . $ std/::reference_wrappercxx . . $ std/reference_wrapper#<IProfileViewcxx . . $ IProfileView#>> base) noexcept
49 : profileView_cxx . . $ ProfileView#Initializer#profileView_.(profileView)
50 , base_cxx . . $ ProfileView#Initializer#base_.(base)
51 {
52 }
53
54 stdcxx . . $ std/::optionalcxx . . $ std/optional#<stdcxx . . $ std/::reference_wrappercxx . . $ std/reference_wrapper#<Exportablecxx . . $ Exportable#::Exportercxx . . $ Exportable#Exporter#>>
55 ProfileViewcxx . . $ ProfileView#::Initializercxx . . $ ProfileView#Initializer#::provideExportercxx . . $ ProfileView#Initializer#provideExporter(3acccbde2694e33a).(Itemcxx . . $ Item# const &i)
56 {
57 if (i.IDcxx . . $ Item#ID(f4fff0029955a25f).() == IProfilecxx . . $ std/basic_string_view#basic_string_view(b419d9def655ef02).::ItemIDcxx . . $ IProfile#ItemID.) {
58 auto &pView = dynamic_cast<IProfileViewcxx . . $ IProfileView#::Viewcxx . . $ IProfileView#View# const &>(i);
59 profileView_cxx . . $ ProfileView#Initializer#profileView_..name_cxx . . $ ProfileView#name_. =cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75). pView.namecxx . . $ IProfileView#View#name(f4fff0029955a25f).();
60
61 auto const &parts = pView.partscxx . . $ IProfileView#View#parts(eb73fac8769a6fd1).();
62 for (auto const &part : parts) {
63 stdcxx . . $ std/::shared_ptrcxx . . $ std/shared_ptr#<IProfilePartcxx . . $ IProfilePart#> profilePartcxx . . $ std/shared_ptr#shared_ptr(ced63f7c635d850d).;
64 stdcxx . . $ std/::stringcxx . . $ std/string# partProfileNamecxx . . $ std/__cxx11/basic_string#basic_string(925dcc5e17f50391).;
65
66 if (!part->cxx . . $ std/__shared_ptr_access#`operator->`(34d6acfd341ba7ab).activecxx . . $ IProfilePart#active(50ce9a9e25b4a850).() && base_cxx . . $ ProfileView#Initializer#base_..has_valuecxx . . $ std/optional#has_value(3482b152b9333168).()) { // compose from base_
67 partProfileName =cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75). base_cxx . . $ ProfileView#Initializer#base_.->cxx . . $ std/optional#`operator->`(258ee1c9e0a18a5c).getcxx . . $ std/reference_wrapper#get(d426bc7b625886b7).().namecxx . . $ IProfileView#name(f4fff0029955a25f).();
68
69 auto const &baseParts = base_cxx . . $ ProfileView#Initializer#base_.->cxx . . $ std/optional#`operator->`(258ee1c9e0a18a5c).getcxx . . $ std/reference_wrapper#get(d426bc7b625886b7).().partscxx . . $ IProfileView#parts(695fa8b7727f8f8b).();
70 auto const basePartIter = stdcxx . . $ std/::find_ifcxx . . $ std/find_if(f0a0a4f94ee5cb00).(
71 baseParts.cbegincxx . . $ std/vector#cbegin(d1e1699016b9d7e6).(), baseParts.cendcxx . . $ std/vector#cend(d1e1699016b9d7e6).(), [&](auto const &partView) {
72 return partView->part()->ID() == part->cxx . . $ std/__shared_ptr_access#`operator->`(34d6acfd341ba7ab).IDcxx . . $ Item#ID(f4fff0029955a25f).();
73 });
74 if (basePartIter != baseParts.cendcxx . . $ std/vector#cend(d1e1699016b9d7e6).())
75 profilePart =cxx . . $ std/shared_ptr#`operator=`(7563df7e21f73290). basePartIter->cxx . . $ __gnu_cxx/__normal_iterator#`operator->`(65c2ec7035a77d3e).getcxx . . $ std/unique_ptr#get(ea7391e9eeeaf20e).()->partcxx . . $ IProfilePartView#part(490d9295cd11a891).();
76 }
77 else {
78 partProfileName =cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75). dynamic_cast<IProfilecxx . . $ IProfile# const &>(i).infocxx . . $ IProfile#info(ad075d653bfbbbea).().namecxx . . $ IProfile#Info#name.;
79 profilePart =cxx . . $ std/shared_ptr#`operator=`(7563df7e21f73290). part;
80 }
81
82 profileView_cxx . . $ ProfileView#Initializer#profileView_..parts_cxx . . $ ProfileView#parts_..emplace_backcxx . . $ std/vector#emplace_back(a1bcdfdabc3a37df).(stdcxx . . $ std/::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<ProfilePartViewcxx . . $ ProfilePartView#>(
83 stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(partProfileName), stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(profilePart)));
84 }
85 }
86
87 return {cxx . . $ std/optional#optional(ced63f7c635d850d).};
88 }
89
90 void ProfileViewcxx . . $ ProfileView#::Initializercxx . . $ ProfileView#Initializer#::takeActivecxx . . $ ProfileView#Initializer#takeActive(b45ddcbc8423892c).(bool)
91 {
92 }
93
94 void ProfileViewcxx . . $ ProfileView#::Initializercxx . . $ ProfileView#Initializer#::takeInfocxx . . $ ProfileView#Initializer#takeInfo(7a3f345cc6258353).(IProfilecxx . . $ IProfile#::Infocxx . . $ IProfile#Info# const &)
95 {
96 }