4 #include <SimoxUtility/json/json.hpp>
8 std::optional<armarx::motion::mdb::arondto::MDBReference>
11 if (std::filesystem::exists(pathToInfoJson) &&
12 std::filesystem::is_regular_file(pathToInfoJson))
14 std::ifstream ifs(pathToInfoJson);
15 std::string file_content((std::istreambuf_iterator<char>(ifs)),
16 (std::istreambuf_iterator<char>()));
18 armarx::motion::mdb::arondto::MDBReference motionReference;
19 auto json = nlohmann::json::parse(file_content);
21 motionReference.id = json[
"id"];
22 motionReference.associatedInstitution = json[
"associatedInstitution"];
23 motionReference.associatedProject = json[
"associatedProject"];
24 motionReference.comment = json[
"comment"];
26 motionReference.createdUser = json[
"createdUser"];
28 motionReference.modifiedUser = json[
"modifiedUser"];
29 motionReference.date = json[
"date"];
30 for (
auto it = json[
"attachedFiles"].begin(); it != json[
"attachedFiles"].end(); ++it)
32 const auto& key = it.key();
33 const auto&
value = it.value();
35 for (
const auto& attachedFile :
value)
37 armarx::motion::mdb::arondto::FileReference fileRef;
38 fileRef.attachedToId = attachedFile[
"attachedToId"];
41 fileRef.createdUser = attachedFile[
"createdUser"];
42 fileRef.description = attachedFile[
"description"];
43 fileRef.fileName = attachedFile[
"fileName"];
45 motionReference.attachedFiles[key].emplace_back(fileRef);
48 return motionReference;