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

Method Dump

apps/tools/Tools/commands/ConfigCommand.cpp:447–473  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

445}
446
447int ConfigCommand::Dump(const std::string& inputPath, const std::string& className)
448{
449 ParamFile cfg;
450 if (!cfg.ParseBin(inputPath.c_str()))
451 {
452 std::cerr << "Error: failed to parse binary config: " << inputPath << std::endl;
453 return 1;
454 }
455
456 const ParamEntry* entry = cfg.FindEntry(className.c_str());
457 if (!entry)
458 {
459 std::cerr << "Error: class '" << className << "' not found in " << inputPath << std::endl;
460 std::cerr << "Available top-level entries (" << cfg.GetEntryCount() << "):" << std::endl;
461 for (int i = 0; i < cfg.GetEntryCount() && i < 50; i++)
462 {
463 std::cerr << " " << cfg.GetEntry(i).GetName() << std::endl;
464 }
465 return 1;
466 }
467
468 QOStream buf;
469 entry->Save(buf, 0);
470 std::cout.write(buf.str(), buf.tellp());
471 std::cout << std::endl;
472 return 0;
473}
474
475int ConfigCommand::ToJson(const std::string& inputPath, const std::string& outputPath)
476{

Callers

nothing calls this directly

Calls 8

strMethod · 0.80
tellpMethod · 0.80
ParseBinMethod · 0.45
FindEntryMethod · 0.45
GetEntryCountMethod · 0.45
GetNameMethod · 0.45
SaveMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected