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

Method encode

valdi_protobuf/src/valdi_protobuf/Message.cpp:58–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56Message::~Message() = default;
57
58BytesView Message::encode(bool includeEmptyFields) {
59 auto length = encodedByteSize(includeEmptyFields);
60 auto byteBuffer = makeShared<ByteBuffer>();
61 byteBuffer->resize(length);
62
63 encode(includeEmptyFields, byteBuffer->begin(), byteBuffer->end());
64
65 return byteBuffer->toBytesView();
66}
67
68Byte* Message::encode(bool includeEmptyFields, Byte* bufferStart, Byte* bufferEnd) const {
69 _fieldMap.forEachSorted([&](const FieldMap::Entry& entry) {

Callers

nothing calls this directly

Calls 7

encodeFunction · 0.85
forEachSortedMethod · 0.80
endMethod · 0.65
writeMethod · 0.65
resizeMethod · 0.45
beginMethod · 0.45
toBytesViewMethod · 0.45

Tested by

no test coverage detected