Debian Codegraph @

src/core/profilemanager.cpp

raw symbols SCIP
1 // SPDX-License-Identifier: GPL-3.0-or-latercxx . . $ `<file>/src/core/profilemanager.cpp`/
2 // Copyright 2019 Juan Palacios <[email protected]>
3
4 #include "profilemanager.h"cxx . . $ `<file>/src/core/profilemanager.h`/
5
6 #include "core/isysmodel.h"cxx . . $ `<file>/src/core/isysmodel.h`/
7 #include "iprofile.h"cxx . . $ `<file>/src/core/iprofile.h`/
8 #include <algorithm>
9 #include <iterator>
10 #include <regex>
11 #include <spdlog/spdlog.h>
12 #include <utility>
13
14 ProfileManagercxx . . $ ProfileManager#::ProfileManagercxx . . $ ProfileManager#ProfileManager(89d18fb28252b489).(
15 stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<IProfilecxx . . $ IProfile#> &&defautlProfile,
16 stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<IProfileStoragecxx . . $ IProfileStorage#> &&profileStorage) noexcept
17 : defaultProfile_cxx . . $ ProfileManager#defaultProfile_.(stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(defautlProfile))
18 , profileStorage_cxx . . $ ProfileManager#profileStorage_.(stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(profileStorage))
19 {
20 }
21
22 void ProfileManagercxx . . $ ProfileManager#::addObservercxx . . $ ProfileManager#addObserver(bd1477ff1de9e2eb).(stdcxx . . $ std/::shared_ptrcxx . . $ std/shared_ptr#<IProfileManagercxx . . $ IProfileManager#::Observercxx . . $ IProfileManager#Observer#> observer)
23 {
24 stdcxx . . $ std/::lock_guardcxx . . $ std/lock_guard#<stdcxx . . $ std/::mutexcxx . . $ std/mutex#> lockcxx . . $ std/lock_guard#lock_guard(8e935d9c2e576e3a).(obMutex_cxx . . $ ProfileManager#obMutex_.);
25
26 auto const it = stdcxx . . $ std/::findcxx . . $ std/find(a92da12e15934614).(observers_cxx . . $ ProfileManager#observers_..begincxx . . $ std/vector#begin(55a6de06420d4903).(), observers_cxx . . $ ProfileManager#observers_..endcxx . . $ std/vector#end(55a6de06420d4903).(), observer);
27 if (it ==cxx . . $ __gnu_cxx/`operator==`(d2eded1addd76ab7). observers_cxx . . $ ProfileManager#observers_..endcxx . . $ std/vector#end(55a6de06420d4903).())
28 observers_cxx . . $ ProfileManager#observers_..emplace_backcxx . . $ std/vector#emplace_back(a1bcdfdabc3a37df).(stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(observer));
29 }
30
31 void ProfileManagercxx . . $ ProfileManager#::removeObservercxx . . $ ProfileManager#removeObserver(feeb623736561950).(
32 stdcxx . . $ std/::shared_ptrcxx . . $ std/shared_ptr#<IProfileManagercxx . . $ IProfileManager#::Observercxx . . $ IProfileManager#Observer#> const &observer)
33 {
34 stdcxx . . $ std/::lock_guardcxx . . $ std/lock_guard#<stdcxx . . $ std/::mutexcxx . . $ std/mutex#> lockcxx . . $ std/lock_guard#lock_guard(8e935d9c2e576e3a).(obMutex_cxx . . $ ProfileManager#obMutex_.);
35 stdcxx . . $ std/::erasecxx . . $ std/erase(d1155fb03f0860d).(observers_cxx . . $ ProfileManager#observers_., observer);
36 }
37
38 void ProfileManagercxx . . $ ProfileManager#::initcxx . . $ ProfileManager#init(2ffe4369e6bd4764).(ISysModelcxx . . $ ISysModel# const &model)
39 {
40 // initialize default profile
41 model.exportWithcxx . . $ Exportable#exportWith(5b5c94ff60635419).(*cxx . . $ std/unique_ptr#`operator*`(2fbe4a4c783c152d).defaultProfile_cxx . . $ ProfileManager#defaultProfile_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).initializercxx . . $ IProfile#initializer(6b4e1016740e578).());
42
43 profileStorage_cxx . . $ ProfileManager#profileStorage_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).initcxx . . $ IProfileStorage#init(6c259bdacab5687).(*cxx . . $ std/unique_ptr#`operator*`(2fbe4a4c783c152d).defaultProfile_cxx . . $ ProfileManager#defaultProfile_.);
44
45 stdcxx . . $ std/::regexcxx . . $ std/__cxx11/regex# const invalidNamecxx . . $ std/__cxx11/basic_regex#basic_regex(d1adbc785ae219ab).(R"(^\s+$)");
46 stdcxx . . $ std/::regexcxx . . $ std/__cxx11/regex# const invalidExecxx . . $ std/__cxx11/basic_regex#basic_regex(d1adbc785ae219ab).(R"(\\\|\/|\||\x00|\*|`|;|:|'|")");
47 stdcxx . . $ std/::unordered_setcxx . . $ std/unordered_set#<stdcxx . . $ std/::stringcxx . . $ std/string#> exescxx . . $ std/unordered_set#unordered_set(49f6e7a06ebc5aa8).;
48
49 bool globalFound = false;
50
51 auto profiles = profileStorage_cxx . . $ ProfileManager#profileStorage_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).profilescxx . . $ IProfileStorage#profiles(61ed034afd0cae0).(*cxx . . $ std/unique_ptr#`operator*`(2fbe4a4c783c152d).defaultProfile_cxx . . $ ProfileManager#defaultProfile_.);
52 for (auto &profile : profiles) {
53 auto &info = profile->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).infocxx . . $ IProfile#info(ad075d653bfbbbea).();
54
55 if (info.execxx . . $ IProfile#Info#exe. == IProfilecxx . . $ std/basic_string_view#basic_string_view(b419d9def655ef02).::Infocxx . . $ IProfile#Info#::GlobalIDcxx . . $ IProfile#Info#GlobalID.) {
56
57 auto overrideInfo = info;
58 overrideInfo.namecxx . . $ IProfile#Info#name. =cxx . . $ std/__cxx11/basic_string#`operator=`(d07e3dd77f70328a). IProfilecxx . . $ IProfile#::Infocxx . . $ IProfile#Info#::GlobalIDcxx . . $ IProfile#Info#GlobalID.;
59 overrideInfo.iconURLcxx . . $ IProfile#Info#iconURL. =cxx . . $ std/__cxx11/basic_string#`operator=`(d07e3dd77f70328a). IProfilecxx . . $ IProfile#::Infocxx . . $ IProfile#Info#::GlobalIconURLcxx . . $ IProfile#Info#GlobalIconURL.;
60 profile->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).infocxx . . $ IProfile#info(7a3f345cc6258353).(overrideInfo);
61
62 globalFound = true;
63 }
64
65 if (!globalFound && info.namecxx . . $ IProfile#Info#name. == IProfilecxx . . $ std/basic_string_view#basic_string_view(b419d9def655ef02).::Infocxx . . $ IProfile#Info#::GlobalIDcxx . . $ IProfile#Info#GlobalID.) {
66 SPDLOG_WARNcxx . . $ `<external>/13613935168682455490/spdlog.h:329:13`!("Ignoring profile with name: '{}', exe: '{}'", info.name,
67 info.exe);
68 SPDLOG_WARNcxx . . $ `<external>/13613935168682455490/spdlog.h:329:13`!("Used profile name ({}) is reserved for the Global Profile",
69 info.name);
70 continue;
71 }
72
73 if (!globalFound && info.execxx . . $ IProfile#Info#exe. == IProfilecxx . . $ std/basic_string_view#basic_string_view(b419d9def655ef02).::Infocxx . . $ IProfile#Info#::GlobalIDcxx . . $ IProfile#Info#GlobalID.) {
74 SPDLOG_WARNcxx . . $ `<external>/13613935168682455490/spdlog.h:329:13`!("Ignoring profile with name: '{}', exe: '{}'", info.name,
75 info.exe);
76 SPDLOG_WARNcxx . . $ `<external>/13613935168682455490/spdlog.h:329:13`!("Used profile executable name ({}) is "
77 "reserved for the Global Profile",
78 info.exe);
79 continue;
80 }
81
82 if (stdcxx . . $ std/::regex_searchcxx . . $ std/regex_search(dbfa5bd607d7b136).(info.namecxx . . $ IProfile#Info#name., invalidName)) {
83 SPDLOG_WARNcxx . . $ `<external>/13613935168682455490/spdlog.h:329:13`!("Ignoring profile with name: '{}', exe: '{}'", info.name,
84 info.exe);
85 SPDLOG_WARNcxx . . $ `<external>/13613935168682455490/spdlog.h:329:13`!("Profile name ({}) has invalid characters", info.name);
86 continue;
87 }
88
89 auto profileIt = profiles_cxx . . $ ProfileManager#profiles_..findcxx . . $ std/unordered_map#find(f711f2f81556fe93).(info.namecxx . . $ IProfile#Info#name.);
90 if (profileIt != profiles_cxx . . $ ProfileManager#profiles_..cendcxx . . $ std/unordered_map#cend(f3c6e12ee1fe7252).()) {
91 SPDLOG_WARNcxx . . $ `<external>/13613935168682455490/spdlog.h:329:13`!("Ignoring profile with name: '{}', exe: '{}'", info.name,
92 info.exe);
93 SPDLOG_WARNcxx . . $ `<external>/13613935168682455490/spdlog.h:329:13`!("There is another profile with the same name ({})", info.name);
94 continue;
95 }
96
97 if (info.execxx . . $ IProfile#Info#exe. != IProfilecxx . . $ std/basic_string_view#basic_string_view(b419d9def655ef02).::Infocxx . . $ IProfile#Info#::ManualIDcxx . . $ IProfile#Info#ManualID.) {
98 if (stdcxx . . $ std/::regex_searchcxx . . $ std/regex_search(dbfa5bd607d7b136).(info.execxx . . $ IProfile#Info#exe., invalidExe)) {
99 SPDLOG_WARNcxx . . $ `<external>/13613935168682455490/spdlog.h:329:13`!("Ignoring profile with name: '{}', exe: '{}'", info.name,
100 info.exe);
101 SPDLOG_WARNcxx . . $ `<external>/13613935168682455490/spdlog.h:329:13`!("Profile executable name ({}) has invalid characters",
102 info.exe);
103 continue;
104 }
105
106 auto exeIt = exes.findcxx . . $ std/unordered_set#find(2e5c193be73a443f).(info.execxx . . $ IProfile#Info#exe.);
107 if (exeIt != exes.cendcxx . . $ std/unordered_set#cend(7a57a589ec8e050).()) {
108 SPDLOG_WARNcxx . . $ `<external>/13613935168682455490/spdlog.h:329:13`!("Ignoring profile with name: '{}', exe: '{}'", info.name,
109 info.exe);
110 SPDLOG_WARNcxx . . $ `<external>/13613935168682455490/spdlog.h:329:13`!("There is another profile for the same executable ({})",
111 info.exe);
112 continue;
113 }
114
115 exes.insertcxx . . $ std/unordered_set#insert(5b290ec90abd2511).(info.execxx . . $ IProfile#Info#exe.);
116 }
117
118 profiles_cxx . . $ ProfileManager#profiles_..emplacecxx . . $ std/unordered_map#emplace(8e800962ae7274b6).(info.namecxx . . $ IProfile#Info#name., stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(profile));
119 }
120
121 if (!globalFound) {
122 auto globalProfile = defaultProfile_cxx . . $ ProfileManager#defaultProfile_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).clonecxx . . $ IProfile#clone(f422f8feab2476b6).();
123 globalProfile->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).infocxx . . $ IProfile#info(7a3f345cc6258353).({cxx . . $ IProfile#Info#Info(b078d394f433f1d4).stdcxx . . $ std/::stringcxx . . $ std/string#(IProfilecxx . . $ IProfile#::Infocxx . . $ IProfile#Info#::GlobalIDcxx . . $ IProfile#Info#GlobalID.),
124 stdcxx . . $ std/::stringcxx . . $ std/string#(IProfilecxx . . $ IProfile#::Infocxx . . $ IProfile#Info#::GlobalIDcxx . . $ IProfile#Info#GlobalID.),
125 stdcxx . . $ std/::stringcxx . . $ std/string#(IProfilecxx . . $ IProfile#::Infocxx . . $ IProfile#Info#::GlobalIconURLcxx . . $ IProfile#Info#GlobalIconURL.)});
126
127 profileStorage_cxx . . $ ProfileManager#profileStorage_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).savecxx . . $ IProfileStorage#save(65662de94ba945c4).(*cxx . . $ std/unique_ptr#`operator*`(2fbe4a4c783c152d).globalProfile);
128 profiles_cxx . . $ ProfileManager#profiles_..emplacecxx . . $ std/unordered_map#emplace(8e800962ae7274b6).(globalProfile->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).infocxx . . $ IProfile#info(ad075d653bfbbbea).().namecxx . . $ IProfile#Info#name., stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(globalProfile));
129 }
130 }
131
132 stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> ProfileManagercxx . . $ ProfileManager#::profilescxx . . $ ProfileManager#profiles(491c255a7e496038).() const
133 {
134 stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> profilescxx . . $ std/vector#vector(49f6e7a06ebc5aa8).;
135 profiles.reservecxx . . $ std/vector#reserve(2c44cd906ae4e829).(profiles_cxx . . $ ProfileManager#profiles_..sizecxx . . $ std/unordered_map#size(fe713de6d184c8a).());
136 stdcxx . . $ std/::transformcxx . . $ std/transform(da30451c4a040264).(profiles_cxx . . $ ProfileManager#profiles_..cbegincxx . . $ std/unordered_map#cbegin(f3c6e12ee1fe7252).(), profiles_cxx . . $ ProfileManager#profiles_..cendcxx . . $ std/unordered_map#cend(f3c6e12ee1fe7252).(),
137 stdcxx . . $ std/::back_insertercxx . . $ std/back_inserter(7b559d6bdd90ff74).(profiles),
138 [](auto const &kv) { return kv.first; });
139 return profilescxx . . $ std/vector#vector(6f559d22b039ccdb).;
140 }
141
142 stdcxx . . $ std/::optionalcxx . . $ std/optional#<stdcxx . . $ std/::reference_wrappercxx . . $ std/reference_wrapper#<IProfilecxx . . $ IProfile# const>>
143 ProfileManagercxx . . $ ProfileManager#::profilecxx . . $ ProfileManager#profile(f84880c9a777ebac).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName) const
144 {
145 auto const profileIt = profiles_cxx . . $ ProfileManager#profiles_..findcxx . . $ std/unordered_map#find(f39fe4bedfa7a693).(profileName);
146 if (profileIt != profiles_cxx . . $ ProfileManager#profiles_..cendcxx . . $ std/unordered_map#cend(f3c6e12ee1fe7252).())
147 return *cxx . . $ std/optional#optional(e3f0d6382bd52f24).profileIt->cxx . . $ std/__detail/_Node_const_iterator#`operator->`(8e614c7de0b1573e).secondcxx . . $ std/pair#second.;
148
149 return {cxx . . $ std/optional#optional(ced63f7c635d850d).};
150 }
151
152 stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> ProfileManagercxx . . $ ProfileManager#::unsavedProfilescxx . . $ ProfileManager#unsavedProfiles(491c255a7e496038).() const
153 {
154 stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> profilescxx . . $ std/vector#vector(49f6e7a06ebc5aa8).;
155 profiles.reservecxx . . $ std/vector#reserve(2c44cd906ae4e829).(unsavedProfiles_cxx . . $ ProfileManager#unsavedProfiles_..sizecxx . . $ std/unordered_set#size(c4d951d2b543e611).());
156 stdcxx . . $ std/::transformcxx . . $ std/transform(da30451c4a040264).(unsavedProfiles_cxx . . $ ProfileManager#unsavedProfiles_..cbegincxx . . $ std/unordered_set#cbegin(7a57a589ec8e050).(), unsavedProfiles_cxx . . $ ProfileManager#unsavedProfiles_..cendcxx . . $ std/unordered_set#cend(7a57a589ec8e050).(),
157 stdcxx . . $ std/::back_insertercxx . . $ std/back_inserter(7b559d6bdd90ff74).(profiles),
158 [](auto const &profile) { return profile; });
159 return profilescxx . . $ std/vector#vector(6f559d22b039ccdb).;
160 }
161
162 bool ProfileManagercxx . . $ ProfileManager#::unsavedcxx . . $ ProfileManager#unsaved(13a55b95a0133754).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName) const
163 {
164 return unsavedProfiles_cxx . . $ ProfileManager#unsavedProfiles_..findcxx . . $ std/unordered_set#find(697f64809fa01b2a).(profileName) != unsavedProfiles_cxx . . $ ProfileManager#unsavedProfiles_..cendcxx . . $ std/unordered_set#cend(7a57a589ec8e050).();
165 }
166
167 void ProfileManagercxx . . $ ProfileManager#::addcxx . . $ ProfileManager#add(7a3f345cc6258353).(IProfilecxx . . $ IProfile#::Infocxx . . $ IProfile#Info# const &info)
168 {
169 auto const profileIt = profiles_cxx . . $ ProfileManager#profiles_..findcxx . . $ std/unordered_map#find(f711f2f81556fe93).(info.namecxx . . $ IProfile#Info#name.);
170 if (profileIt == profiles_cxx . . $ ProfileManager#profiles_..cendcxx . . $ std/unordered_map#cend(f3c6e12ee1fe7252).()) {
171 auto newProfile = defaultProfile_cxx . . $ ProfileManager#defaultProfile_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).clonecxx . . $ IProfile#clone(f422f8feab2476b6).();
172 newProfile->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).infocxx . . $ IProfile#info(7a3f345cc6258353).(info);
173 profileStorage_cxx . . $ ProfileManager#profileStorage_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).savecxx . . $ IProfileStorage#save(65662de94ba945c4).(*cxx . . $ std/unique_ptr#`operator*`(2fbe4a4c783c152d).newProfile);
174 profiles_cxx . . $ ProfileManager#profiles_..emplacecxx . . $ std/unordered_map#emplace(8e800962ae7274b6).(info.namecxx . . $ IProfile#Info#name., stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(newProfile));
175
176 notifyProfileAddedcxx . . $ ProfileManager#notifyProfileAdded(9c546c94e5fcce4e).(info.namecxx . . $ IProfile#Info#name.);
177 }
178 }
179
180 void ProfileManagercxx . . $ ProfileManager#::clonecxx . . $ ProfileManager#clone(7d57608c21e2500c).(IProfilecxx . . $ IProfile#::Infocxx . . $ IProfile#Info# const &cloneInfo,
181 stdcxx . . $ std/::stringcxx . . $ std/string# const &baseProfileName)
182 {
183 auto const profileIt = profiles_cxx . . $ ProfileManager#profiles_..findcxx . . $ std/unordered_map#find(f711f2f81556fe93).(baseProfileName);
184 if (profileIt != profiles_cxx . . $ ProfileManager#profiles_..cendcxx . . $ std/unordered_map#cend(f3c6e12ee1fe7252).()) {
185
186 auto const clonedProfileIt = profiles_cxx . . $ ProfileManager#profiles_..findcxx . . $ std/unordered_map#find(f711f2f81556fe93).(cloneInfo.namecxx . . $ IProfile#Info#name.);
187 if (clonedProfileIt == profiles_cxx . . $ ProfileManager#profiles_..cendcxx . . $ std/unordered_map#cend(f3c6e12ee1fe7252).()) {
188 auto clone = profileIt->cxx . . $ std/__detail/_Node_iterator#`operator->`(35610babf8706b50).secondcxx . . $ std/pair#second.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).clonecxx . . $ IProfile#clone(f422f8feab2476b6).();
189 clone->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).infocxx . . $ IProfile#info(7a3f345cc6258353).(cloneInfo);
190
191 // manual profiles are always active
192 if (cloneInfo.execxx . . $ IProfile#Info#exe. == IProfilecxx . . $ std/basic_string_view#basic_string_view(b419d9def655ef02).::Infocxx . . $ IProfile#Info#::ManualIDcxx . . $ IProfile#Info#ManualID.)
193 clone->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).activatecxx . . $ IProfile#activate(b45ddcbc8423892c).(true);
194
195 profileStorage_cxx . . $ ProfileManager#profileStorage_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).savecxx . . $ IProfileStorage#save(65662de94ba945c4).(*cxx . . $ std/unique_ptr#`operator*`(2fbe4a4c783c152d).clone);
196 profiles_cxx . . $ ProfileManager#profiles_..emplacecxx . . $ std/unordered_map#emplace(8e800962ae7274b6).(cloneInfo.namecxx . . $ IProfile#Info#name., stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(clone));
197
198 notifyProfileAddedcxx . . $ ProfileManager#notifyProfileAdded(9c546c94e5fcce4e).(cloneInfo.namecxx . . $ IProfile#Info#name.);
199 }
200 }
201 }
202
203 void ProfileManagercxx . . $ ProfileManager#::removecxx . . $ ProfileManager#remove(9c546c94e5fcce4e).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName)
204 {
205 auto const profileIt = profiles_cxx . . $ ProfileManager#profiles_..findcxx . . $ std/unordered_map#find(f711f2f81556fe93).(profileName);
206 if (profileIt != profiles_cxx . . $ ProfileManager#profiles_..cendcxx . . $ std/unordered_map#cend(f3c6e12ee1fe7252).()) {
207 auto info = profileIt->cxx . . $ std/__detail/_Node_iterator#`operator->`(35610babf8706b50).secondcxx . . $ std/pair#second.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).infocxx . . $ IProfile#info(ad075d653bfbbbea).();
208 profileStorage_cxx . . $ ProfileManager#profileStorage_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).removecxx . . $ IProfileStorage#remove(874cae2a8ac0280d).(info);
209 profiles_cxx . . $ ProfileManager#profiles_..erasecxx . . $ std/unordered_map#erase(d465664efb4c2d93).(profileIt);
210
211 notifyProfileRemovedcxx . . $ ProfileManager#notifyProfileRemoved(9c546c94e5fcce4e).(profileName);
212 }
213 }
214
215 void ProfileManagercxx . . $ ProfileManager#::activatecxx . . $ ProfileManager#activate(a3b17e0268c60856).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName, bool active)
216 {
217 auto const profileIt = profiles_cxx . . $ ProfileManager#profiles_..findcxx . . $ std/unordered_map#find(f711f2f81556fe93).(profileName);
218 if (profileIt != profiles_cxx . . $ ProfileManager#profiles_..cendcxx . . $ std/unordered_map#cend(f3c6e12ee1fe7252).()) {
219 auto &profile = profileIt->cxx . . $ std/__detail/_Node_iterator#`operator->`(35610babf8706b50).secondcxx . . $ std/pair#second.;
220
221 // update stored profile active state
222 auto storedProfile = profile->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).clonecxx . . $ IProfile#clone(f422f8feab2476b6).();
223 profileStorage_cxx . . $ ProfileManager#profileStorage_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).loadcxx . . $ IProfileStorage#load(65662de94ba945c4).(*cxx . . $ std/unique_ptr#`operator*`(2fbe4a4c783c152d).storedProfile);
224 storedProfile->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).activatecxx . . $ IProfile#activate(b45ddcbc8423892c).(active);
225 profileStorage_cxx . . $ ProfileManager#profileStorage_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).savecxx . . $ IProfileStorage#save(65662de94ba945c4).(*cxx . . $ std/unique_ptr#`operator*`(2fbe4a4c783c152d).storedProfile);
226
227 // update profile active state
228 profile->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).activatecxx . . $ IProfile#activate(b45ddcbc8423892c).(active);
229
230 notifyProfileActiveChangedcxx . . $ ProfileManager#notifyProfileActiveChanged(a3b17e0268c60856).(profileName, active);
231 }
232 }
233
234 void ProfileManagercxx . . $ ProfileManager#::resetcxx . . $ ProfileManager#reset(9c546c94e5fcce4e).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName)
235 {
236 auto const profileIt = profiles_cxx . . $ ProfileManager#profiles_..findcxx . . $ std/unordered_map#find(f711f2f81556fe93).(profileName);
237 if (profileIt != profiles_cxx . . $ ProfileManager#profiles_..cendcxx . . $ std/unordered_map#cend(f3c6e12ee1fe7252).()) {
238 auto resetedProfile = defaultProfile_cxx . . $ ProfileManager#defaultProfile_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).clonecxx . . $ IProfile#clone(f422f8feab2476b6).();
239 resetedProfile->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).infocxx . . $ IProfile#info(7a3f345cc6258353).(profileIt->cxx . . $ std/__detail/_Node_iterator#`operator->`(35610babf8706b50).secondcxx . . $ std/pair#second.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).infocxx . . $ IProfile#info(ad075d653bfbbbea).());
240 resetedProfile->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).activatecxx . . $ IProfile#activate(b45ddcbc8423892c).(profileIt->cxx . . $ std/__detail/_Node_iterator#`operator->`(35610babf8706b50).secondcxx . . $ std/pair#second.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).activecxx . . $ IProfile#active(50ce9a9e25b4a850).());
241 profiles_cxx . . $ ProfileManager#profiles_..insert_or_assigncxx . . $ std/unordered_map#insert_or_assign(66ad74eb3b6b25b6).(profileName, stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(resetedProfile));
242 unsavedProfiles_cxx . . $ ProfileManager#unsavedProfiles_..insertcxx . . $ std/unordered_set#insert(5b290ec90abd2511).(profileName);
243
244 notifyProfileChangedcxx . . $ ProfileManager#notifyProfileChanged(9c546c94e5fcce4e).(profileName);
245 }
246 }
247
248 void ProfileManagercxx . . $ ProfileManager#::restorecxx . . $ ProfileManager#restore(9c546c94e5fcce4e).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName)
249 {
250 auto const profileIt = profiles_cxx . . $ ProfileManager#profiles_..findcxx . . $ std/unordered_map#find(f711f2f81556fe93).(profileName);
251 if (profileIt != profiles_cxx . . $ ProfileManager#profiles_..cendcxx . . $ std/unordered_map#cend(f3c6e12ee1fe7252).()) {
252 profileStorage_cxx . . $ ProfileManager#profileStorage_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).loadcxx . . $ IProfileStorage#load(65662de94ba945c4).(*cxx . . $ std/unique_ptr#`operator*`(2fbe4a4c783c152d).profileIt->cxx . . $ std/__detail/_Node_iterator#`operator->`(35610babf8706b50).secondcxx . . $ std/pair#second.);
253 unsavedProfiles_cxx . . $ ProfileManager#unsavedProfiles_..erasecxx . . $ std/unordered_set#erase(f66b949186d0ad34).(profileName);
254
255 notifyProfileChangedcxx . . $ ProfileManager#notifyProfileChanged(9c546c94e5fcce4e).(profileName);
256 }
257 }
258
259 void ProfileManagercxx . . $ ProfileManager#::updatecxx . . $ ProfileManager#update(eb2b9ce3c3c58e35).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName,
260 IProfilecxx . . $ IProfile#::Infocxx . . $ IProfile#Info# const &newInfo)
261 {
262 auto const profileIt = profiles_cxx . . $ ProfileManager#profiles_..findcxx . . $ std/unordered_map#find(f711f2f81556fe93).(profileName);
263 if (profileIt != profiles_cxx . . $ ProfileManager#profiles_..cendcxx . . $ std/unordered_map#cend(f3c6e12ee1fe7252).()) {
264 auto &profile = *cxx . . $ std/unique_ptr#`operator*`(2fbe4a4c783c152d).profileIt->cxx . . $ std/__detail/_Node_iterator#`operator->`(35610babf8706b50).secondcxx . . $ std/pair#second.;
265 auto oldInfo = profile.infocxx . . $ IProfile#info(ad075d653bfbbbea).();
266
267 auto info = newInfo;
268 profileStorage_cxx . . $ ProfileManager#profileStorage_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).updatecxx . . $ IProfileStorage#update(55d4602e6608d94e).(profile, info);
269
270 // update profile info
271 profile.infocxx . . $ IProfile#info(7a3f345cc6258353).(info);
272 if (info.namecxx . . $ IProfile#Info#name. != profileName) {
273 // re-inserting element with the new name as key
274 auto profileNodeHandler = profiles_cxx . . $ ProfileManager#profiles_..extractcxx . . $ std/unordered_map#extract(649c4b85c5a60913).(profileItcxx . . $ std/__detail/_Node_const_iterator#_Node_const_iterator(fb4965188b6b68b9).);
275 profileNodeHandler.keycxx . . $ std/_Node_handle#key(d426bc7b625886b7).() =cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75). info.namecxx . . $ IProfile#Info#name.;
276 profiles_cxx . . $ ProfileManager#profiles_..insertcxx . . $ std/unordered_map#insert(488bbb178d948588).(stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(profileNodeHandler));
277
278 // updating unsaved profile name
279 auto unsavedIt = unsavedProfiles_cxx . . $ ProfileManager#unsavedProfiles_..findcxx . . $ std/unordered_set#find(2e5c193be73a443f).(profileName);
280 if (unsavedIt != unsavedProfiles_cxx . . $ ProfileManager#unsavedProfiles_..cendcxx . . $ std/unordered_set#cend(7a57a589ec8e050).()) {
281 unsavedProfiles_cxx . . $ ProfileManager#unsavedProfiles_..erasecxx . . $ std/unordered_set#erase(2ba184fb64cda514).(unsavedIt);
282 unsavedProfiles_cxx . . $ ProfileManager#unsavedProfiles_..insertcxx . . $ std/unordered_set#insert(5b290ec90abd2511).(info.namecxx . . $ IProfile#Info#name.);
283 }
284 }
285 notifyProfileInfoChangedcxx . . $ ProfileManager#notifyProfileInfoChanged(1acf29b044426ccc).(oldInfo, info);
286
287 // manual profiles are always active
288 if (info.execxx . . $ IProfile#Info#exe. == IProfilecxx . . $ std/basic_string_view#basic_string_view(b419d9def655ef02).::Infocxx . . $ IProfile#Info#::ManualIDcxx . . $ IProfile#Info#ManualID. && !profile.activecxx . . $ IProfile#active(50ce9a9e25b4a850).()) {
289 profile.activatecxx . . $ IProfile#activate(b45ddcbc8423892c).(true);
290 notifyProfileActiveChangedcxx . . $ ProfileManager#notifyProfileActiveChanged(a3b17e0268c60856).(info.namecxx . . $ IProfile#Info#name., true);
291 }
292 }
293 }
294
295 void ProfileManagercxx . . $ ProfileManager#::updatecxx . . $ ProfileManager#update(1a91c228bd4123e9).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName,
296 Importablecxx . . $ Importable#::Importercxx . . $ Importable#Importer# &importer)
297 {
298 auto const profileIt = profiles_cxx . . $ ProfileManager#profiles_..findcxx . . $ std/unordered_map#find(f711f2f81556fe93).(profileName);
299 if (profileIt != profiles_cxx . . $ ProfileManager#profiles_..cendcxx . . $ std/unordered_map#cend(f3c6e12ee1fe7252).()) {
300 profileIt->cxx . . $ std/__detail/_Node_iterator#`operator->`(35610babf8706b50).secondcxx . . $ std/pair#second.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).importWithcxx . . $ Importable#importWith(94eddebf9440278).(importer);
301 unsavedProfiles_cxx . . $ ProfileManager#unsavedProfiles_..insertcxx . . $ std/unordered_set#insert(5b290ec90abd2511).(profileName);
302
303 notifyProfileChangedcxx . . $ ProfileManager#notifyProfileChanged(9c546c94e5fcce4e).(profileName);
304 }
305 }
306
307 bool ProfileManagercxx . . $ ProfileManager#::loadFromcxx . . $ ProfileManager#loadFrom(19973e5c5433fa0c).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName,
308 stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::pathcxx . . $ std/filesystem/__cxx11/path# const &path)
309 {
310 auto const profileIt = profiles_cxx . . $ ProfileManager#profiles_..findcxx . . $ std/unordered_map#find(f711f2f81556fe93).(profileName);
311 if (profileIt != profiles_cxx . . $ ProfileManager#profiles_..cendcxx . . $ std/unordered_map#cend(f3c6e12ee1fe7252).()) {
312 auto &profile = *cxx . . $ std/unique_ptr#`operator*`(2fbe4a4c783c152d).profileIt->cxx . . $ std/__detail/_Node_iterator#`operator->`(35610babf8706b50).secondcxx . . $ std/pair#second.;
313
314 auto info = profile.infocxx . . $ IProfile#info(ad075d653bfbbbea).();
315 auto active = profile.activecxx . . $ IProfile#active(50ce9a9e25b4a850).();
316
317 if (!profileStorage_cxx . . $ ProfileManager#profileStorage_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).loadFromcxx . . $ IProfileStorage#loadFrom(e6dc3a67757fd1b5).(profile, path))
318 return false;
319
320 profile.activatecxx . . $ IProfile#activate(b45ddcbc8423892c).(active);
321 profile.infocxx . . $ IProfile#info(7a3f345cc6258353).(info);
322
323 unsavedProfiles_cxx . . $ ProfileManager#unsavedProfiles_..insertcxx . . $ std/unordered_set#insert(5b290ec90abd2511).(profileName);
324 notifyProfileChangedcxx . . $ ProfileManager#notifyProfileChanged(9c546c94e5fcce4e).(profileName);
325
326 return true;
327 }
328
329 return false;
330 }
331
332 void ProfileManagercxx . . $ ProfileManager#::savecxx . . $ ProfileManager#save(9c546c94e5fcce4e).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName)
333 {
334 auto const profileIt = profiles_cxx . . $ ProfileManager#profiles_..findcxx . . $ std/unordered_map#find(f711f2f81556fe93).(profileName);
335 if (profileIt != profiles_cxx . . $ ProfileManager#profiles_..cendcxx . . $ std/unordered_map#cend(f3c6e12ee1fe7252).()) {
336 profileStorage_cxx . . $ ProfileManager#profileStorage_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).savecxx . . $ IProfileStorage#save(65662de94ba945c4).(*cxx . . $ std/unique_ptr#`operator*`(2fbe4a4c783c152d).profileIt->cxx . . $ std/__detail/_Node_iterator#`operator->`(35610babf8706b50).secondcxx . . $ std/pair#second.);
337 unsavedProfiles_cxx . . $ ProfileManager#unsavedProfiles_..erasecxx . . $ std/unordered_set#erase(f66b949186d0ad34).(profileName);
338
339 notifyProfileSavedcxx . . $ ProfileManager#notifyProfileSaved(9c546c94e5fcce4e).(profileName);
340 }
341 }
342
343 bool ProfileManagercxx . . $ ProfileManager#::exportTocxx . . $ ProfileManager#exportTo(19973e5c5433fa0c).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName,
344 stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::pathcxx . . $ std/filesystem/__cxx11/path# const &path)
345 {
346 auto const profileIt = profiles_cxx . . $ ProfileManager#profiles_..findcxx . . $ std/unordered_map#find(f711f2f81556fe93).(profileName);
347 if (profileIt != profiles_cxx . . $ ProfileManager#profiles_..cendcxx . . $ std/unordered_map#cend(f3c6e12ee1fe7252).())
348 return profileStorage_cxx . . $ ProfileManager#profileStorage_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).exportTocxx . . $ IProfileStorage#exportTo(58603e3286cb501).(*cxx . . $ std/unique_ptr#`operator*`(2fbe4a4c783c152d).profileIt->cxx . . $ std/__detail/_Node_iterator#`operator->`(35610babf8706b50).secondcxx . . $ std/pair#second., path);
349
350 return false;
351 }
352
353 void ProfileManagercxx . . $ ProfileManager#::notifyProfileAddedcxx . . $ ProfileManager#notifyProfileAdded(9c546c94e5fcce4e).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName)
354 {
355 stdcxx . . $ std/::lock_guardcxx . . $ std/lock_guard#<stdcxx . . $ std/::mutexcxx . . $ std/mutex#> lockcxx . . $ std/lock_guard#lock_guard(8e935d9c2e576e3a).(obMutex_cxx . . $ ProfileManager#obMutex_.);
356 for (auto &o : observers_cxx . . $ ProfileManager#observers_.)
357 o->cxx . . $ std/__shared_ptr_access#`operator->`(34d6acfd341ba7ab).profileAddedcxx . . $ IProfileManager#Observer#profileAdded(9c546c94e5fcce4e).(profileName);
358 }
359
360 void ProfileManagercxx . . $ ProfileManager#::notifyProfileRemovedcxx . . $ ProfileManager#notifyProfileRemoved(9c546c94e5fcce4e).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName)
361 {
362 stdcxx . . $ std/::lock_guardcxx . . $ std/lock_guard#<stdcxx . . $ std/::mutexcxx . . $ std/mutex#> lockcxx . . $ std/lock_guard#lock_guard(8e935d9c2e576e3a).(obMutex_cxx . . $ ProfileManager#obMutex_.);
363 for (auto &o : observers_cxx . . $ ProfileManager#observers_.)
364 o->cxx . . $ std/__shared_ptr_access#`operator->`(34d6acfd341ba7ab).profileRemovedcxx . . $ IProfileManager#Observer#profileRemoved(9c546c94e5fcce4e).(profileName);
365 }
366
367 void ProfileManagercxx . . $ ProfileManager#::notifyProfileChangedcxx . . $ ProfileManager#notifyProfileChanged(9c546c94e5fcce4e).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName)
368 {
369 stdcxx . . $ std/::lock_guardcxx . . $ std/lock_guard#<stdcxx . . $ std/::mutexcxx . . $ std/mutex#> lockcxx . . $ std/lock_guard#lock_guard(8e935d9c2e576e3a).(obMutex_cxx . . $ ProfileManager#obMutex_.);
370 for (auto &o : observers_cxx . . $ ProfileManager#observers_.)
371 o->cxx . . $ std/__shared_ptr_access#`operator->`(34d6acfd341ba7ab).profileChangedcxx . . $ IProfileManager#Observer#profileChanged(9c546c94e5fcce4e).(profileName);
372 }
373
374 void ProfileManagercxx . . $ ProfileManager#::notifyProfileActiveChangedcxx . . $ ProfileManager#notifyProfileActiveChanged(a3b17e0268c60856).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName,
375 bool active)
376 {
377 stdcxx . . $ std/::lock_guardcxx . . $ std/lock_guard#<stdcxx . . $ std/::mutexcxx . . $ std/mutex#> lockcxx . . $ std/lock_guard#lock_guard(8e935d9c2e576e3a).(obMutex_cxx . . $ ProfileManager#obMutex_.);
378 for (auto &o : observers_cxx . . $ ProfileManager#observers_.)
379 o->cxx . . $ std/__shared_ptr_access#`operator->`(34d6acfd341ba7ab).profileActiveChangedcxx . . $ IProfileManager#Observer#profileActiveChanged(a3b17e0268c60856).(profileName, active);
380 }
381
382 void ProfileManagercxx . . $ ProfileManager#::notifyProfileSavedcxx . . $ ProfileManager#notifyProfileSaved(9c546c94e5fcce4e).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName)
383 {
384 stdcxx . . $ std/::lock_guardcxx . . $ std/lock_guard#<stdcxx . . $ std/::mutexcxx . . $ std/mutex#> lockcxx . . $ std/lock_guard#lock_guard(8e935d9c2e576e3a).(obMutex_cxx . . $ ProfileManager#obMutex_.);
385 for (auto &o : observers_cxx . . $ ProfileManager#observers_.)
386 o->cxx . . $ std/__shared_ptr_access#`operator->`(34d6acfd341ba7ab).profileSavedcxx . . $ IProfileManager#Observer#profileSaved(9c546c94e5fcce4e).(profileName);
387 }
388
389 void ProfileManagercxx . . $ ProfileManager#::notifyProfileInfoChangedcxx . . $ ProfileManager#notifyProfileInfoChanged(1acf29b044426ccc).(IProfilecxx . . $ IProfile#::Infocxx . . $ IProfile#Info# const &oldInfo,
390 IProfilecxx . . $ IProfile#::Infocxx . . $ IProfile#Info# const &newInfo)
391 {
392 stdcxx . . $ std/::lock_guardcxx . . $ std/lock_guard#<stdcxx . . $ std/::mutexcxx . . $ std/mutex#> lockcxx . . $ std/lock_guard#lock_guard(8e935d9c2e576e3a).(obMutex_cxx . . $ ProfileManager#obMutex_.);
393 for (auto &o : observers_cxx . . $ ProfileManager#observers_.)
394 o->cxx . . $ std/__shared_ptr_access#`operator->`(34d6acfd341ba7ab).profileInfoChangedcxx . . $ IProfileManager#Observer#profileInfoChanged(1acf29b044426ccc).(oldInfo, newInfo);
395 }