Fix stringlist <-> jsonarray conversion.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
be4585a578
commit
163777d69a
|
@ -275,8 +275,9 @@ void Config::write()
|
||||||
list<string> Config::jsonarray_to_stringlist(const Json::Value &jsonarray) const
|
list<string> Config::jsonarray_to_stringlist(const Json::Value &jsonarray) const
|
||||||
{
|
{
|
||||||
list<string> stringlist;
|
list<string> stringlist;
|
||||||
std::transform(jsonarray.begin(), jsonarray.end(), stringlist.begin(),
|
std::transform(jsonarray.begin(), jsonarray.end(),
|
||||||
back_inserter(stringlist));
|
back_inserter(stringlist), [](const Json::Value &value)
|
||||||
|
{ return value.asString(); });
|
||||||
|
|
||||||
return stringlist;
|
return stringlist;
|
||||||
}
|
}
|
||||||
|
@ -285,8 +286,11 @@ Json::Value Config::stringlist_to_jsonarray(const list<string> &stringlist)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
Json::Value jsonarray;
|
Json::Value jsonarray;
|
||||||
std::transform(stringlist.begin(), stringlist.end(), jsonarray.begin(),
|
|
||||||
back_inserter(jsonarray));
|
for (const auto &entry : stringlist)
|
||||||
|
{
|
||||||
|
jsonarray.append(entry);
|
||||||
|
}
|
||||||
|
|
||||||
return jsonarray;
|
return jsonarray;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user