LCOV - code coverage report
Current view: top level - ers/src - Util.cpp (source / functions) Coverage Total Hit
Test: code.result Lines: 90.5 % 21 19
Test Date: 2025-12-21 13:07:08 Functions: 100.0 % 3 3

            Line data    Source code
       1              : #include <stdio.h>
       2              : 
       3              : #include <ers/internal/Util.hpp>
       4              : #include <ers/internal/macro.hpp>
       5              : 
       6              : void
       7           62 : ers::tokenize(  const std::string & text,
       8              :                 const std::string & separators,
       9              :                 std::vector<std::string> & result )
      10              : {
      11           62 :     std::string::size_type start_p, end_p;
      12           62 :     start_p = 0;
      13          431 :     do
      14              :     {
      15          431 :         end_p = text.find_first_of(separators,start_p);
      16          431 :         if (end_p == std::string::npos)
      17              :         {
      18           62 :             end_p = text.length(); 
      19              :         }
      20          431 :         result.push_back( text.substr( start_p, end_p - start_p ) );
      21          431 :         start_p = text.find_first_not_of( separators, end_p );
      22              :     }
      23          431 :     while( start_p != std::string::npos );
      24           62 : }
      25              : 
      26              : int
      27           88 : ers::read_from_environment( const char * name, int default_value )
      28              : {
      29           88 :     int value = default_value;
      30           88 :     const char * env = ::getenv( name );
      31           88 :     if ( env )
      32              :     {
      33            0 :         if ( sscanf( env, "%d", &value ) != 1 )
      34              :         {
      35            0 :             ERS_INTERNAL_ERROR( "Wrong value \"" << env
      36              :                     << "\" is given for the \"" << name << "\" environment" )
      37              :         }
      38              :     }
      39           88 :     return value;
      40              : }
      41              : 
      42              : const char * 
      43          146 : ers::read_from_environment( const char * name, const char * default_value )
      44              : {
      45          146 :     const char * env = ::getenv( name );
      46          146 :     return ( env ? env : default_value);
      47              : }
      48              : 
      49              : 
      50              : 
        

Generated by: LCOV version 2.0-1