Moved files to core.lib for unit testing
This commit is contained in:
parent
466920bf4e
commit
e9f5fff6d3
6 changed files with 8 additions and 8 deletions
38
core/ParamListJson.cpp
Normal file
38
core/ParamListJson.cpp
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#include "ParamListJson.h"
|
||||
#include "ParamListModel.h"
|
||||
|
||||
Json::Value ParamToJson(const Param ¶m)
|
||||
{
|
||||
Json::Value v;
|
||||
v["type"] = (int)param.type.toUtf8().data();
|
||||
v["value"] = param.value.toUtf8().data();
|
||||
return v;
|
||||
}
|
||||
|
||||
Param ParamFromJson(const Json::Value &json)
|
||||
{
|
||||
Param p;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
Json::Value ParamListModelToJson(const t_ParamList &list)
|
||||
{
|
||||
Json::Value root;
|
||||
for (const auto ¶m : list) {
|
||||
root.append(ParamToJson(param));
|
||||
}
|
||||
return root;
|
||||
}
|
||||
|
||||
t_ParamList ParamListModelFromJson(const Json::Value &json)
|
||||
{
|
||||
t_ParamList result;
|
||||
if (json.isArray()) {
|
||||
result.reserve(json.size());
|
||||
for (auto &e : json) {
|
||||
result.push_back(ParamFromJson(e));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue