Hi:
I am writing some serialization code that uses IOStreams as a filter.
The following is the class I am trying to serialize.
class MIDISurface
{
public:
// surface variables
std::wstring strSurfaceName;
};
The string header file is included.
I then have a template function as follows:
template <class SerializingType>
void SaveData(SerializingType Data, boost::filesystem::path FileName, bool EncryptData)
{
//Check file existance.
if (boost::filesystem::exists(FileName))
//Delete file
boost::filesystem::remove(FileName);
//Now create a WOfstream to serialize the data.
std::wofstream OutputStream(FileName.generic_wstring());
//Create a filtering_stream to allow us to encrypt the data if necessary.
boost::iostreams::wfiltering_streamboost::iostreams::output FilteringStream(FileName.generic_wstring());
if (EncryptData)
//FilteringStream.push(test); //add the encryption filter defined in Encryption.hpp.
FilteringStream.push(OutputStream);
boost::archive::xml_woarchive Archive(FilteringStream); //create an archive and assign the filtering stream.
Archive << BOOST_SERIALIZATION_NVP(Data);
}
I am including the following headers.
//Standard c++ headers.
#include <fstream>
#include