Update formatting to clang-format 16 (#5370)

This commit is contained in:
Tyler Veness
2023-05-31 22:10:53 -07:00
committed by GitHub
parent a94a998002
commit 5fac18ff4a
48 changed files with 654 additions and 434 deletions

View File

@@ -27,7 +27,8 @@ namespace cmd {
/**
* Constructs a command that does nothing, finishing immediately.
*/
[[nodiscard]] CommandPtr None();
[[nodiscard]]
CommandPtr None();
// Action Commands
@@ -37,9 +38,9 @@ namespace cmd {
* @param action the action to run
* @param requirements subsystems the action requires
*/
[[nodiscard]] CommandPtr RunOnce(
std::function<void()> action,
std::initializer_list<Subsystem*> requirements);
[[nodiscard]]
CommandPtr RunOnce(std::function<void()> action,
std::initializer_list<Subsystem*> requirements);
/**
* Constructs a command that runs an action once and finishes.
@@ -47,8 +48,9 @@ namespace cmd {
* @param action the action to run
* @param requirements subsystems the action requires
*/
[[nodiscard]] CommandPtr RunOnce(std::function<void()> action,
std::span<Subsystem* const> requirements = {});
[[nodiscard]]
CommandPtr RunOnce(std::function<void()> action,
std::span<Subsystem* const> requirements = {});
/**
* Constructs a command that runs an action every iteration until interrupted.
@@ -56,8 +58,9 @@ namespace cmd {
* @param action the action to run
* @param requirements subsystems the action requires
*/
[[nodiscard]] CommandPtr Run(std::function<void()> action,
std::initializer_list<Subsystem*> requirements);
[[nodiscard]]
CommandPtr Run(std::function<void()> action,
std::initializer_list<Subsystem*> requirements);
/**
* Constructs a command that runs an action every iteration until interrupted.
@@ -65,8 +68,9 @@ namespace cmd {
* @param action the action to run
* @param requirements subsystems the action requires
*/
[[nodiscard]] CommandPtr Run(std::function<void()> action,
std::span<Subsystem* const> requirements = {});
[[nodiscard]]
CommandPtr Run(std::function<void()> action,
std::span<Subsystem* const> requirements = {});
/**
* Constructs a command that runs an action once and another action when the
@@ -76,9 +80,9 @@ namespace cmd {
* @param end the action to run on interrupt
* @param requirements subsystems the action requires
*/
[[nodiscard]] CommandPtr StartEnd(
std::function<void()> start, std::function<void()> end,
std::initializer_list<Subsystem*> requirements);
[[nodiscard]]
CommandPtr StartEnd(std::function<void()> start, std::function<void()> end,
std::initializer_list<Subsystem*> requirements);
/**
* Constructs a command that runs an action once and another action when the
@@ -88,9 +92,9 @@ namespace cmd {
* @param end the action to run on interrupt
* @param requirements subsystems the action requires
*/
[[nodiscard]] CommandPtr StartEnd(
std::function<void()> start, std::function<void()> end,
std::span<Subsystem* const> requirements = {});
[[nodiscard]]
CommandPtr StartEnd(std::function<void()> start, std::function<void()> end,
std::span<Subsystem* const> requirements = {});
/**
* Constructs a command that runs an action every iteration until interrupted,
@@ -100,9 +104,9 @@ namespace cmd {
* @param end the action to run on interrupt
* @param requirements subsystems the action requires
*/
[[nodiscard]] CommandPtr RunEnd(std::function<void()> run,
std::function<void()> end,
std::initializer_list<Subsystem*> requirements);
[[nodiscard]]
CommandPtr RunEnd(std::function<void()> run, std::function<void()> end,
std::initializer_list<Subsystem*> requirements);
/**
* Constructs a command that runs an action every iteration until interrupted,
@@ -112,16 +116,17 @@ namespace cmd {
* @param end the action to run on interrupt
* @param requirements subsystems the action requires
*/
[[nodiscard]] CommandPtr RunEnd(std::function<void()> run,
std::function<void()> end,
std::span<Subsystem* const> requirements = {});
[[nodiscard]]
CommandPtr RunEnd(std::function<void()> run, std::function<void()> end,
std::span<Subsystem* const> requirements = {});
/**
* Constructs a command that prints a message and finishes.
*
* @param msg the message to print
*/
[[nodiscard]] CommandPtr Print(std::string_view msg);
[[nodiscard]]
CommandPtr Print(std::string_view msg);
// Idling Commands
@@ -130,7 +135,8 @@ namespace cmd {
*
* @param duration after how long the command finishes
*/
[[nodiscard]] CommandPtr Wait(units::second_t duration);
[[nodiscard]]
CommandPtr Wait(units::second_t duration);
/**
* Constructs a command that does nothing, finishing once a condition becomes
@@ -138,7 +144,8 @@ namespace cmd {
*
* @param condition the condition
*/
[[nodiscard]] CommandPtr WaitUntil(std::function<bool()> condition);
[[nodiscard]]
CommandPtr WaitUntil(std::function<bool()> condition);
// Selector Commands
@@ -149,8 +156,9 @@ namespace cmd {
* @param onFalse the command to run if the selector function returns false
* @param selector the selector function
*/
[[nodiscard]] CommandPtr Either(CommandPtr&& onTrue, CommandPtr&& onFalse,
std::function<bool()> selector);
[[nodiscard]]
CommandPtr Either(CommandPtr&& onTrue, CommandPtr&& onFalse,
std::function<bool()> selector);
/**
* Runs one of several commands, based on the selector function.
@@ -159,8 +167,9 @@ namespace cmd {
* @param commands map of commands to select from
*/
template <typename Key, class... Types>
[[nodiscard]] CommandPtr Select(std::function<Key()> selector,
std::pair<Key, Types>&&... commands) {
[[nodiscard]]
CommandPtr Select(std::function<Key()> selector,
std::pair<Key, Types>&&... commands) {
std::vector<std::pair<Key, std::unique_ptr<Command>>> vec;
((void)vec.emplace_back(commands.first, std::move(commands.second).Unwrap()),
@@ -189,13 +198,15 @@ std::vector<CommandPtr> MakeVector(Args&&... args) {
/**
* Runs a group of commands in series, one after the other.
*/
[[nodiscard]] CommandPtr Sequence(std::vector<CommandPtr>&& commands);
[[nodiscard]]
CommandPtr Sequence(std::vector<CommandPtr>&& commands);
/**
* Runs a group of commands in series, one after the other.
*/
template <typename... Args>
[[nodiscard]] CommandPtr Sequence(Args&&... commands) {
[[nodiscard]]
CommandPtr Sequence(Args&&... commands) {
return Sequence(impl::MakeVector(std::forward<Args>(commands)...));
}
@@ -203,14 +214,16 @@ template <typename... Args>
* Runs a group of commands in series, one after the other. Once the last
* command ends, the group is restarted.
*/
[[nodiscard]] CommandPtr RepeatingSequence(std::vector<CommandPtr>&& commands);
[[nodiscard]]
CommandPtr RepeatingSequence(std::vector<CommandPtr>&& commands);
/**
* Runs a group of commands in series, one after the other. Once the last
* command ends, the group is restarted.
*/
template <typename... Args>
[[nodiscard]] CommandPtr RepeatingSequence(Args&&... commands) {
[[nodiscard]]
CommandPtr RepeatingSequence(Args&&... commands) {
return RepeatingSequence(impl::MakeVector(std::forward<Args>(commands)...));
}
@@ -218,14 +231,16 @@ template <typename... Args>
* Runs a group of commands at the same time. Ends once all commands in the
* group finish.
*/
[[nodiscard]] CommandPtr Parallel(std::vector<CommandPtr>&& commands);
[[nodiscard]]
CommandPtr Parallel(std::vector<CommandPtr>&& commands);
/**
* Runs a group of commands at the same time. Ends once all commands in the
* group finish.
*/
template <typename... Args>
[[nodiscard]] CommandPtr Parallel(Args&&... commands) {
[[nodiscard]]
CommandPtr Parallel(Args&&... commands) {
return Parallel(impl::MakeVector(std::forward<Args>(commands)...));
}
@@ -233,14 +248,16 @@ template <typename... Args>
* Runs a group of commands at the same time. Ends once any command in the group
* finishes, and cancels the others.
*/
[[nodiscard]] CommandPtr Race(std::vector<CommandPtr>&& commands);
[[nodiscard]]
CommandPtr Race(std::vector<CommandPtr>&& commands);
/**
* Runs a group of commands at the same time. Ends once any command in the group
* finishes, and cancels the others.
*/
template <typename... Args>
[[nodiscard]] CommandPtr Race(Args&&... commands) {
[[nodiscard]]
CommandPtr Race(Args&&... commands) {
return Race(impl::MakeVector(std::forward<Args>(commands)...));
}
@@ -248,15 +265,16 @@ template <typename... Args>
* Runs a group of commands at the same time. Ends once a specific command
* finishes, and cancels the others.
*/
[[nodiscard]] CommandPtr Deadline(CommandPtr&& deadline,
std::vector<CommandPtr>&& others);
[[nodiscard]]
CommandPtr Deadline(CommandPtr&& deadline, std::vector<CommandPtr>&& others);
/**
* Runs a group of commands at the same time. Ends once a specific command
* finishes, and cancels the others.
*/
template <typename... Args>
[[nodiscard]] CommandPtr Deadline(CommandPtr&& deadline, Args&&... commands) {
[[nodiscard]]
CommandPtr Deadline(CommandPtr&& deadline, Args&&... commands) {
return Deadline(std::move(deadline),
impl::MakeVector(std::forward<Args>(commands)...));
}