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

#include <CLArgFlag.hpp>

+ Inheritance diagram for CLArgDoubleList:
+ Collaboration diagram for CLArgDoubleList:

Public Member Functions

 CLArgDoubleList (char fl, const char *pdesc, CLArgs::DoubleListArgI *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
std::string mName
CLArgs::DoubleListArgImCallback

Detailed Description

Definition at line 281 of file CLArgFlag.hpp.


Constructor & Destructor Documentation

CLArgDoubleList::CLArgDoubleList ( char  fl,
const char *  pdesc,
CLArgs::DoubleListArgI pcallback 
) [inline]

Definition at line 289 of file CLArgFlag.hpp.

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

Member Function Documentation

virtual bool CLArgDoubleList::add_set ( int  size,
const char *const *  names 
) [inline, virtual]

Reimplemented from CLArgFlag.

Definition at line 303 of file CLArgFlag.hpp.

References CLArgListData::add_set(), and listData.

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

Get brief format of option

Implements CLArgFlag.

Definition at line 424 of file CLArgFlag.cpp.

{
    const char str[] = { '-', flag(), ' ', '\0' };
    std::string result( str );

    if( listData.accept_any_length() )
        result += "<r1,r2,...>";
    else
        result += listData.brief();

    return result;
}
virtual const CLArgs::ArgIBase* CLArgDoubleList::callback ( ) const [inline, virtual]

Implements CLArgFlag.

Definition at line 294 of file CLArgFlag.hpp.

References mCallback.

    {
        return mCallback;
    }
std::string CLArgDoubleList::manstr ( ) const [virtual]

Get UNIX man-page formated synposis of flag

Implements CLArgFlag.

Definition at line 437 of file CLArgFlag.cpp.

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

Implements CLArgFlag.

Definition at line 442 of file CLArgFlag.cpp.

{
    std::vector< double > list;
    char* endptr;
    for( ;; )
    {
        while( isspace( *str ) )
            ++str;
        if( !*str ) break;

        double d = strtod( str, &endptr );
        list.push_back( d );
        str = endptr;

        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 284 of file CLArgFlag.hpp.

Referenced by add_set().

Definition at line 286 of file CLArgFlag.hpp.

Referenced by callback().

std::string CLArgDoubleList::mName [private]

Definition at line 285 of file CLArgFlag.hpp.

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