LCOV - code coverage report
Current view: top level - zephyr/shell - shell_string_conv.h Coverage Total Hit
Test: new.info Lines: 80.0 % 5 4
Test Date: 2025-09-05 16:43:28

            Line data    Source code
       1            0 : /*
       2              :  * Copyright (c) 2022 Nordic Semiconductor ASA
       3              :  *
       4              :  * SPDX-License-Identifier: Apache-2.0
       5              :  */
       6              : 
       7              : #ifndef ZEPHYR_INCLUDE_SHELL_STRING_CONV_H_
       8              : #define ZEPHYR_INCLUDE_SHELL_STRING_CONV_H_
       9              : 
      10              : #include <stdbool.h>
      11              : #include <stdint.h>
      12              : 
      13              : #ifdef __cplusplus
      14              : extern "C" {
      15              : #endif
      16              : 
      17              : /** @brief String to long conversion with error check.
      18              :  *
      19              :  * @warning On success the passed err reference will not be altered
      20              :  * to avoid err check bloating. Passed err reference should be initialized
      21              :  * to zero.
      22              :  *
      23              :  * @param str Input string.
      24              :  * @param base Conversion base.
      25              :  * @param err Error code pointer:
      26              :  *         -EINVAL on invalid string input.
      27              :  *         -ERANGE if numeric string input is to large to convert.
      28              :  *         Unchanged on success.
      29              :  *
      30              :  * @return Converted long value.
      31              :  */
      32            1 : long shell_strtol(const char *str, int base, int *err);
      33              : 
      34              : /** @brief String to unsigned long conversion with error check.
      35              :  *
      36              :  * @warning On success the passed err reference will not be altered
      37              :  * to avoid err check bloating. Passed err reference should be initialized
      38              :  * to zero.
      39              :  *
      40              :  * @param str Input string.
      41              :  * @param base Conversion base.
      42              :  * @param err Error code pointer:
      43              :  *         Set to -EINVAL on invalid string input.
      44              :  *         Set to -ERANGE if numeric string input is to large to convert.
      45              :  *         Unchanged on success.
      46              :  *
      47              :  * @return Converted unsigned long value.
      48              :  */
      49            1 : unsigned long shell_strtoul(const char *str, int base, int *err);
      50              : 
      51              : /** @brief String to unsigned long long conversion with error check.
      52              :  *
      53              :  * @warning On success the passed err reference will not be altered
      54              :  * to avoid err check bloating. Passed err reference should be initialized
      55              :  * to zero.
      56              :  *
      57              :  * @param str Input string.
      58              :  * @param base Conversion base.
      59              :  * @param err Error code pointer:
      60              :  *         Set to -EINVAL on invalid string input.
      61              :  *         Set to -ERANGE if numeric string input is to large to convert.
      62              :  *         Unchanged on success.
      63              :  *
      64              :  * @return Converted unsigned long long value.
      65              :  */
      66            1 : unsigned long long shell_strtoull(const char *str, int base, int *err);
      67              : 
      68              : /** @brief String to boolean conversion with error check.
      69              :  *
      70              :  * @warning On success the passed err reference will not be altered
      71              :  * to avoid err check bloating. Passed err reference should be initialized
      72              :  * to zero.
      73              :  *
      74              :  * @param str Input string.
      75              :  * @param base Conversion base.
      76              :  * @param err Error code pointer:
      77              :  *         Set to -EINVAL on invalid string input.
      78              :  *         Set to -ERANGE if numeric string input is to large to convert.
      79              :  *         Unchanged on success.
      80              :  *
      81              :  * @return Converted boolean value.
      82              :  */
      83            1 : bool shell_strtobool(const char *str, int base, int *err);
      84              : 
      85              : #ifdef __cplusplus
      86              : }
      87              : #endif
      88              : 
      89              : #endif /* ZEPHYR_INCLUDE_SHELL_STRING_CONV_H_ */
        

Generated by: LCOV version 2.0-1