33 boost::regex(
"^==+$");
36 boost::regex(
"^\\h*MSG:\\h*([a-zA-Z][a-zA-Z0-9_/]*).*$");
39 boost::regex(
"[a-zA-Z][a-zA-Z0-9_]*");
42 boost::regex(
"[a-zA-Z][a-zA-Z0-9_/]*");
45 boost::regex(
"("+memberTypeExpression.str()+
")\\[([0-9]*)\\]");
48 boost::regex(
"[^\\h]+");
51 boost::regex(
"^\\h*("+memberTypeExpression.str()+
")(\\[[0-9]*\\])?\\h+("+
52 memberNameExpression.str()+
").*$");
55 boost::regex(
"^\\h*("+memberTypeExpression.str()+
")\\h+("+
56 memberNameExpression.str()+
")\\h*=\\h*("+memberValueExpression.str()+
57 ")\\h*("+commentExpression.str()+
")?$");
60 boost::regex(
"^\\h*(string)\\h+("+memberNameExpression.str()+
61 ")\\h*=\\h*(.*?)\\h*$");
64 boost::regex(
"^\\h*("+memberTypeExpression.str()+
")(\\[[0-9]*\\])?\\h+("+
65 memberNameExpression.str()+
")\\h*("+commentExpression.str()+
")?$");
68 boost::regex(
"^\\h*"+memberArrayTypeExpression.str()+
"\\h+("+
69 memberNameExpression.str()+
")\\h*("+commentExpression.str()+
")?$");
89 std::istringstream stream(messageDefinition);
90 std::string currentMessageType = messageDataType;
91 std::string currentMessageDefinition;
94 while (std::getline(stream, line)) {
98 if (!currentMessageDefinition.empty())
99 messageTypes.push_back(
MessageType(currentMessageType,
"*",
100 currentMessageDefinition));
102 currentMessageType = std::string(match[1].first, match[1].second);
103 currentMessageDefinition.clear();
106 if (!currentMessageDefinition.empty())
107 currentMessageDefinition +=
"\n";
108 currentMessageDefinition += line;
112 if (!currentMessageDefinition.empty())
113 messageTypes.push_back(
MessageType(currentMessageType,
"*",
114 currentMessageDefinition));
116 return messageTypes.size();
125 std::string& memberType,
size_t& size) {
129 memberType = std::string(match[1].first, match[1].second);
131 if (match[2].first != match[2].second)
132 size = boost::lexical_cast<
size_t>(
133 std::string(match[2].first, match[2].second));
144 name, std::string& type) {
148 name = std::string(match[3].first, match[3].second);
149 type = std::string(match[1].first, match[1].second)+
150 std::string(match[2].first, match[2].second);
159 std::string& name, std::string& type, std::string& value) {
164 name = std::string(match[2].first, match[2].second);
165 type = std::string(match[1].first, match[1].second);
166 value = std::string(match[3].first, match[3].second);
175 std::string& name, std::string& type) {
179 name = std::string(match[3].first, match[3].second);
180 type = std::string(match[1].first, match[1].second)+
181 std::string(match[2].first, match[2].second);
190 std::string& name, std::string& memberType,
size_t& size) {
194 name = std::string(match[3].first, match[3].second);
195 memberType = std::string(match[1].first, match[1].second);
197 if (match[2].first != match[2].second)
198 size = boost::lexical_cast<
size_t>(
199 std::string(match[2].first, match[2].second));
variant_topic_tools::MessageDefinition messageDefinition
Header file providing the MessageDefinitionParser class interface.