added SerializableStruct which defines serialize() and toPropertyTree()

This commit is contained in:
woodser
2019-06-07 09:26:03 -04:00
parent 1a0fd84872
commit 78eb67d4cb
4 changed files with 55 additions and 2 deletions
+6
View File
@@ -114,6 +114,12 @@ void MoneroUtils::binaryBlocksToJson(const std::string &bin, std::string &json)
// throw runtime_error("deserializeOutputWallet(outputStr) not implemented");
//}
string MoneroUtils::serialize(const boost::property_tree::ptree& node) {
std::stringstream ss;
boost::property_tree::write_json(ss, node, false);
return ss.str();
}
boost::property_tree::ptree MoneroUtils::toPropertyTree(const MoneroAccount& account) {
cout << "toPropertyTree(account)" << endl;
boost::property_tree::ptree accountNode;
+2 -2
View File
@@ -5,8 +5,6 @@
#include "cryptonote_basic/cryptonote_basic.h"
#include "serialization/keyvalue_serialization.h" // TODO: consolidate with other binary deps?
#include "storages/portable_storage.h"
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
/**
* Collection of utilities for working with Monero's binary portable storage format.
@@ -62,6 +60,8 @@ namespace MoneroUtils
// return str;
// }
string serialize(const boost::property_tree::ptree& node);
boost::property_tree::ptree toPropertyTree(const MoneroAccount& account);
boost::property_tree::ptree toPropertyTree(const MoneroSubaddress& subaddress);