Message definition parser. More...
#include <MessageDefinitionParser.h>
Static Public Member Functions | |
static bool | match (const std::string &expression, std::string &name, std::string &type) |
Match any message member expression. | |
static bool | matchArray (const std::string &expression, std::string &name, std::string &memberType, size_t &size) |
Match an array message member expression. | |
static bool | matchArrayType (const std::string &expression, std::string &memberType, size_t &size) |
Match an array type expression. | |
static bool | matchConstant (const std::string &expression, std::string &name, std::string &type, std::string &value) |
Match a constant message member expression. | |
static bool | matchSeparator (const std::string &expression) |
Match a separator expression. | |
static bool | matchType (const std::string &expression) |
Match any message type expression. | |
static bool | matchVariable (const std::string &expression, std::string &name, std::string &type) |
Match a variable message member expression. | |
static size_t | parse (const std::string &messageDataType, const std::string &messageDefinition, std::vector< MessageType > &messageTypes) |
Parse a message definition and generate the message types. | |
Private Member Functions | |
MessageDefinitionParser () | |
Default constructor. | |
~MessageDefinitionParser () | |
Destructor. | |
Static Private Attributes | |
static const boost::regex | arrayMemberExpression |
Regular expression for matching an array message member. | |
static const boost::regex | commentExpression |
Regular expression for matching a comment. | |
static const boost::regex | constantMemberExpression |
Regular expression for matching a constant message member. | |
static const boost::regex | constantStringMemberExpression |
Regular expression for matching a constant string message member. | |
static const boost::regex | memberArrayTypeExpression |
Regular expression for matching an array message member type. | |
static const boost::regex | memberExpression |
Regular expression for matching any message member. | |
static const boost::regex | memberNameExpression |
Regular expression for matching a message member name. | |
static const boost::regex | memberTypeExpression |
Regular expression for matching any message member type. | |
static const boost::regex | memberValueExpression |
Regular expression for matching a message member value. | |
static const boost::regex | messageTypeExpression |
Regular expression for matching a message type definition. | |
static const boost::regex | separatorExpression |
Regular expression for matching a message type separator. | |
static const boost::regex | variableMemberExpression |
Regular expression for matching a variable message member. |
Message definition parser.
Definition at line 37 of file MessageDefinitionParser.h.
Default constructor.
Definition at line 75 of file MessageDefinitionParser.cpp.
Destructor.
Definition at line 78 of file MessageDefinitionParser.cpp.
bool variant_topic_tools::MessageDefinitionParser::match | ( | const std::string & | expression, |
std::string & | name, | ||
std::string & | type | ||
) | [static] |
Match any message member expression.
Definition at line 143 of file MessageDefinitionParser.cpp.
bool variant_topic_tools::MessageDefinitionParser::matchArray | ( | const std::string & | expression, |
std::string & | name, | ||
std::string & | memberType, | ||
size_t & | size | ||
) | [static] |
Match an array message member expression.
Definition at line 189 of file MessageDefinitionParser.cpp.
bool variant_topic_tools::MessageDefinitionParser::matchArrayType | ( | const std::string & | expression, |
std::string & | memberType, | ||
size_t & | size | ||
) | [static] |
Match an array type expression.
Definition at line 124 of file MessageDefinitionParser.cpp.
bool variant_topic_tools::MessageDefinitionParser::matchConstant | ( | const std::string & | expression, |
std::string & | name, | ||
std::string & | type, | ||
std::string & | value | ||
) | [static] |
Match a constant message member expression.
Definition at line 158 of file MessageDefinitionParser.cpp.
bool variant_topic_tools::MessageDefinitionParser::matchSeparator | ( | const std::string & | expression | ) | [static] |
Match a separator expression.
Definition at line 209 of file MessageDefinitionParser.cpp.
bool variant_topic_tools::MessageDefinitionParser::matchType | ( | const std::string & | expression | ) | [static] |
Match any message type expression.
Definition at line 119 of file MessageDefinitionParser.cpp.
bool variant_topic_tools::MessageDefinitionParser::matchVariable | ( | const std::string & | expression, |
std::string & | name, | ||
std::string & | type | ||
) | [static] |
Match a variable message member expression.
Definition at line 174 of file MessageDefinitionParser.cpp.
size_t variant_topic_tools::MessageDefinitionParser::parse | ( | const std::string & | messageDataType, |
const std::string & | messageDefinition, | ||
std::vector< MessageType > & | messageTypes | ||
) | [static] |
Parse a message definition and generate the message types.
Definition at line 85 of file MessageDefinitionParser.cpp.
const boost::regex variant_topic_tools::MessageDefinitionParser::arrayMemberExpression [static, private] |
boost::regex("^\\h*"+memberArrayTypeExpression.str()+"\\h+("+ memberNameExpression.str()+")\\h*("+commentExpression.str()+")?$")
Regular expression for matching an array message member.
Definition at line 125 of file MessageDefinitionParser.h.
const boost::regex variant_topic_tools::MessageDefinitionParser::commentExpression [static, private] |
boost::regex("#.*$")
Regular expression for matching a comment.
Definition at line 80 of file MessageDefinitionParser.h.
const boost::regex variant_topic_tools::MessageDefinitionParser::constantMemberExpression [static, private] |
boost::regex("^\\h*("+memberTypeExpression.str()+")\\h+("+ memberNameExpression.str()+")\\h*=\\h*("+memberValueExpression.str()+ ")\\h*("+commentExpression.str()+")?$")
Regular expression for matching a constant message member.
Definition at line 112 of file MessageDefinitionParser.h.
const boost::regex variant_topic_tools::MessageDefinitionParser::constantStringMemberExpression [static, private] |
boost::regex("^\\h*(string)\\h+("+memberNameExpression.str()+ ")\\h*=\\h*(.*?)\\h*$")
Regular expression for matching a constant string message member.
Definition at line 117 of file MessageDefinitionParser.h.
const boost::regex variant_topic_tools::MessageDefinitionParser::memberArrayTypeExpression [static, private] |
boost::regex("("+memberTypeExpression.str()+")\\[([0-9]*)\\]")
Regular expression for matching an array message member type.
Definition at line 100 of file MessageDefinitionParser.h.
const boost::regex variant_topic_tools::MessageDefinitionParser::memberExpression [static, private] |
boost::regex("^\\h*("+memberTypeExpression.str()+")(\\[[0-9]*\\])?\\h+("+ memberNameExpression.str()+").*$")
Regular expression for matching any message member.
Definition at line 108 of file MessageDefinitionParser.h.
const boost::regex variant_topic_tools::MessageDefinitionParser::memberNameExpression [static, private] |
boost::regex("[a-zA-Z][a-zA-Z1-9_]*")
Regular expression for matching a message member name.
Definition at line 92 of file MessageDefinitionParser.h.
const boost::regex variant_topic_tools::MessageDefinitionParser::memberTypeExpression [static, private] |
boost::regex("[a-zA-Z][a-zA-Z1-9_/]*")
Regular expression for matching any message member type.
Definition at line 96 of file MessageDefinitionParser.h.
const boost::regex variant_topic_tools::MessageDefinitionParser::memberValueExpression [static, private] |
boost::regex("[^\\h]+")
Regular expression for matching a message member value.
Definition at line 104 of file MessageDefinitionParser.h.
const boost::regex variant_topic_tools::MessageDefinitionParser::messageTypeExpression [static, private] |
boost::regex("^\\h*MSG:\\h*([a-zA-Z][a-zA-Z1-9_/]*).*$")
Regular expression for matching a message type definition.
Definition at line 88 of file MessageDefinitionParser.h.
const boost::regex variant_topic_tools::MessageDefinitionParser::separatorExpression [static, private] |
boost::regex("^==+$")
Regular expression for matching a message type separator.
Definition at line 84 of file MessageDefinitionParser.h.
const boost::regex variant_topic_tools::MessageDefinitionParser::variableMemberExpression [static, private] |
boost::regex("^\\h*("+memberTypeExpression.str()+")(\\[[0-9]*\\])?\\h+("+ memberNameExpression.str()+")\\h*("+commentExpression.str()+")?$")
Regular expression for matching a variable message member.
Definition at line 121 of file MessageDefinitionParser.h.