mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 13:03:17 +01:00
RPC: Allow multiple names for parameters
This commit is contained in:
parent
e19586a8a9
commit
c99ab3ca4b
@ -22,6 +22,8 @@
|
|||||||
#include <boost/signals2/signal.hpp>
|
#include <boost/signals2/signal.hpp>
|
||||||
#include <boost/thread.hpp>
|
#include <boost/thread.hpp>
|
||||||
#include <boost/algorithm/string/case_conv.hpp> // for to_upper()
|
#include <boost/algorithm/string/case_conv.hpp> // for to_upper()
|
||||||
|
#include <boost/algorithm/string/classification.hpp>
|
||||||
|
#include <boost/algorithm/string/split.hpp>
|
||||||
|
|
||||||
#include <memory> // for unique_ptr
|
#include <memory> // for unique_ptr
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
@ -432,8 +434,16 @@ static inline JSONRPCRequest transformNamedArguments(const JSONRPCRequest& in, c
|
|||||||
}
|
}
|
||||||
// Process expected parameters.
|
// Process expected parameters.
|
||||||
int hole = 0;
|
int hole = 0;
|
||||||
for (const std::string &argName: argNames) {
|
for (const std::string &argNamePattern: argNames) {
|
||||||
auto fr = argsIn.find(argName);
|
std::vector<std::string> vargNames;
|
||||||
|
boost::algorithm::split(vargNames, argNamePattern, boost::algorithm::is_any_of("|"));
|
||||||
|
auto fr = argsIn.end();
|
||||||
|
for (const std::string & argName : vargNames) {
|
||||||
|
fr = argsIn.find(argName);
|
||||||
|
if (fr != argsIn.end()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (fr != argsIn.end()) {
|
if (fr != argsIn.end()) {
|
||||||
for (int i = 0; i < hole; ++i) {
|
for (int i = 0; i < hole; ++i) {
|
||||||
// Fill hole between specified parameters with JSON nulls,
|
// Fill hole between specified parameters with JSON nulls,
|
||||||
|
Loading…
Reference in New Issue
Block a user