MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / Parse

Method Parse

engine/Poseidon/IO/ParamFile/ParamFileParse.cpp:279–323  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

277}
278
279LSError ParamFile::Parse(const char* name)
280{
281 SetName(name);
282
283 // Log full absolute path of file being parsed
284 char fullPath[512];
285#ifdef _WIN32
286 ::GetFullPathNameA(name, sizeof(fullPath), fullPath, nullptr);
287#else
288 if (!realpath(name, fullPath))
289 strncpy(fullPath, name, sizeof(fullPath) - 1);
290#endif
291 LOG_DEBUG(Core, "ParamFile::Parse() - Loading config file: {}", fullPath);
292
293 if (!QIFStreamB::FileExist(name))
294 {
295 LOG_DEBUG(Core, "ParamFile::Parse() - File does not exist: {}", fullPath);
296 return LSOK;
297 }
298
299#if OUTPUT_PREPROC
300 QOFStream out;
301#else
302 QOStream out;
303#endif
304 if (!Preprocess(out, name))
305 {
306 return LSStructure;
307 }
308#if OUTPUT_PREPROC
309 ::DeleteFile("bin/output.txt");
310 out.export("bin/output.txt");
311#endif
312 QIStream in;
313 in.init(out.str(), out.pcount());
314 Parse(in);
315#if DIAG_OPEN
316 if (_entries.Size() > 0)
317 {
318 ParamFileOpen++;
319 LOG_DEBUG(Core, "{}: Parsed paramfile {}", ParamFileOpen, name);
320 }
321#endif
322 return in.fail() ? in.error() : LSOK;
323}
324
325void Indent(QOStream& f, int indent)
326{

Callers 2

ReloadMethod · 0.45
ParamValueSpecClass · 0.45

Calls 14

ErrorMessageFunction · 0.85
GetWordFunction · 0.85
strMethod · 0.80
pcountMethod · 0.80
initMethod · 0.45
SizeMethod · 0.45
failMethod · 0.45
errorMethod · 0.45
getMethod · 0.45
ungetMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected