|
Boost Users : |
Subject: [Boost-users] [Spirit][karma] Generating Pascal string like output
From: Olaf Meeuwissen (olaf.meeuwissen_at_[hidden])
Date: 2012-01-23 00:30:27
Hi all,
While I had no trouble getting the parsing part for this to work, I'm
stuck on the generator part. Specifically, I'm stuck on getting the
size into the output.
The goal is a rule that takes a std::vector<byte> and outputs it in such
a way that it is preceded by its size (in a custom encoding) and padded
by zeroes to align on a four byte boundary.
I want to reuse this rule in several other rules and prefer to break it
up into smaller pieces. A minimalistic example of what I have come up
with so far is attached. What I can't seem figure out how to get at and
store the vector's size in pascal_string_size_. There also seem to be
problems with refering to the stored size_ in pascal_string_payload_ and
pascal_string_padding_ that I don't understand.
Note that the signed/unsigned distinction is on purpose. I am aware of
the side effects of assigning to size_ and that that is not threadsafe.
Any help would be appreciated. Thanks in advance,
-- Olaf Meeuwissen, LPIC-2 FLOSS Engineer -- AVASYS CORPORATION FSF Associate Member #1962 Help support software freedom http://www.fsf.org/jf?referrer=1962
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net