[commands] Add convenience factories (#4460)

Co-authored-by: Starlight220 <53231611+Starlight220@users.noreply.github.com>
This commit is contained in:
Eli Barnett
2022-11-28 10:41:25 -05:00
committed by GitHub
parent 42b6d4e3f7
commit 1a59737f40
31 changed files with 1240 additions and 1 deletions

View File

@@ -282,6 +282,15 @@ safe) semantics.
*/
[[nodiscard]] CommandPtr HandleInterrupt(std::function<void()> handler) &&;
/**
* Decorates this Command with a name. Is an inline function for
* #SetName(std::string_view);
*
* @param name name
* @return the decorated Command
*/
[[nodiscard]] CommandPtr WithName(std::string_view name) &&;
/**
* Schedules this command.
*/
@@ -343,8 +352,21 @@ safe) semantics.
return InterruptionBehavior::kCancelSelf;
}
/**
* Gets the name of this Command. Defaults to the simple class name if not
* overridden.
*
* @return The display name of the Command
*/
virtual std::string GetName() const;
/**
* Sets the name of this Command. Nullop if not overridden.
*
* @param name The display name of the Command.
*/
virtual void SetName(std::string_view name);
/**
* Transfers ownership of this command to a unique pointer. Used for
* decorator methods.