From 627d8556205cd91b74443d8713807be256505e0b Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Thu, 7 Apr 2022 15:40:42 -0400 Subject: [PATCH] Add usage documentation/example to DecodableList. (#17184) --- src/app/data-model/DecodableList.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/app/data-model/DecodableList.h b/src/app/data-model/DecodableList.h index d06332ab84f8a5..ce1821e9510933 100644 --- a/src/app/data-model/DecodableList.h +++ b/src/app/data-model/DecodableList.h @@ -33,6 +33,18 @@ namespace DataModel { * This class provides an iteratable decoder of list items within TLV payloads * such that no memory has to be provided ahead of time to store the entirety of the decoded * list contents. + * + * Typical use of a DecodableList looks like this: + * + * auto iter = list.begin(); + * while (iter.Next()) { + * auto & entry = iter.GetValue(); + * // Do whatever with entry + * } + * CHIP_ERROR err = iter.GetStatus(); + * // If err is failure, decoding failed somewhere along the way. Some valid + * // entries may have been processed already. + * */ template class DecodableList