LCOV - code coverage report
Current view: top level - spb/json - field.hpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 4 4
Test Date: 2026-10-31 08:41:17 Functions: 100.0 % 1 1

            Line data    Source code
       1              : /*
       2              :  * Protobuf serialization library - JSON field attributes.
       3              :  *
       4              :  * Copyright (c) 2024 Antonin Kriz <antonin.kriz@gmail.com>
       5              :  * Released under the MIT License. See LICENSE in the project root.
       6              :  */
       7              : 
       8              : #pragma once
       9              : 
      10              : #include <cstddef>
      11              : #include <stdexcept>
      12              : 
      13              : namespace spb::json::detail
      14              : {
      15              : struct field_attributes
      16              : {
      17              :     size_t max_count = 0;
      18              :     size_t max_size  = 0;
      19              : };
      20              : 
      21          530 : inline void check_size(size_t size, size_t max_size)
      22              : {
      23          530 :     if (size > max_size) [[unlikely]]
      24           50 :         throw std::length_error("field is too large");
      25          480 : }
      26              : 
      27              : } // namespace spb::json::detail
        

Generated by: LCOV version 2.0-1