MCPcopy Create free account
hub / github.com/bluescan/tacentview / Load

Method Load

Src/Config.cpp:138–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136
137
138void Config::Load(const tString& filename)
139{
140 if (!tSystem::tFileExists(filename))
141 {
142 Global.Reset();
143 ResetAllProfiles();
144 Current = &MainProfile;
145 tFileDialog::Reset();
146 return;
147 }
148
149 bool loadedGlobal = false;
150 bool loadedMainProfile = false;
151 bool loadedBasicProfile = false;
152 bool loadedKioskProfile = false;
153 bool loadedAltProfile = false;
154 bool loadedFileDialog = false;
155 tExprReader reader(filename);
156 for (tExpr e = reader.First(); e.IsValid(); e = e.Next())
157 {
158 switch (e.Item0().Hash())
159 {
160 case tHash::tHashCT("Global"):
161 Global.Load(e);
162 loadedGlobal = true;
163 break;
164
165 case tHash::tHashCT("MainProfile"):
166 MainProfile.Load(e);
167 loadedMainProfile = true;
168 break;
169
170 case tHash::tHashCT("BasicProfile"):
171 BasicProfile.Load(e);
172 loadedBasicProfile = true;
173 break;
174
175 case tHash::tHashCT("KioskProfile"):
176 KioskProfile.Load(e);
177 loadedKioskProfile = true;
178 break;
179
180 case tHash::tHashCT("AltProfile"):
181 AltProfile.Load(e);
182 loadedAltProfile = true;
183 break;
184
185 case tHash::tHashCT("FileDialog"):
186 tFileDialog::Load(e, "FileDialog");
187 loadedFileDialog = true;
188 break;
189 }
190 }
191
192 // If the config existed but any particular top-level expression was missing, we reset it.
193 if (!loadedGlobal)
194 Global.Reset();
195

Callers

nothing calls this directly

Calls 4

ProfileEnum · 0.85
ReadMethod · 0.80
ResetMethod · 0.45
IsValidMethod · 0.45

Tested by

no test coverage detected