[api] Clarify which encode entry points forward on ProtoMessage

The base class defaults are independent no-ops; only generated message
classes forward encode() and calculate_size() to their statics.
This commit is contained in:
J. Nick Koston
2026-09-07 15:24:32 +02:00
parent ede8c1bba1
commit 989fe57a87
+3 -1
View File
@@ -696,7 +696,9 @@ class ProtoMessage {
//
// encode_msg/calc_size_msg are the type-erased entry points: generated messages define them as
// static functions over const void *, so &T::encode_msg is passed directly where a function
// pointer is needed and no per-type thunk exists. The member forms forward to them.
// pointer is needed and no per-type thunk exists. Generated classes also define encode() and
// calculate_size() as inline forwarders to their statics; the four defaults here are independent
// no-ops for messages without fields.
static uint8_t *encode_msg(const void *self, ProtoWriteBuffer &buffer PROTO_ENCODE_DEBUG_PARAM) {
return buffer.get_pos();
}