parser of binary data using Spirit or Xpressive?

Is it possible to write parser of binary data (ie. NULL is just some value, not string delimiter) using Spirit or Xpressive? Did anyone actualy tried it? B.

Bronek Kozicki wrote:
Is it possible to write parser of binary data (ie. NULL is just some value, not string delimiter) using Spirit or Xpressive? Did anyone actualy tried it?
There is a binary parser sample in "libs/spirit/example/intermediate/ipv4.cpp" so I would say the answer is yes for spirit. And no, I didn't try it myself... HTH, Markus

Markus Schöpflin wrote:
Bronek Kozicki wrote:
Is it possible to write parser of binary data (ie. NULL is just some value, not string delimiter) using Spirit or Xpressive? Did anyone actualy tried it?
There is a binary parser sample in "libs/spirit/example/intermediate/ipv4.cpp" so I would say the answer is yes for spirit. And no, I didn't try it myself...
This is true also for xpressive, which works with iterators and gives no special meaning to NULL characters. xpressive can also be used to parse non-character data, such as arrays of integers. Just use the null_regex_traits in xpressive/traits/null_regex_traits.hpp. This is documented at http://tinyurl.com/bw5pk HTH, -- Eric Niebler Boost Consulting www.boost-consulting.com
participants (3)
-
Bronek Kozicki
-
Eric Niebler
-
Markus Schöpflin