• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ParadoxGameConverters / Vic3ToHoI4 / 13090188366

26 Jan 2025 07:59AM UTC coverage: 95.116% (-0.03%) from 95.146%
13090188366

push

github

web-flow
Eliminate warnings (#701)

* Externals in angle brackets.

* Commons from lib

* Update to preview versions of externals.

* Update fronter

* Switch to std::filesystem::path

* Unused variables

* Type conversion stuff.

* constness

* Missing headers

* Prefix increment, not postfix

* Check optional

* Remove a stray extern

* explicit

* Return an error case.

* Default value

* Enforce warnings.

* Disable some unfixable warnings.

* Update commons

* Formatting

* Fix a test

* Use fixed common

* Fix tests.

* Formatting

* Update to merged versions

* Make codefactor happier.

965 of 1008 new or added lines in 120 files covered. (95.73%)

2 existing lines in 2 files now uncovered.

20428 of 21477 relevant lines covered (95.12%)

61689.32 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

82.69
/src/vic3_world/database/database_parser.cpp
1
#include "src/vic3_world/database/database_parser.h"
2

3
#include <external/commonItems/CommonRegexes.h>
4
#include <external/commonItems/ParserHelpers.h>
5

6

7

8
namespace vic3
9
{
10

11
DatabaseParser::DatabaseParser(): commonItems::parser(), db_entry_parser_()
×
12
{
NEW
13
   this->db_entry_parser_.registerRegex(commonItems::integerRegex,
×
NEW
14
       []([[maybe_unused]] const std::string& key, [[maybe_unused]] std::istream& stream) {
×
NEW
15
          return;
×
16
       });
17
   this->db_entry_parser_.IgnoreUnregisteredItems();
×
18
   this->registerKeyword("database", db_entry_parser_);
×
19
   this->IgnoreAndLogUnregisteredItems();
×
20
}
×
21

22
void skipSpaces(std::istream& stream)
72✔
23
{
24
   while (stream.peek() == ' ')
72✔
25
   {
26
      stream.get();
×
27
   }
28
}
72✔
29

30
DatabaseParser::DatabaseParser(commonItems::parsingFunctionStreamOnly single_element_func):
17✔
31
    commonItems::parser(),
32
    db_entry_parser_()
17✔
33
{
34
   this->db_entry_parser_.registerRegex(commonItems::integerRegex,
17✔
35
       [single_element_func](std::string key, std::istream& stream) {
17✔
36
          // i have a mouth and i must scream
37
          skipSpaces(stream);
36✔
38
          const auto m = static_cast<char>(stream.get());
36✔
39
          const auto n = static_cast<char>(stream.peek());
36✔
40
          if (n == ' ')
36✔
41
          {
42
             stream.get();
20✔
43
          }
44
          if (stream.peek() == '{')
36✔
45
          {
46
             if (n == ' ')
31✔
47
             {
48
                stream.putback(n);
16✔
49
             }
50
             stream.putback(m);
31✔
51
             single_element_func(stream);
31✔
52
          }
53
          else
54
          {
55
             commonItems::ignoreItem(key, stream);
5✔
56
          }
57
       });
36✔
58
   this->db_entry_parser_.IgnoreAndLogUnregisteredItems();
17✔
59

60
   this->registerKeyword("database", this->db_entry_parser_);
17✔
61
   this->IgnoreAndLogUnregisteredItems();
17✔
62
}
34✔
63

64
DatabaseParser::DatabaseParser(commonItems::parsingFunction multi_element_func):
17✔
65
    commonItems::parser(),
66
    db_entry_parser_()
17✔
67
{
68
   this->db_entry_parser_.registerRegex(commonItems::integerRegex,
17✔
69
       [multi_element_func](std::string key, std::istream& stream) {
17✔
70
          // i have a mouth and i must scream
71
          skipSpaces(stream);
36✔
72
          const auto m = static_cast<char>(stream.get());
36✔
73
          const auto n = static_cast<char>(stream.peek());
36✔
74
          if (n == ' ')
36✔
75
          {
76
             stream.get();
17✔
77
          }
78
          if (stream.peek() == '{')
36✔
79
          {
80
             if (n == ' ')
34✔
81
             {
82
                stream.putback(n);
17✔
83
             }
84
             stream.putback(m);
34✔
85
             multi_element_func(key, stream);
34✔
86
          }
87
          else
88
          {
89
             commonItems::ignoreItem(key, stream);
2✔
90
          }
91
       });
36✔
92
   this->db_entry_parser_.IgnoreAndLogUnregisteredItems();
17✔
93

94
   this->registerKeyword("database", this->db_entry_parser_);
17✔
95
   this->IgnoreAndLogUnregisteredItems();
17✔
96
}
34✔
97
}  // namespace vic3
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc