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

Function parseField

valdi_core/src/valdi_core/cpp/Resources/ValdiArchive.cpp:45–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45static Result<BytesView> parseField(Parser<Byte>& parser, const LengthField& length) {
46 auto size = length.size();
47 auto fieldData = parser.parse<const Byte>(size);
48 if (!fieldData) {
49 return onModuleFailure(fieldData.moveError());
50 }
51
52 if (length.hasPadding()) {
53 auto padding = computePadding(size);
54 auto skipped = parser.parse<Void>(padding);
55 if (!skipped) {
56 return skipped.moveError();
57 }
58 }
59
60 return BytesView(nullptr, fieldData.value(), size);
61}
62
63Result<std::vector<ValdiArchiveEntry>> ValdiArchive::getEntries() const {
64 auto dataSection = ValdiPacket::read(_dataBegin, _dataEnd - _dataBegin);

Callers 1

getEntriesMethod · 0.85

Calls 6

onModuleFailureFunction · 0.85
hasPaddingMethod · 0.80
computePaddingFunction · 0.70
valueMethod · 0.65
BytesViewClass · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected