CASM  1.1.0
A Clusters Approach to Statistical Mechanics
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 96 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
 
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

◆ ARG_TYPE

Definition at line 98 of file Complete.hh.

◆ size_type

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

Definition at line 97 of file Complete.hh.

Constructor & Destructor Documentation

◆ Option() [1/2]

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

Construct with program options.

Definition at line 102 of file Complete.cc.

◆ Option() [2/2]

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 98 of file Complete.cc.

Member Function Documentation

◆ matches()

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 148 of file Complete.cc.

◆ probe_argument_type()

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 137 of file Complete.cc.

◆ probe_suboptions()

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 120 of file Complete.cc.

◆ push_back()

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

Append a new suboption to the option.

◆ tag()

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

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

Definition at line 113 of file Complete.cc.

Member Data Documentation

◆ m_avail_suboptions

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

List of all the available –suboptions this option has.

Definition at line 131 of file Complete.hh.

◆ m_tag

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

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

Definition at line 127 of file Complete.hh.


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