MOAB: Mesh Oriented datABase
(version 5.4.1)
|
#include <CLArgFlag.hpp>
Public Member Functions | |
CLArgIntList (char fl, const char *pdesc, CLArgs::IntListArgI *pcallback) | |
virtual const CLArgs::ArgIBase * | callback () const |
virtual bool | parse (const char *option) const |
virtual std::string | brief () const |
virtual std::string | manstr () const |
virtual bool | add_set (int size, const char *const *names) |
Private Attributes | |
CLArgListData | listData |
CLArgs::IntListArgI * | mCallback |
Definition at line 254 of file CLArgFlag.hpp.
CLArgIntList::CLArgIntList | ( | char | fl, |
const char * | pdesc, | ||
CLArgs::IntListArgI * | pcallback | ||
) | [inline] |
Definition at line 261 of file CLArgFlag.hpp.
virtual bool CLArgIntList::add_set | ( | int | size, |
const char *const * | names | ||
) | [inline, virtual] |
Reimplemented from CLArgFlag.
Definition at line 275 of file CLArgFlag.hpp.
References CLArgListData::add_set(), and listData.
std::string CLArgIntList::brief | ( | ) | const [virtual] |
Get brief format of option
Implements CLArgFlag.
Definition at line 376 of file CLArgFlag.cpp.
{ const char str[] = { '-', flag(), ' ', '\0' }; std::string result( str ); if( listData.accept_any_length() ) result += "<n1,n2,...>"; else result += listData.brief(); return result; }
virtual const CLArgs::ArgIBase* CLArgIntList::callback | ( | ) | const [inline, virtual] |
Implements CLArgFlag.
Definition at line 266 of file CLArgFlag.hpp.
References mCallback.
{ return mCallback; }
std::string CLArgIntList::manstr | ( | ) | const [virtual] |
Get UNIX man-page formated synposis of flag
Implements CLArgFlag.
Definition at line 389 of file CLArgFlag.cpp.
bool CLArgIntList::parse | ( | const char * | option | ) | const [virtual] |
Implements CLArgFlag.
Definition at line 394 of file CLArgFlag.cpp.
{ long i; char* endptr; std::vector< int > list; for( ;; ) { while( isspace( *str ) ) ++str; if( !*str ) break; i = strtol( str, &endptr, 0 ); list.push_back( i ); while( isspace( *str ) ) ++str; if( !*str ) break; if( *str != ',' ) return false; ++str; } if( !listData.acceptable_length( list.size() ) || !mCallback->value( list ) ) return false; mCallback->set_seen(); return true; }
CLArgListData CLArgIntList::listData [private] |
Definition at line 257 of file CLArgFlag.hpp.
Referenced by add_set().
CLArgs::IntListArgI* CLArgIntList::mCallback [private] |
Definition at line 258 of file CLArgFlag.hpp.
Referenced by callback().