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

Method getArrayItem

valdi_core/src/valdi_core/cpp/Utils/Marshaller.cpp:324–337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

322}
323
324int Marshaller::getArrayItem(int index, int arrayIndex) {
325 auto array = getArray(index);
326 if (!_exceptionTracker) {
327 return 0;
328 }
329
330 auto arrayIndexSizeT = static_cast<size_t>(arrayIndex);
331 if (arrayIndex < 0 || arrayIndexSizeT >= array->size()) {
332 _exceptionTracker.onError(
333 Error(STRING_FORMAT("Out of bounds index {}, array size is {}", arrayIndex, array->size())));
334 return 0;
335 }
336 return push((*array)[arrayIndexSizeT]);
337}
338
339void Marshaller::setArrayItem(int index, int arrayIndex) {
340 auto array = getArray(index);

Callers 2

marshallMethod · 0.45

Calls 4

pushFunction · 0.85
ErrorClass · 0.70
onErrorMethod · 0.65
sizeMethod · 0.45

Tested by

no test coverage detected