62{
65
66 std::string_view line;
67 std::string aqueous_solution_prev;
68 std::size_t chemical_system_id = 0;
69 std::size_t pos = 0;
70
71 while (pos < dump_content.size())
72 {
73
74 if (const auto newline_pos = dump_content.find('\n', pos);
75 newline_pos == std::string_view::npos)
76 {
77 line = dump_content.substr(pos);
78 pos = dump_content.size();
79 }
80 else
81 {
82 line = dump_content.substr(pos, newline_pos - pos);
83 pos = newline_pos + 1;
84 }
85
86
87 if (!line.empty() && line.back() == '\r')
88 {
89 line.remove_suffix(1);
90 }
91
92 if (line.find("USE reaction_pressure none") != std::string::npos)
93 {
94 break;
95 }
96
97 if (line.find("SOLUTION_RAW") != std::string::npos)
98 {
99 aqueous_solution_prev =
100 "SOLUTION_RAW " +
101 std::to_string(num_chemical_systems + chemical_system_id + 1) +
102 "\n";
103 continue;
104 }
105
106 aqueous_solution_prev += line;
107 aqueous_solution_prev += "\n";
108
109 if (line.find("-gammas") != std::string::npos)
110 {
112 aqueous_solution_prev.clear();
113 ++chemical_system_id;
114 }
115 }
116}