rsked/vlcplayer.cc
/// Extract an unsigned integer appearing on a line by itself.
/// Sets parameter u to the parsed integer and return true on success.
/// If more than one integer is present, only the first will be parsed.
/// Returns false if no integer was found.
///
/// * May throw  std::runtime_error in very rare circumstances
///
Extract an unsigned integer appearing on a line by itself.
Sets parameter u to the parsed integer and return true on success.
If more than one integer is present, only the first will be parsed.
Returns false if no integer was found.

May throw  std::runtime_error in very rare circumstances
Extract an unsigned integer appearing on a line by itself . Sets parameter u to the parsed integer and return true on success . If more than one integer is present only the first will be parsed . Returns false if no integer was found . May throw std :: runtime_error in very rare circumstances
static bool parse_unsigned( const std::string &resp, unsigned long &u )
{
   boost::match_results<std::string::const_iterator> what;
   boost::match_flag_type flags = boost::match_default;
   if (regex_search(resp.begin(),resp.end(),what,Unsigned_regex,flags))
   {
       std::string snumber(what[1].first, what[1].second);
       try {
           u = std::stoul( snumber ); 
       }
       catch( std::invalid_argument & ) { 
           LOG_DEBUG(Lgr) << "parse_unsigned: invalid int '"
                          << snumber << "'";
           return false;
       }
       return true;
   }
   return false;
}
static bool parse_unsigned ( const std :: string & resp , unsigned long & u ) { boost :: match_results < std :: string :: const_iterator > what ; boost :: match_flag_type flags = boost :: match_default ; if ( regex_search ( resp . begin ( ) , resp . end ( ) , what , Unsigned_regex , flags ) ) { std :: string snumber ( what [ 1 ] . first , what [ 1 ] . second ) ; try { u = std :: stoul ( snumber ) ; } catch ( std :: invalid_argument & ) { LOG_DEBUG ( Lgr ) << " " << snumber << " " ; return false ; } return true ; } return false ; }
Extract an unsigned integer appearing on a line by itself.
Extract an unsigned integer appearing on a line by itself .
// can throw std::invalid_argument // unlikely // LOG_DEBUG(Lgr) << "parse_unsigned: no match for:" << resp;