mirror of
https://github.com/monero-project/monero.git
synced 2025-12-27 05:03:14 -08:00
Commented most of src/serialization/ going to read up more on variant's and finish off the job/add last touchs next
This commit is contained in:
@@ -34,23 +34,26 @@
|
||||
#include "binary_archive.h"
|
||||
|
||||
namespace serialization {
|
||||
/*! creates a new archive with the passed blob and serializes it into v
|
||||
*/
|
||||
template <class T>
|
||||
bool parse_binary(const std::string &blob, T &v)
|
||||
{
|
||||
std::istringstream istr(blob);
|
||||
binary_archive<false> iar(istr);
|
||||
return ::serialization::serialize(iar, v);
|
||||
}
|
||||
|
||||
/*! dumps the data in v into the blob string
|
||||
*/
|
||||
template<class T>
|
||||
bool dump_binary(T& v, std::string& blob)
|
||||
{
|
||||
std::stringstream ostr;
|
||||
binary_archive<true> oar(ostr);
|
||||
bool success = ::serialization::serialize(oar, v);
|
||||
blob = ostr.str();
|
||||
return success && ostr.good();
|
||||
};
|
||||
|
||||
template <class T>
|
||||
bool parse_binary(const std::string &blob, T &v)
|
||||
{
|
||||
std::istringstream istr(blob);
|
||||
binary_archive<false> iar(istr);
|
||||
return ::serialization::serialize(iar, v);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
bool dump_binary(T& v, std::string& blob)
|
||||
{
|
||||
std::stringstream ostr;
|
||||
binary_archive<true> oar(ostr);
|
||||
bool success = ::serialization::serialize(oar, v);
|
||||
blob = ostr.str();
|
||||
return success && ostr.good();
|
||||
};
|
||||
|
||||
} // namespace serialization
|
||||
|
||||
Reference in New Issue
Block a user