On Thu, Sep 5, 2013 at 9:27 PM, Michael Caisse
On 09/05/2013 07:00 PM, Michael Powell wrote:
On Thu, Sep 5, 2013 at 8:54 PM, Michael Caisse
wrote: Hi Michael -
Parsing NMEA is about as easy as you have described in english.
rule = lit('$') >> ~char_('*') >> lit('$') >> hex >> lit("\r\n");
Pretty straightforward. How about the wrinkle of enforcing the NMEA 2-hex-digit checksum?
It ends up that the Spirit numeric parser is customizable. Simply create the parser you want. For example:
qi::uint_parser< unsigned, 16, 2, 2 > nmea_hex_p;
creates a parser that will synthesize unsigned values that are parsed as base 16 and must have exactly 2 digits.
rule >> lit('$') >> ~char_('*') >> '*' >> nmea_hex_p >> "\r\n";
Well, whaddaya know. Poifect! Thanks!
michael
-- Michael Caisse ciere consulting ciere.com _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users