mirror of
https://github.com/wownero/wownero-cpp.git
synced 2026-10-20 16:48:40 +02:00
monero_utils::deserialize() accepts target node as param
This commit is contained in:
@@ -452,11 +452,13 @@ string monero_utils::serialize(const boost::property_tree::ptree& node) {
|
||||
}
|
||||
|
||||
// TODO: switch deserializes in this utils class to use this deserialize util
|
||||
boost::property_tree::ptree monero_utils::deserialize(const string& json) {
|
||||
void monero_utils::deserialize(const string& json, boost::property_tree::ptree& root) {
|
||||
std::istringstream iss = json.empty() ? std::istringstream() : std::istringstream(json);
|
||||
boost::property_tree::ptree node;
|
||||
boost::property_tree::read_json(iss, node);
|
||||
return node;
|
||||
try {
|
||||
boost::property_tree::read_json(iss, root);
|
||||
} catch (std::exception const& e) {
|
||||
throw runtime_error("Invalid JSON");
|
||||
}
|
||||
}
|
||||
|
||||
boost::property_tree::ptree monero_utils::to_property_tree(const vector<string>& strs) {
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace monero_utils
|
||||
|
||||
string serialize(const boost::property_tree::ptree& node);
|
||||
|
||||
boost::property_tree::ptree deserialize(const string& json);
|
||||
void deserialize(const string& json, boost::property_tree::ptree& root);
|
||||
|
||||
/**
|
||||
* Convert a Monero Core cryptonote::block to a block in this library's native model.
|
||||
|
||||
Reference in New Issue
Block a user