Command: Code cleanup, added ::category accessor

- The Command object failed to initialize all member on construction and
  initialized them out of order (is this still a thing in C++11?).
- The _category was the only member with no accessor, which is not right.
This commit is contained in:
Paul Beckingham 2015-09-06 14:07:21 -04:00
parent 77b17379d6
commit d1fe1279ed
3 changed files with 32 additions and 23 deletions

View file

@ -213,7 +213,7 @@ const std::map <Command::Category, std::string> Command::categoryNames =
////////////////////////////////////////////////////////////////////////////////
Command::Command ()
: _category(Category::unassigned)
: _keyword ("")
, _usage ("")
, _description ("")
, _read_only (true)
@ -221,8 +221,10 @@ Command::Command ()
, _needs_confirm (false)
, _needs_gc (true)
, _uses_context (false)
, _accepts_filter (true)
, _accepts_modifications (true)
, _accepts_filter (false)
, _accepts_modifications (false)
, _accepts_miscellaneous (false)
, _category(Category::unassigned)
, _permission_quit (false)
, _permission_all (false)
, _first_iteration (true)
@ -294,6 +296,12 @@ bool Command::accepts_miscellaneous () const
return _accepts_miscellaneous;
}
////////////////////////////////////////////////////////////////////////////////
Command::Category Command::category () const
{
return _category;
}
////////////////////////////////////////////////////////////////////////////////
// Returns true or false indicating whether to proceed with a write command, on
// a per-task basis, after (potentially) asking for permission.