@@ -185,32 +185,32 @@ void DbcParser::parse_dbc_messages(const std::vector<std::string>& lines) {
185185 continue ;
186186 }
187187
188- // if (std::regex_search(line, match, value_re)) {
189- // uint32_t message_id = static_cast<uint32_t>(std::stoul(match.str(2)));
190- // std::string signal_name = match.str(3);
188+ if (std::regex_search (line, match, value_re)) {
189+ uint32_t message_id = static_cast <uint32_t >(std::stoul (match.str (2 )));
190+ std::string signal_name = match.str (3 );
191191
192- // // Loop over the rest of the descriptions
193- // std::string rest_of_descriptions = match.str(4);
194- // std::regex description_re("\\s(\\d+)\\s\"([^\"]*)\"");
192+ // Loop over the rest of the descriptions
193+ std::string rest_of_descriptions = match.str (4 );
194+ std::regex description_re (" \\ s(\\ d+)\\ s\" ([^\" ]*)\" " );
195195
196- // std::sregex_iterator desc_iter(rest_of_descriptions.begin(), rest_of_descriptions.end(), description_re);
197- // std::sregex_iterator desc_end = std::sregex_iterator();
196+ std::sregex_iterator desc_iter (rest_of_descriptions.begin (), rest_of_descriptions.end (), description_re);
197+ std::sregex_iterator desc_end = std::sregex_iterator ();
198198
199- // std::vector<Signal::SignalValueDescriptions> values{};
200- // for (std::sregex_iterator i = desc_iter; i != desc_end; ++i) {
201- // std::smatch desc_match = *desc_iter;
202- // uint32_t number = static_cast<uint32_t>(std::stoul(desc_match.str(1)));
203- // std::string text = desc_match.str(2);
199+ std::vector<Signal::SignalValueDescriptions> values{};
200+ for (std::sregex_iterator i = desc_iter; i != desc_end; ++i) {
201+ std::smatch desc_match = *desc_iter;
202+ uint32_t number = static_cast <uint32_t >(std::stoul (desc_match.str (1 )));
203+ std::string text = desc_match.str (2 );
204204
205- // values.push_back(Signal::SignalValueDescriptions{number, text});
206- // ++desc_iter;
207- // }
205+ values.push_back (Signal::SignalValueDescriptions{number, text});
206+ ++desc_iter;
207+ }
208208
209- // VALObject obj{message_id, signal_name, values};
209+ VALObject obj{message_id, signal_name, values};
210210
211- // signal_value.push_back(obj);
212- // continue;
213- // }
211+ signal_value.push_back (obj);
212+ continue ;
213+ }
214214 }
215215
216216 for (const auto & signal : signal_value) {
0 commit comments