Opened 11 years ago
Last modified 11 years ago
#6106 new Patches
New map[] directive to augment qi::symbols when doing binary parsing
Reported by: | Owned by: | Joel de Guzman | |
---|---|---|---|
Milestone: | To Be Determined | Component: | spirit |
Version: | Boost Release Branch | Severity: | Not Applicable |
Keywords: | Cc: |
Description
qi::symbols is an exceptionally useful parser, but it is strongly tied to character strings as its input type. When doing binary parsing, one of the common tasks is de-serializing objects from the binary stream, an activity which can strongly benefit from Nabialek trick (http://boost-spirit.com/home/articles/qi-example/nabialek-trick/). Another common use case are extensible enum types, a feat which is somewhat cumbersome to handle with attribute transformations.
This is my first attempt at implementing a qi directive, so it's probably far from perfect. One of the immediate shortcomings I want to resolve is direct dependency on std::map which is also passed by value between instances.
The implementation and a short example demonstrating Nabialek trick is attached.
Attachments (2)
Change History (5)
by , 11 years ago
by , 11 years ago
Attachment: | test_map1.cpp added |
---|
Example showing use of map[] to implement Nabialek trick
follow-up: 2 comment:1 by , 11 years ago
That's very interesting!
We deal with feature submissions like this through the Spirit mailing list. I suggest you post a message there.
comment:2 by , 11 years ago
Replying to djowel:
We deal with feature submissions like this through the Spirit mailing list. I suggest you post a message there.
Of course I posted a message there, with a link here. But I suppose, ticket is a good place to keep everything related together. Or isn't it?
Implementation of the map[] directive in the repository::qi namespace