| 63 | } |
| 64 | |
| 65 | void cmSpdxSerializer::AddVectorIfPresent(std::string const& key, |
| 66 | std::vector<cmSbomObject> const& vec) |
| 67 | { |
| 68 | if (vec.empty()) { |
| 69 | return; |
| 70 | } |
| 71 | Json::Value parentValue = std::move(CurrentValue); |
| 72 | Json::Value childValue(Json::arrayValue); |
| 73 | |
| 74 | for (auto const& item : vec) { |
| 75 | if (item.IsNull()) { |
| 76 | continue; |
| 77 | } |
| 78 | |
| 79 | item.Serialize(*this); |
| 80 | |
| 81 | if (!CurrentValue.isNull()) { |
| 82 | childValue.append(std::move(CurrentValue)); |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | CurrentValue = std::move(parentValue); |
| 87 | CurrentValue[key] = std::move(childValue); |
| 88 | } |
| 89 | |
| 90 | void cmSpdxSerializer::AddVectorIfPresent(std::string const& key, |
| 91 | std::vector<std::string> const& vec) |