MCPcopy Create free account
hub / github.com/Snapchat/Valdi / assignComponent

Function assignComponent

valdi_core/src/valdi_core/cpp/Utils/ReferenceInfo.cpp:256–281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

254using NamesVector = StaticVector<StringBox, ReferenceInfo::kNamesSize>;
255
256static bool assignComponent(ComponentsVector& components,
257 NamesVector& names,
258 ReferenceInfo::Component::Type type,
259 size_t index,
260 const StringBox* name,
261 bool isFunction) {
262 if (components.size() >= ComponentsVector::capacity()) {
263 return false;
264 }
265
266 auto& outComponent = components.emplace_back();
267
268 if (name != nullptr && !name->isEmpty()) {
269 if (names.size() < NamesVector::capacity()) {
270 outComponent.hasAssignedName = true;
271 outComponent.index = static_cast<uint8_t>(names.size());
272 names.emplace_back(*name);
273 }
274 } else {
275 outComponent.index = static_cast<uint8_t>(index);
276 }
277 outComponent.type = type;
278 outComponent.isFunction = isFunction;
279
280 return true;
281}
282
283static void assignReferenceInfo(ComponentsVector& components,
284 NamesVector& names,

Callers 2

assignReferenceInfoFunction · 0.85
buildMethod · 0.85

Calls 2

sizeMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected