MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / ParseFile

Method ParseFile

src/strgen/strgen_base.cpp:576–598  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

574}
575
576void StringReader::ParseFile()
577{
578 _strgen.warnings = _strgen.errors = 0;
579
580 _strgen.translation = this->translation;
581 _strgen.file = this->file;
582
583 /* For each new file we parse, reset the genders, and language codes. */
584 _strgen.lang = {};
585
586 _strgen.cur_line = 1;
587 while (this->data.next_string_id < this->data.max_strings) {
588 std::optional<std::string> line = this->ReadLine();
589 if (!line.has_value()) return;
590
591 this->HandleString(StrTrimView(line.value(), StringConsumer::WHITESPACE_OR_NEWLINE));
592 _strgen.cur_line++;
593 }
594
595 if (this->data.next_string_id == this->data.max_strings) {
596 StrgenError("Too many strings, maximum allowed is {}", this->data.max_strings);
597 }
598}
599
600/**
601 * Write the header information.

Callers 1

CompileMethod · 0.45

Calls 4

HandleStringMethod · 0.95
StrTrimViewFunction · 0.85
ReadLineMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected