MoneroUtils::toPropertyTree(vector<str|int>)

This commit is contained in:
woodser
2019-06-19 10:37:32 -04:00
parent 67bcc7a68e
commit 37705edd2b
3 changed files with 51 additions and 24 deletions
+22
View File
@@ -118,3 +118,25 @@ string MoneroUtils::serialize(const boost::property_tree::ptree& node) {
boost::property_tree::write_json(ss, node, false);
return ss.str();
}
boost::property_tree::ptree MoneroUtils::toPropertyTree(const vector<string> strs) {
//cout << "toPropertyTree(strs)" << endl;
boost::property_tree::ptree strsNode;
for (const auto& str : strs) {
boost::property_tree::ptree strNode;
strNode.put("", str);
strsNode.push_back(std::make_pair("", strNode));
}
return strsNode;
}
boost::property_tree::ptree MoneroUtils::toPropertyTree(const vector<uint32_t> nums) {
//cout << "toPropertyTree(nums)" << endl;
boost::property_tree::ptree numsNode;
for (const auto& num : nums) {
boost::property_tree::ptree numNode;
numNode.put("", num);
numsNode.push_back(std::make_pair("", numNode));
}
return numsNode;
}
+3
View File
@@ -81,6 +81,9 @@ namespace MoneroUtils
return typeNodes;
}
boost::property_tree::ptree toPropertyTree(const vector<string> strs);
boost::property_tree::ptree toPropertyTree(const vector<uint32_t> nums);
/**
* Modified from core_rpc_server.cpp to return a string.
*