LCOV - code coverage report
Current view: top level - u8stream/include/u8 - u8_error_info.inl (source / functions) Coverage Total Hit
Test: crystal-facet-uml_v1.63.2_covts Lines: 100.0 % 44 44
Test Date: 2025-05-01 10:10:14 Functions: 100.0 % 11 11

            Line data    Source code
       1              : /* File: u8_error_info.inl; Copyright and License: see below */
       2              : 
       3              : #include "utf8stringbuf/utf8stringbuf.h"
       4              : #include "u8/u8_trace.h"
       5              : #include "u8/u8_log.h"
       6              : #include <assert.h>
       7              : 
       8           55 : static inline void u8_error_info_init_void ( u8_error_info_t *this_ )
       9              : {
      10           55 :     (*this_).error = U8_ERROR_NONE;
      11           55 :     (*this_).unit = U8_ERROR_INFO_UNIT_VOID;
      12           55 :     (*this_).position = -1;
      13           55 :     (*this_).name[0] = '\0';
      14           55 : }
      15              : 
      16            1 : static inline void u8_error_info_init ( u8_error_info_t *this_, u8_error_t error )
      17              : {
      18            1 :     (*this_).error = error;
      19            1 :     (*this_).unit = U8_ERROR_INFO_UNIT_VOID;
      20            1 :     (*this_).position = -1;
      21            1 :     (*this_).name[0] = '\0';
      22            1 : }
      23              : 
      24           28 : static inline void u8_error_info_init_line ( u8_error_info_t *this_, u8_error_t error, int32_t line )
      25              : {
      26           28 :     (*this_).error = error;
      27           28 :     (*this_).unit = U8_ERROR_INFO_UNIT_LINE;
      28           28 :     (*this_).position = line;
      29           28 :     (*this_).name[0] = '\0';
      30           28 : }
      31              : 
      32            1 : static inline void u8_error_info_init_name ( u8_error_info_t *this_, u8_error_t error, const char* name )
      33              : {
      34            1 :     (*this_).error = error;
      35            1 :     (*this_).unit = U8_ERROR_INFO_UNIT_NAME;
      36            1 :     (*this_).position = -1;
      37            1 :     utf8stringbuf_t my_strbuf = utf8stringbuf_new( &((*this_).name[0]), U8_ERROR_INFO_MAX_NAME_SIZE );
      38            1 :     utf8stringbuf_copy_str( &my_strbuf, name );
      39            1 : }
      40              : 
      41            1 : static inline void u8_error_info_init_line_name ( u8_error_info_t *this_, u8_error_t error, int32_t line, const char* name )
      42              : {
      43            1 :     (*this_).error = error;
      44            1 :     (*this_).unit = U8_ERROR_INFO_UNIT_LINE_NAME;
      45            1 :     (*this_).position = line;
      46            1 :     utf8stringbuf_t my_strbuf = utf8stringbuf_new( &((*this_).name[0]), U8_ERROR_INFO_MAX_NAME_SIZE );
      47            1 :     utf8stringbuf_copy_str( &my_strbuf, name );
      48            1 : }
      49              : 
      50            5 : static inline void u8_error_info_destroy ( u8_error_info_t *this_ )
      51              : {
      52            5 : }
      53              : 
      54            5 : static inline bool u8_error_info_is_error ( const u8_error_info_t *this_ )
      55              : {
      56            5 :     return ( (*this_).error != U8_ERROR_NONE );
      57              : }
      58              : 
      59           50 : static inline u8_error_t u8_error_info_get_error ( const u8_error_info_t *this_ )
      60              : {
      61           50 :     return (*this_).error;
      62              : }
      63              : 
      64           23 : static inline u8_error_info_unit_t u8_error_info_get_unit ( const u8_error_info_t *this_ )
      65              : {
      66           23 :     return (*this_).unit;
      67              : }
      68              : 
      69           26 : static inline int32_t u8_error_info_get_line ( const u8_error_info_t *this_ )
      70              : {
      71           26 :     return (*this_).position;
      72              : }
      73              : 
      74            5 : static inline const char* u8_error_info_get_name ( const u8_error_info_t *this_ )
      75              : {
      76            5 :     return &((*this_).name[0]);
      77              : }
      78              : 
      79              : 
      80              : /*
      81              : Copyright 2022-2025 Andreas Warnke
      82              : 
      83              : Licensed under the Apache License, Version 2.0 (the "License");
      84              : you may not use this file except in compliance with the License.
      85              : You may obtain a copy of the License at
      86              : 
      87              :     http://www.apache.org/licenses/LICENSE-2.0
      88              : 
      89              : Unless required by applicable law or agreed to in writing, software
      90              : distributed under the License is distributed on an "AS IS" BASIS,
      91              : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      92              : See the License for the specific language governing permissions and
      93              : limitations under the License.
      94              : */
        

Generated by: LCOV version 2.0-1