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

#include <CLArgFlag.hpp>

Public Member Functions

bool add_set (int size, const char *const *names)
bool acceptable_length (unsigned len) const
bool accept_any_length () const
std::string set_string (int set) const
std::string brief () const
std::string manstr (char type_char, const CLArgFlag &f) const

Private Attributes

std::vector< std::vector
< std::string > > 
mSets

Detailed Description

Definition at line 237 of file CLArgFlag.hpp.


Member Function Documentation

bool CLArgListData::accept_any_length ( ) const [inline]

Definition at line 244 of file CLArgFlag.hpp.

References mSets.

    {
        return mSets.empty();
    }
bool CLArgListData::acceptable_length ( unsigned  len) const

Definition at line 317 of file CLArgFlag.cpp.

{
    for( unsigned i = 0; i < mSets.size(); ++i )
        if( len == mSets[i].size() ) return true;
    return mSets.empty();
}
bool CLArgListData::add_set ( int  size,
const char *const *  names 
)

Definition at line 307 of file CLArgFlag.cpp.

Referenced by CLArgIntList::add_set(), and CLArgDoubleList::add_set().

{
    if( size < 0 || ( !mSets.empty() && acceptable_length( size ) ) ) return false;

    mSets.resize( mSets.size() + 1 );
    for( int i = 0; i < size; ++i )
        mSets.back().push_back( names[i] );
    return true;
}
std::string CLArgListData::brief ( ) const

Definition at line 335 of file CLArgFlag.cpp.

{
    if( mSets.empty() ) return std::string();

    std::ostringstream result;
    for( unsigned i = 0; i < mSets.size(); ++i )
    {
        if( i ) result << '|';
        result << '{' << set_string( i ) << "}";
    }
    return result.str();
}
std::string CLArgListData::manstr ( char  type_char,
const CLArgFlag f 
) const

Definition at line 348 of file CLArgFlag.cpp.

{
    if( mSets.empty() )
    {
        const char argstr[] = { type_char, '1', ',', type_char, '2', ',', '.', '.', '.', '\0' };
        return f.make_man_string( argstr );
    }
    else
    {
        const char flagstr[] = { '-', f.flag(), '\0' };
        std::ostringstream ss;
        for( unsigned i = 0; i < mSets.size(); ++i )
        {
            if( i ) ss << "|";
            ManPage::begin_bold( ss );
            ss << flagstr;
            ManPage::end_bold( ss );
            ss << "<" << set_string( i ) << ">";
        }
        return ss.str();
    }
}
std::string CLArgListData::set_string ( int  set) const

Definition at line 324 of file CLArgFlag.cpp.

{
    if( mSets[i].empty() ) return std::string();

    std::ostringstream result;
    result << mSets[i][0];
    for( unsigned j = 1; j < mSets[i].size(); ++j )
        result << "," << mSets[i][j];
    return result.str();
}

Member Data Documentation

std::vector< std::vector< std::string > > CLArgListData::mSets [private]

Definition at line 239 of file CLArgFlag.hpp.

Referenced by accept_any_length().

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