#include <schroot-base-option-action.h>
Public Types | |
typedef std::string | action_type |
Public Member Functions | |
option_action () | |
The constructor. | |
virtual | ~option_action () |
The destructor. | |
void | add (action_type const &action) |
Add an action. | |
action_type const & | get_default () |
void | set_default (action_type const &action) |
Set the default action. | |
action_type const & | get () |
void | set (action_type const &action) |
Set the action to perform. | |
bool | valid (action_type const &action) |
Check if an action is valid. | |
option_action & | operator= (action_type const &action) |
bool | operator== (action_type const &action) |
bool | operator!= (action_type const &action) |
Private Types | |
typedef std::set< std::string > | action_set |
The container of the actions. | |
Private Attributes | |
std::string | default_action |
Default action. | |
std::string | current_action |
Current action. | |
action_set | actions |
Allowed actions. |
This class contains all allowed options. This replaced the use of enums to allow extension of the options by inheritance.
typedef std::string schroot_base::option_action::action_type |
typedef std::set<std::string> schroot_base::option_action::action_set [private] |
The container of the actions.
option_action::option_action | ( | ) |
The constructor.
option_action::~option_action | ( | ) | [virtual] |
The destructor.
void option_action::add | ( | action_type const & | action | ) |
Add an action.
The specified action is added to the list of permitted actions.
action | the action to add. |
References actions.
Referenced by schroot_base::options::add_options().
option_action::action_type const & option_action::get_default | ( | ) |
References default_action.
void option_action::set_default | ( | action_type const & | action | ) |
Set the default action.
action | the action to set. |
References default_action, and valid().
option_action::action_type const & option_action::get | ( | ) |
References current_action, and default_action.
void option_action::set | ( | action_type const & | action | ) |
Set the action to perform.
This detects if an action has already been set (only one action may be specified at once).
action | the action to set. |
References current_action, and valid().
bool option_action::valid | ( | action_type const & | action | ) |
Check if an action is valid.
action | the action to check. |
References actions.
Referenced by set(), and set_default().
option_action& schroot_base::option_action::operator= | ( | action_type const & | action | ) | [inline] |
bool schroot_base::option_action::operator== | ( | action_type const & | action | ) | [inline] |
bool schroot_base::option_action::operator!= | ( | action_type const & | action | ) | [inline] |
std::string schroot_base::option_action::default_action [private] |
std::string schroot_base::option_action::current_action [private] |