Skip to content

Commit

Permalink
Add usage documentation/example to DecodableList. (#17184)
Browse files Browse the repository at this point in the history
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Apr 26, 2022
1 parent 6e76e14 commit 3790181
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/app/data-model/DecodableList.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <typename T>
class DecodableList
Expand Down

0 comments on commit 3790181

Please sign in to comment.