Hi all,
I am trying to introduce XML serialization in my project, but even with the
simplest test, I cannot get something to work. Here is what I did:
#define PARAMETERS_HPP
#include
#include
#include <iostream>
class rss_feeds_to_parse
{
public:
bool all;
template<class Archive> void serialize(Archive & ar, const
unsigned int file_version)
{
ar & BOOST_SERIALIZATION_NVP(all);
}
};
class parameters
{
public:
rss_feeds_to_parse feeds;
template<class Archive> void serialize(Archive & ar, const
unsigned int file_version)
{
ar & BOOST_SERIALIZATION_NVP(feeds);
}
};
#endif // PARAMETERS_HPP
Later, in my main, I have:
parameters p;
p.feeds.all = true;
std::ofstream ofs("test_parameters.xml");
assert(ofs.good());
boost::archive::xml_oarchive oa(ofs);
oa << BOOST_SERIALIZATION_NVP(p);
It compiles, links and executes well, the file test_parameters.xml is
created ... but empty !
What am I doing wrong?
Hope you could help.
Best regards,
Olivier