From 5a2f52b78da9e67c8d60e642980515af19de3a0b Mon Sep 17 00:00:00 2001 From: Wiebe Cazemier Date: Sun, 1 May 2022 17:35:02 +0200 Subject: [PATCH] Document PublishBase::getLengthWithoutFixedHeader() --- types.cpp | 8 ++++++++ 1 file changed, 8 insertions(+), 0 deletions(-) diff --git a/types.cpp b/types.cpp index d7f1bd2..aeb0952 100644 --- a/types.cpp +++ b/types.cpp @@ -121,6 +121,14 @@ PublishBase::PublishBase(const std::string &topic, const std::string &payload, c } +/** + * @brief PublishBase::getLengthWithoutFixedHeader gets the size for packet buffer allocation, but without the MQTT5 properties. + * @return + * + * The protocol version is not part of the Publish object, because it's used to send publishes to MQTT3 and MQTT5 clients, so that + * has to be added later. See the `MqttPacket::MqttPacket(const ProtocolVersion protocolVersion, Publish &_publish)` + * constructor. + */ size_t PublishBase::getLengthWithoutFixedHeader() const { const int topicLength = this->skipTopic ? 0 : topic.length(); -- libgit2 0.21.4