MCPcopy Create free account
hub / github.com/Kitware/CMake / AddVectorIfPresent

Method AddVectorIfPresent

Source/cmSpdxSerializer.cxx:65–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65void 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
90void cmSpdxSerializer::AddVectorIfPresent(std::string const& key,
91 std::vector<std::string> const& vec)

Callers 1

SerializeMethod · 0.80

Calls 6

moveFunction · 0.85
isNullMethod · 0.80
appendMethod · 0.80
emptyMethod · 0.45
IsNullMethod · 0.45
SerializeMethod · 0.45

Tested by

no test coverage detected