Matter SDK Coverage Report
Current view: top level - app/MessageDef - AttributePathIBs.cpp (source / functions) Coverage Total Hit
Test: SHA:b879ecb8e99e175eea0a293a888bda853da2b19c Lines: 100.0 % 30 30
Test Date: 2025-01-17 19:00:11 Functions: 100.0 % 3 3

            Line data    Source code
       1              : /**
       2              :  *
       3              :  *    Copyright (c) 2020-2021 Project CHIP Authors
       4              :  *    Copyright (c) 2018 Google LLC.
       5              :  *    Copyright (c) 2016-2017 Nest Labs, Inc.
       6              :  *    Licensed under the Apache License, Version 2.0 (the "License");
       7              :  *    you may not use this file except in compliance with the License.
       8              :  *    You may obtain a copy of the License at
       9              :  *
      10              :  *        http://www.apache.org/licenses/LICENSE-2.0
      11              :  *
      12              :  *    Unless required by applicable law or agreed to in writing, software
      13              :  *    distributed under the License is distributed on an "AS IS" BASIS,
      14              :  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      15              :  *    See the License for the specific language governing permissions and
      16              :  *    limitations under the License.
      17              :  */
      18              : 
      19              : #include "AttributePathIBs.h"
      20              : #include "MessageDefHelper.h"
      21              : 
      22              : #include <inttypes.h>
      23              : #include <stdarg.h>
      24              : #include <stdio.h>
      25              : 
      26              : #include <app/AppConfig.h>
      27              : 
      28              : namespace chip {
      29              : namespace app {
      30              : #if CHIP_CONFIG_IM_PRETTY_PRINT
      31          901 : CHIP_ERROR AttributePathIBs::Parser::PrettyPrint() const
      32              : {
      33          901 :     CHIP_ERROR err          = CHIP_NO_ERROR;
      34          901 :     size_t numAttributePath = 0;
      35          901 :     TLV::TLVReader reader;
      36              : 
      37          901 :     PRETTY_PRINT("AttributePathIBs =");
      38          901 :     PRETTY_PRINT("[");
      39              : 
      40              :     // make a copy of the AttributePathIBs reader
      41          901 :     reader.Init(mReader);
      42              : 
      43         2812 :     while (CHIP_NO_ERROR == (err = reader.Next()))
      44              :     {
      45         1911 :         VerifyOrReturnError(TLV::AnonymousTag() == reader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG);
      46         1911 :         VerifyOrReturnError(TLV::kTLVType_List == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE);
      47              :         {
      48         1911 :             AttributePathIB::Parser path;
      49         1911 :             ReturnErrorOnFailure(path.Init(reader));
      50         1911 :             PRETTY_PRINT_INCDEPTH();
      51         1911 :             ReturnErrorOnFailure(path.PrettyPrint());
      52         1911 :             PRETTY_PRINT_DECDEPTH();
      53              :         }
      54              : 
      55         1911 :         ++numAttributePath;
      56              :     }
      57              : 
      58          901 :     PRETTY_PRINT("],");
      59          901 :     PRETTY_PRINT("\t");
      60              : 
      61              :     // if we have exhausted this container
      62          901 :     if (CHIP_END_OF_TLV == err)
      63              :     {
      64              :         // if we have at least one data element
      65          901 :         if (numAttributePath > 0)
      66              :         {
      67          901 :             err = CHIP_NO_ERROR;
      68              :         }
      69              :     }
      70          901 :     ReturnErrorOnFailure(err);
      71          901 :     return reader.ExitContainer(mOuterContainerType);
      72              : }
      73              : #endif // CHIP_CONFIG_IM_PRETTY_PRINT
      74              : 
      75         1936 : AttributePathIB::Builder & AttributePathIBs::Builder::CreatePath()
      76              : {
      77         1936 :     if (mError == CHIP_NO_ERROR)
      78              :     {
      79         1936 :         mError = mAttributePath.Init(mpWriter);
      80              :     }
      81         1936 :     return mAttributePath;
      82              : }
      83              : 
      84              : // Mark the end of this array and recover the type for outer container
      85          919 : CHIP_ERROR AttributePathIBs::Builder::EndOfAttributePathIBs()
      86              : {
      87          919 :     EndOfContainer();
      88          919 :     return GetError();
      89              : }
      90              : } // namespace app
      91              : } // namespace chip
        

Generated by: LCOV version 2.0-1