Boost logo

Boost Users :

From: Bill Lear (rael_at_[hidden])
Date: 2007-04-09 10:35:45


On Monday, April 9, 2007 at 12:14:09 (+0200) Aljaz writes:
>Hello
>
>When I serialize (archive) my class I get string which looks something like:
>
>4422 serialization::archive 3 0 1 2 15 message_request 1 0 0 1 0 1 2 1
>
>Is there any way to hide serialization::archive and message_request, which
>is a name of a class that was serialized?

There is, though not sure it suits your needs, as you don't detail them.

You can hide the name, and everything else, by compressing the stream,
or by encrypting it.

Here is how you can do the former, when saving:

        std::ofstream ofs(file_name);
        boost::iostreams::filtering_ostream out;
        boost::iostreams::zlib_params zp(boost::iostreams::zlib::best_speed);
        out.push(boost::iostreams::zlib_compressor(zp));
        out.push(ofs);
        Archive oa(out);
        oa << BOOST_SERIALIZATION_NVP(message_request);

Bill


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