MOAB: Mesh Oriented datABase
(version 5.4.1)
|
#include <CLArgFlag.hpp>
Public Member Functions | |
CLArgIDList (char fl, const char *pdesc, CLArgs::IntListArgI *pcallback) | |
virtual const CLArgs::ArgIBase * | callback () const |
virtual bool | parse (const char *str) const |
virtual std::string | brief () const |
virtual std::string | manstr () const |
Public Attributes | |
CLArgs::IntListArgI * | mCallback |
Definition at line 215 of file CLArgFlag.hpp.
CLArgIDList::CLArgIDList | ( | char | fl, |
const char * | pdesc, | ||
CLArgs::IntListArgI * | pcallback | ||
) | [inline] |
Definition at line 221 of file CLArgFlag.hpp.
std::string CLArgIDList::brief | ( | ) | const [virtual] |
Get brief format of option
Implements CLArgFlag.
Definition at line 242 of file CLArgFlag.cpp.
{ const char str[] = { '-', flag(), '\0' }; std::string result( str ); result += " <id_list>"; return result; }
virtual const CLArgs::ArgIBase* CLArgIDList::callback | ( | ) | const [inline, virtual] |
Implements CLArgFlag.
Definition at line 226 of file CLArgFlag.hpp.
References mCallback.
{ return mCallback; }
std::string CLArgIDList::manstr | ( | ) | const [virtual] |
Get UNIX man-page formated synposis of flag
Implements CLArgFlag.
Definition at line 249 of file CLArgFlag.cpp.
{ return make_man_string( "id_list" ); }
bool CLArgIDList::parse | ( | const char * | str | ) | const [virtual] |
Implements CLArgFlag.
Definition at line 254 of file CLArgFlag.cpp.
{ std::vector< int > list; long v; int i, j; char* endptr; for( ;; ) { while( isspace( *str ) ) ++str; if( !*str ) break; v = strtol( str, &endptr, 10 ); if( endptr == str || v <= 0 ) return false; i = (int)v; if( (long)i != v ) return false; list.push_back( i ); str = endptr; while( isspace( *str ) ) ++str; if( *str == '-' ) { do { ++str; } while( isspace( *str ) ); v = strtol( str, &endptr, 10 ); if( endptr == str || v < i ) return false; j = (int)v; if( (long)j != v ) return false; for( ++i; i < j; ++j ) list.push_back( i ); str = endptr; while( isspace( *str ) ) ++str; } if( !*str ) break; if( *str != ',' ) return false; ++str; } if( list.empty() ) return false; if( !mCallback->value( list ) ) return false; mCallback->set_seen(); return true; }
Definition at line 218 of file CLArgFlag.hpp.
Referenced by callback().