ant
A2 ant: class-based analysis framework
ant::OptionsList Class Reference

#include <OptionsList.h>

+ Collaboration diagram for ant::OptionsList:

Classes

struct  option_t
 

Public Member Functions

 OptionsList (std::shared_ptr< const OptionsList > Parent=nullptr)
 
void SetOption (const std::string &str, const std::string delim="=")
 
void SetOptions (const std::string &str, const std::string optdelim=",", const std::string valdelim="=")
 
bool HasOption (const std::string &key) const
 HasOption. More...
 
bool HasOptionStartsWith (const std::string &key) const
 HasOptionStartsWith. More...
 
std::string OptionStartsWith (const std::string &key) const
 OptionStartsWith. More...
 
bool HasUnusedOptionStartsWith (const std::string &key) const
 HasUnusedOptionStartsWith. More...
 
std::string UnusedOptionStartsWith (const std::string &key) const
 UnusedOptionStartsWith. More...
 
std::string Flatten () const
 Flatten. More...
 
std::set< std::string > GetUnused () const
 GetUnused. More...
 
std::set< std::string > GetNotFound () const
 
template<typename T >
Get (const std::string &key, const T &def_value=T()) const
 main method to retrieve options, already parsed to requested type More...
 
template<>
bool Get (const string &key, const bool &def_value) const
 
template<>
bool Get (const std::string &key, const bool &def_value) const
 

Protected Types

using options_t = std::map< std::string, option_t >
 
using notfound_t = std::set< std::string >
 

Protected Member Functions

std::string GetOption (const std::string &key) const
 

Protected Attributes

OptionsPtr parent
 
std::unique_ptr< options_toptions
 
std::unique_ptr< notfound_tnotfound
 

Member Typedef Documentation

◆ notfound_t

using ant::OptionsList::notfound_t = std::set<std::string>
protected

◆ options_t

using ant::OptionsList::options_t = std::map<std::string, option_t>
protected

Constructor & Destructor Documentation

◆ OptionsList()

OptionsList::OptionsList ( std::shared_ptr< const OptionsList Parent = nullptr)

Member Function Documentation

◆ Flatten()

string OptionsList::Flatten ( ) const

Flatten.

Returns
the instance as string representation

◆ Get() [1/3]

template<typename T >
T ant::OptionsList::Get ( const std::string &  key,
const T &  def_value = T() 
) const
inline

main method to retrieve options, already parsed to requested type

Returns
the parsed value on success, or the default value

◆ Get() [2/3]

template<>
bool ant::OptionsList::Get ( const std::string &  key,
const bool &  def_value 
) const

◆ Get() [3/3]

template<>
bool ant::OptionsList::Get ( const string &  key,
const bool &  def_value 
) const

◆ GetNotFound()

std::set< string > OptionsList::GetNotFound ( ) const

◆ GetOption()

string OptionsList::GetOption ( const std::string &  key) const
protected

◆ GetUnused()

std::set< string > OptionsList::GetUnused ( ) const

GetUnused.

Returns
string representations of options which were not used by GetOption

◆ HasOption()

bool OptionsList::HasOption ( const std::string &  key) const

HasOption.

Parameters
key
Returns
bool if the option is set

◆ HasOptionStartsWith()

bool OptionsList::HasOptionStartsWith ( const std::string &  key) const

HasOptionStartsWith.

Parameters
key
Returns
bool if the option starts with the given string parameter key

◆ HasUnusedOptionStartsWith()

bool OptionsList::HasUnusedOptionStartsWith ( const std::string &  key) const

HasUnusedOptionStartsWith.

Parameters
key
Returns
bool if there's an unused option starting with the given string parameter key

◆ OptionStartsWith()

string OptionsList::OptionStartsWith ( const std::string &  key) const

OptionStartsWith.

Parameters
key
Returns
string with option key if it starts with the given string parameter key

◆ SetOption()

void OptionsList::SetOption ( const std::string &  str,
const std::string  delim = "=" 
)

◆ SetOptions()

void OptionsList::SetOptions ( const std::string &  str,
const std::string  optdelim = ",",
const std::string  valdelim = "=" 
)

◆ UnusedOptionStartsWith()

string OptionsList::UnusedOptionStartsWith ( const std::string &  key) const

UnusedOptionStartsWith.

Parameters
key
Returns
string unused option key if it starts with the given string parameter key

Member Data Documentation

◆ notfound

std::unique_ptr< notfound_t > ant::OptionsList::notfound
protected

◆ options

std::unique_ptr< options_t > ant::OptionsList::options
protected

◆ parent

OptionsPtr ant::OptionsList::parent
protected

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