Serialization of EO user objects.

This commit is contained in:
Benjamin Bouvier 2012-06-15 10:56:59 +02:00
commit 0bd33fe692
16 changed files with 919 additions and 0 deletions

40
eo/src/serial/Object.cpp Normal file
View file

@ -0,0 +1,40 @@
# include "Object.h"
using namespace eoserial;
namespace eoserial
{
std::ostream& Object::print( std::ostream& out ) const
{
out << '{';
bool first = true;
for(JsonValues::const_iterator it = begin(), end = this->end();
it != end;
++it)
{
if ( first )
{
first = false;
} else {
out << ", ";
}
out << '"' << it->first << "\":"; // key
it->second->print( out ); // value
}
out << "}\n";
return out;
}
Object::~Object()
{
for(JsonValues::iterator it = begin(), end = this->end();
it != end;
++it)
{
delete it->second;
}
}
} // namespace eoserial