Matter SDK Coverage Report
Current view: top level - lib/support - CommonIterator.h (source / functions) Coverage Total Hit
Test: SHA:b879ecb8e99e175eea0a293a888bda853da2b19c Lines: 100.0 % 2 2
Test Date: 2025-01-17 19:00:11 Functions: 66.7 % 21 14

            Line data    Source code
       1              : /*
       2              :  *
       3              :  *    Copyright (c) 2022 Project CHIP Authors
       4              :  *
       5              :  *    Licensed under the Apache License, Version 2.0 (the "License");
       6              :  *    you may not use this file except in compliance with the License.
       7              :  *    You may obtain a copy of the License at
       8              :  *
       9              :  *        http://www.apache.org/licenses/LICENSE-2.0
      10              :  *
      11              :  *    Unless required by applicable law or agreed to in writing, software
      12              :  *    distributed under the License is distributed on an "AS IS" BASIS,
      13              :  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      14              :  *    See the License for the specific language governing permissions and
      15              :  *    limitations under the License.
      16              :  */
      17              : 
      18              : /**
      19              :  *    @file
      20              :  *          Contains a standard iterator class.
      21              :  */
      22              : 
      23              : #pragma once
      24              : 
      25              : #include <stddef.h>
      26              : 
      27              : namespace chip {
      28              : 
      29              : /**
      30              :  * Template used to generate a custom iterator
      31              :  */
      32              : template <typename T>
      33              : class CommonIterator
      34              : {
      35              : public:
      36           59 :     virtual ~CommonIterator() = default;
      37              :     /**
      38              :      *  @retval The number of entries in total that will be iterated.
      39              :      */
      40              :     virtual size_t Count() = 0;
      41              :     /**
      42              :      *   @param[out] item  Value associated with the next element in the iteration.
      43              :      *  @retval true if the next entry is successfully retrieved.
      44              :      *  @retval false if no more entries can be found.
      45              :      */
      46              :     virtual bool Next(T & item) = 0;
      47              :     /**
      48              :      * Release the memory allocated by this iterator.
      49              :      * Must be called before the iterator goes out of scope if the iterator was dynamically allocated.
      50              :      */
      51              :     virtual void Release() = 0;
      52              : 
      53              : protected:
      54           59 :     CommonIterator() = default;
      55              : };
      56              : 
      57              : } // namespace chip
        

Generated by: LCOV version 2.0-1