MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / Load

Method Load

ogsr_engine/xrCore/Xr_ini.cpp:185–381  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183}
184
185void CInifile::Load(IReader* F, LPCSTR path, BOOL allow_dup_sections, const CInifile* override, bool root_level, LPCSTR current_file)
186{
187 R_ASSERT(F);
188
189 string4096 str;
190 string4096 str2;
191
192 auto AddOrOverride = [&]() {
193 auto I = DATA.find(Current->Name);
194 if (I != DATA.end())
195 {
196 if (allow_dup_sections)
197 {
198 Sect* existing = (I->second);
199 for (auto& it : Current->Ordered_Data)
200 {
201 Item I = {it.first, it.second};
202 insert_item(existing, I);
203 }
204 }
205 else
206 {
207 FATAL("Duplicate section '%s' found.", Current->Name.c_str());
208 }
209
210 xr_delete(Current);
211 }
212 else
213 {
214 if (override)
215 {
216 auto O = override->DATA.find(Current->Name);
217 if (O != override->DATA.end())
218 {
219 Msg("~ Override section [%s]", Current->Name.c_str());
220
221 Sect* override = (O->second);
222 for (auto& it : override->Ordered_Data)
223 {
224 Item v = {it.first, it.second};
225 insert_item(Current, v);
226 }
227 }
228 }
229
230 Current->Index = DATA.size();
231 DATA.emplace(Current->Name, Current);
232 Ordered_DATA.emplace_back(Current->Name, Current);
233 }
234 };
235
236 while (!F->eof())
237 {
238 F->r_string(str, sizeof(str));
239 _Trim(str);
240 LPSTR semi = strchr(str, ';');
241 LPSTR semi_1 = strchr(str, '/');
242

Callers

nothing calls this directly

Calls 15

insert_itemFunction · 0.85
xr_deleteFunction · 0.85
MsgFunction · 0.85
_TrimFunction · 0.85
_GetItemFunction · 0.85
LoadFunction · 0.85
_GetItemCountFunction · 0.85
_strlwrFunction · 0.85
_parseFunction · 0.85
emplaceMethod · 0.80
eofMethod · 0.80
r_openMethod · 0.80

Tested by

no test coverage detected