2 #include <boost/spirit/include/qi.hpp>
3 #include <boost/algorithm/string.hpp>
10 QDomElement stamp_elem = doc.createElement(
"use_header_stamp");
12 parent_elem.appendChild(stamp_elem);
14 QDomElement discard_elem = doc.createElement(
"discard_large_arrays");
16 parent_elem.appendChild(discard_elem);
18 QDomElement max_elem = doc.createElement(
"max_array_size");
20 parent_elem.appendChild(max_elem);
22 QDomElement bool_elem = doc.createElement(
"boolean_strings_to_number");
24 parent_elem.appendChild(bool_elem);
26 QDomElement suffix_elem = doc.createElement(
"remove_suffix_from_strings");
28 parent_elem.appendChild(suffix_elem);
30 QDomElement topics_elem = doc.createElement(
"selected_topics");
31 topics_elem.setAttribute(
"value",
topics.join(
';'));
32 parent_elem.appendChild(topics_elem);
37 QDomElement stamp_elem = parent_element.firstChildElement(
"use_header_stamp");
40 QDomElement discard_elem = parent_element.firstChildElement(
"discard_large_arrays");
43 QDomElement max_elem = parent_element.firstChildElement(
"max_array_size");
46 QDomElement bool_elem = parent_element.firstChildElement(
"boolean_strings_to_number");
49 QDomElement suffix_elem = parent_element.firstChildElement(
"remove_suffix_from_strings");
52 QDomElement topics_elem = parent_element.firstChildElement(
"selected_topics");
53 if(!topics_elem.isNull()) {
54 topics = topics_elem.attribute(
"value").split(
';');
60 settings.setValue(prefix +
"/default_topics",
topics);
62 settings.setValue(prefix +
"/max_array_size", (
int)
max_array_size);
70 topics = settings.value(prefix +
"/default_topics",
false).toStringList();
71 use_header_stamp = settings.value(prefix +
"/use_header_stamp",
false).toBool();
72 max_array_size = settings.value(prefix +
"/max_array_size", 100).toInt();
110 parser->parseMessage(serialized_msg, timestamp);
120 bool parsed = boost::spirit::qi::parse(str.data(), str.data() + str.size(),
121 boost::spirit::qi::double_,
value);
123 if(!parsed && remover_suffix)
126 while(pos < str.size())
129 if( !std::isdigit(c) && c!=
'-' && c!=
'+' && c!=
'.')
135 if( pos < str.size() )
137 parsed = boost::spirit::qi::parse(str.data(), str.data() + pos,
138 boost::spirit::qi::double_,
value);
142 if(!parsed && parse_boolean && str.size() >=4 && str.size() <=5)
144 std::string temp = str;
145 boost::algorithm::to_lower(temp);
151 else if( temp ==
"false" )