CASM
AClustersApproachtoStatisticalMechanics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
CASM::Completer::Option Class Reference

#include <Complete.hh>

Detailed Description

A typical casm command takes 3 types of arguments: Option: Things like "super", "enum", "monte", etc Suboption: Anything that starts with "--" or "-", such as "--max" or "-z" Argument: The argument you pass to the suboption, such as an integer or filename

The Option class has a string that identifies it (e.g. "enum"), as well as a list of Suboptions that it can take.

Definition at line 92 of file Complete.hh.

Public Member Functions

 Option (const std::string &init_tag, const po::options_description &init_premade_descs)
 Construct with program options. More...
 
std::string tag () const
 Return the identifying name of *this (e.g. "super", "monte", etc) More...
 
std::vector< std::string > probe_suboptions () const
 Return what the suboptions (–long format) for *this are. More...
 
ARG_TYPE probe_argument_type (const std::string &suboption_tag) const
 For a particular –suboption, get what kind of arguments are expected. suboption_tag should be pre-stripped. More...
 
void push_back (const Suboption &new_suboption)
 Append a new suboption to the option. More...
 
bool matches (const std::string &test_tag) const
 Check if the given string corresponds to the tag of *this. More...
 

Private Types

typedef std::size_t size_type
 
typedef ArgHandler::ARG_TYPE ARG_TYPE
 

Private Member Functions

 Option (const std::string &init_tag, const std::vector< Suboption > &init_allowed_subopts)
 Construct manually passing all values needed. More...
 

Private Attributes

std::string m_tag
 Name that identifies this casm option (e.g. "monte", "init", etc) More...
 
std::vector< Suboptionm_avail_suboptions
 List of all the available –suboptions this option has. More...
 

Member Typedef Documentation

Definition at line 94 of file Complete.hh.

typedef std::size_t CASM::Completer::Option::size_type
private

Definition at line 93 of file Complete.hh.

Constructor & Destructor Documentation

CASM::Completer::Option::Option ( const std::string &  init_tag,
const po::options_description &  init_premade_descs 
)

Construct with program options.

Definition at line 100 of file Complete.cc.

CASM::Completer::Option::Option ( const std::string &  init_tag,
const std::vector< Suboption > &  init_allowed_subopts 
)
private

Construct manually passing all values needed.

Definition at line 95 of file Complete.cc.

Member Function Documentation

bool CASM::Completer::Option::matches ( const std::string &  test_tag) const

Check if the given string corresponds to the tag of *this.

Definition at line 144 of file Complete.cc.

ARG_TYPE CASM::Completer::Option::probe_argument_type ( const std::string &  suboption_tag) const

For a particular –suboption, get what kind of arguments are expected. suboption_tag should be pre-stripped.

Runs through all the available Suboptions trying to match the provided suboption_tag. If the suboption_tag matches, then return the expected type of arguments of that suboption, if the provided tag doesn't match anything, then default to returning VOID, i.e. no completion should be done by bash.

Definition at line 134 of file Complete.cc.

std::vector< std::string > CASM::Completer::Option::probe_suboptions ( ) const

Return what the suboptions (–long format) for *this are.

Runs through all the stored Suboptions and creates a list of each –long tag they have. The list of strings is then returned.

Definition at line 118 of file Complete.cc.

void CASM::Completer::Option::push_back ( const Suboption new_suboption)

Append a new suboption to the option.

std::string CASM::Completer::Option::tag ( ) const

Return the identifying name of *this (e.g. "super", "monte", etc)

Definition at line 109 of file Complete.cc.

Member Data Documentation

std::vector<Suboption> CASM::Completer::Option::m_avail_suboptions
private

List of all the available –suboptions this option has.

Definition at line 125 of file Complete.hh.

std::string CASM::Completer::Option::m_tag
private

Name that identifies this casm option (e.g. "monte", "init", etc)

Definition at line 122 of file Complete.hh.


The documentation for this class was generated from the following files: