MOAB: Mesh Oriented datABase  (version 5.3.1)
CLArgIntList Class Reference

#include <CLArgFlag.hpp>

+ Inheritance diagram for CLArgIntList:
+ Collaboration diagram for CLArgIntList:

Public Member Functions

 CLArgIntList (char fl, const char *pdesc, CLArgs::IntListArgI *pcallback)
virtual const CLArgs::ArgIBasecallback () 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::IntListArgImCallback

Detailed Description

Definition at line 254 of file CLArgFlag.hpp.


Constructor & Destructor Documentation

CLArgIntList::CLArgIntList ( char  fl,
const char *  pdesc,
CLArgs::IntListArgI pcallback 
) [inline]

Definition at line 261 of file CLArgFlag.hpp.

        : CLArgFlag( fl, pdesc ), mCallback( pcallback )
    {
    }

Member Function Documentation

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.

    {
        return listData.add_set( size, names );
    }
std::string CLArgIntList::brief ( ) const [virtual]

Get brief format of option

Implements CLArgFlag.

Definition at line 373 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 386 of file CLArgFlag.cpp.

{
    return listData.manstr( 'n', *this );
}
bool CLArgIntList::parse ( const char *  option) const [virtual]

Implements CLArgFlag.

Definition at line 391 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;
}

Member Data Documentation

Definition at line 257 of file CLArgFlag.hpp.

Referenced by add_set().

Definition at line 258 of file CLArgFlag.hpp.

Referenced by callback().

List of all members.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines