Add format script which invokes clang-format on the C++ source code (#41)

On Windows machines, clang-format.exe must be in the PATH environment variable.
This commit is contained in:
Tyler Veness
2016-05-20 17:30:37 -07:00
committed by Peter Johnson
parent 68690643d2
commit e14e45da76
383 changed files with 13787 additions and 13198 deletions

View File

@@ -8,34 +8,41 @@
#include "Buttons/Button.h"
/**
* Specifies the command to run when a button is first pressed
* Specifies the command to run when a button is first pressed.
*
* @param command The pointer to the command to run
*/
void Button::WhenPressed(Command *command) { WhenActive(command); }
void Button::WhenPressed(Command* command) { WhenActive(command); }
/**
* Specifies the command to be scheduled while the button is pressed
* Specifies the command to be scheduled while the button is pressed.
*
* The command will be scheduled repeatedly while the button is pressed and will
* be canceled when the button is released.
*
* @param command The pointer to the command to run
*/
void Button::WhileHeld(Command *command) { WhileActive(command); }
void Button::WhileHeld(Command* command) { WhileActive(command); }
/**
* Specifies the command to run when the button is released
* Specifies the command to run when the button is released.
*
* The command will be scheduled a single time.
* @param The pointer to the command to run
*
* @param command The pointer to the command to run
*/
void Button::WhenReleased(Command *command) { WhenInactive(command); }
void Button::WhenReleased(Command* command) { WhenInactive(command); }
/**
* Cancels the specificed command when the button is pressed
* @param The command to be canceled
* Cancels the specificed command when the button is pressed.
*
* @param command The command to be canceled
*/
void Button::CancelWhenPressed(Command *command) { CancelWhenActive(command); }
void Button::CancelWhenPressed(Command* command) { CancelWhenActive(command); }
/**
* Toggle the specified command when the button is pressed
* @param The command to be toggled
* Toggle the specified command when the button is pressed.
*
* @param command The command to be toggled
*/
void Button::ToggleWhenPressed(Command *command) { ToggleWhenActive(command); }
void Button::ToggleWhenPressed(Command* command) { ToggleWhenActive(command); }

View File

@@ -9,7 +9,7 @@
#include "Commands/Scheduler.h"
ButtonScheduler::ButtonScheduler(bool last, Trigger *button, Command *orders)
ButtonScheduler::ButtonScheduler(bool last, Trigger* button, Command* orders)
: m_pressedLast(last), m_button(button), m_command(orders) {}
void ButtonScheduler::Start() { Scheduler::GetInstance()->AddButton(this); }

View File

@@ -10,8 +10,8 @@
#include "Buttons/Button.h"
#include "Commands/Command.h"
CancelButtonScheduler::CancelButtonScheduler(bool last, Trigger *button,
Command *orders)
CancelButtonScheduler::CancelButtonScheduler(bool last, Trigger* button,
Command* orders)
: ButtonScheduler(last, button, orders) {
pressedLast = m_button->Grab();
}

View File

@@ -10,8 +10,8 @@
#include "Buttons/Button.h"
#include "Commands/Command.h"
HeldButtonScheduler::HeldButtonScheduler(bool last, Trigger *button,
Command *orders)
HeldButtonScheduler::HeldButtonScheduler(bool last, Trigger* button,
Command* orders)
: ButtonScheduler(last, button, orders) {}
void HeldButtonScheduler::Execute() {

View File

@@ -7,7 +7,7 @@
#include "Buttons/JoystickButton.h"
JoystickButton::JoystickButton(GenericHID *joystick, int buttonNumber)
JoystickButton::JoystickButton(GenericHID* joystick, int buttonNumber)
: m_joystick(joystick), m_buttonNumber(buttonNumber) {}
bool JoystickButton::Get() { return m_joystick->GetRawButton(m_buttonNumber); }

View File

@@ -8,12 +8,14 @@
#include "Buttons/NetworkButton.h"
#include "networktables/NetworkTable.h"
NetworkButton::NetworkButton(const std::string &tableName, const std::string &field)
NetworkButton::NetworkButton(const std::string& tableName,
const std::string& field)
: // TODO how is this supposed to work???
m_netTable(NetworkTable::GetTable(tableName)),
m_field(field) {}
NetworkButton::NetworkButton(std::shared_ptr<ITable> table, const std::string &field)
NetworkButton::NetworkButton(std::shared_ptr<ITable> table,
const std::string& field)
: m_netTable(table), m_field(field) {}
bool NetworkButton::Get() {

View File

@@ -10,8 +10,8 @@
#include "Buttons/Button.h"
#include "Commands/Command.h"
PressedButtonScheduler::PressedButtonScheduler(bool last, Trigger *button,
Command *orders)
PressedButtonScheduler::PressedButtonScheduler(bool last, Trigger* button,
Command* orders)
: ButtonScheduler(last, button, orders) {}
void PressedButtonScheduler::Execute() {

View File

@@ -10,8 +10,8 @@
#include "Buttons/Button.h"
#include "Commands/Command.h"
ReleasedButtonScheduler::ReleasedButtonScheduler(bool last, Trigger *button,
Command *orders)
ReleasedButtonScheduler::ReleasedButtonScheduler(bool last, Trigger* button,
Command* orders)
: ButtonScheduler(last, button, orders) {}
void ReleasedButtonScheduler::Execute() {

View File

@@ -10,8 +10,8 @@
#include "Buttons/Button.h"
#include "Commands/Command.h"
ToggleButtonScheduler::ToggleButtonScheduler(bool last, Trigger *button,
Command *orders)
ToggleButtonScheduler::ToggleButtonScheduler(bool last, Trigger* button,
Command* orders)
: ButtonScheduler(last, button, orders) {
pressedLast = m_button->Grab();
}

View File

@@ -7,11 +7,11 @@
#include "Buttons/Button.h"
#include "Buttons/CancelButtonScheduler.h"
#include "Buttons/HeldButtonScheduler.h"
#include "Buttons/PressedButtonScheduler.h"
#include "Buttons/ReleasedButtonScheduler.h"
#include "Buttons/ToggleButtonScheduler.h"
#include "Buttons/CancelButtonScheduler.h"
bool Trigger::Grab() {
if (Get())
@@ -25,27 +25,27 @@ bool Trigger::Grab() {
return false;
}
void Trigger::WhenActive(Command *command) {
void Trigger::WhenActive(Command* command) {
auto pbs = new PressedButtonScheduler(Grab(), this, command);
pbs->Start();
}
void Trigger::WhileActive(Command *command) {
void Trigger::WhileActive(Command* command) {
auto hbs = new HeldButtonScheduler(Grab(), this, command);
hbs->Start();
}
void Trigger::WhenInactive(Command *command) {
void Trigger::WhenInactive(Command* command) {
auto rbs = new ReleasedButtonScheduler(Grab(), this, command);
rbs->Start();
}
void Trigger::CancelWhenActive(Command *command) {
void Trigger::CancelWhenActive(Command* command) {
auto cbs = new CancelButtonScheduler(Grab(), this, command);
cbs->Start();
}
void Trigger::ToggleWhenActive(Command *command) {
void Trigger::ToggleWhenActive(Command* command) {
auto tbs = new ToggleButtonScheduler(Grab(), this, command);
tbs->Start();
}