diff --git a/src/proc/control/command-impl.hpp b/src/proc/control/command-impl.hpp index 58c906315..5aa4ce533 100644 --- a/src/proc/control/command-impl.hpp +++ b/src/proc/control/command-impl.hpp @@ -163,31 +163,30 @@ namespace control { /* === diagnostics === */ bool - isValid() const + isValid() const ///< validity self-check: is basically usable. { - UNIMPLEMENTED ("command validity self check"); + return bool(pClo_) + && HandlingPattern::get(defaultPatt_).isValid(); } bool - canExec() const + canExec() const ///< state check: sufficiently defined to be invoked { - UNIMPLEMENTED ("state check: sufficiently defined to be invoked"); + return isValid() + && *pClo_ && do_; } bool - canUndo() const + canUndo() const ///< state check: has undo state been captured? { - UNIMPLEMENTED ("state check: has undo state been captured?"); + return isValid() && undo_; } protected: -// static Command& fetchDef (Symbol cmdID); - -// friend class CommandDef; - + }; ////////////////TODO currently just fleshing out the API.... diff --git a/src/proc/control/handling-pattern.hpp b/src/proc/control/handling-pattern.hpp index 67b326c81..09fad5b65 100644 --- a/src/proc/control/handling-pattern.hpp +++ b/src/proc/control/handling-pattern.hpp @@ -77,6 +77,7 @@ namespace control { * @todo Type-comment */ class HandlingPattern + : public lib::BoolCheckable { public: @@ -106,6 +107,7 @@ namespace control { HandlingPattern const& howtoUNDO() const; + virtual bool isValid() const =0; protected: @@ -114,6 +116,7 @@ namespace control { virtual HandlingPattern const& defineUNDO() const =0; + }; ////////////////TODO currently just fleshing out the API.... diff --git a/src/proc/control/handling-patterns.hpp b/src/proc/control/handling-patterns.hpp index b692aafae..f4f86313a 100644 --- a/src/proc/control/handling-patterns.hpp +++ b/src/proc/control/handling-patterns.hpp @@ -85,6 +85,12 @@ namespace control { { UNIMPLEMENTED ("yield a handling pattern suitable for UNDOing a command, according to this pattern"); } + + bool + isValid() const + { + UNIMPLEMENTED ("is this pattern currently able to handle commands?"); + } }; @@ -107,6 +113,12 @@ namespace control { { UNIMPLEMENTED ("yield a handling pattern suitable for UNDOing a command, according to this pattern"); } + + bool + isValid() const + { + UNIMPLEMENTED ("is this pattern currently able to handle commands?"); + } }; @@ -129,6 +141,12 @@ namespace control { { UNIMPLEMENTED ("yield a handling pattern suitable for UNDOing a command, according to this pattern"); } + + bool + isValid() const + { + UNIMPLEMENTED ("is this pattern currently able to handle commands?"); + } };