mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-01 02:41:48 +00:00
artf4107: clang-modernize was run on WPILib
Loops were converted to their range-based equivalents, variable types were replaced with auto where the type was already specified on the same line, the override keyword was added, and instances of NULL and assignments of 0 to pointers were replaced with nullptr. Change-Id: If281e46a2e2e1c37f278d56df9915236d4b2c864
This commit is contained in:
@@ -16,12 +16,12 @@
|
||||
* @param name the name of the subsystem
|
||||
*/
|
||||
Subsystem::Subsystem(const char *name)
|
||||
: m_currentCommand(NULL),
|
||||
m_defaultCommand(NULL),
|
||||
: m_currentCommand(nullptr),
|
||||
m_defaultCommand(nullptr),
|
||||
m_initializedDefaultCommand(false) {
|
||||
m_name = name;
|
||||
Scheduler::GetInstance()->RegisterSubsystem(this);
|
||||
m_table = NULL;
|
||||
m_table = nullptr;
|
||||
m_currentCommandChanged = true;
|
||||
}
|
||||
/**
|
||||
@@ -47,12 +47,12 @@ void Subsystem::InitDefaultCommand() {}
|
||||
* @param command the default command (or null if there should be none)
|
||||
*/
|
||||
void Subsystem::SetDefaultCommand(Command *command) {
|
||||
if (command == NULL) {
|
||||
m_defaultCommand = NULL;
|
||||
if (command == nullptr) {
|
||||
m_defaultCommand = nullptr;
|
||||
} else {
|
||||
bool found = false;
|
||||
Command::SubsystemSet requirements = command->GetRequirements();
|
||||
Command::SubsystemSet::iterator iter = requirements.begin();
|
||||
auto iter = requirements.begin();
|
||||
for (; iter != requirements.end(); iter++) {
|
||||
if (*iter == this) {
|
||||
found = true;
|
||||
@@ -68,8 +68,8 @@ void Subsystem::SetDefaultCommand(Command *command) {
|
||||
|
||||
m_defaultCommand = command;
|
||||
}
|
||||
if (m_table != NULL) {
|
||||
if (m_defaultCommand != NULL) {
|
||||
if (m_table != nullptr) {
|
||||
if (m_defaultCommand != nullptr) {
|
||||
m_table->PutBoolean("hasDefault", true);
|
||||
m_table->PutString("default", m_defaultCommand->GetName());
|
||||
} else {
|
||||
@@ -115,8 +115,8 @@ Command *Subsystem::GetCurrentCommand() const { return m_currentCommand; }
|
||||
*/
|
||||
void Subsystem::ConfirmCommand() {
|
||||
if (m_currentCommandChanged) {
|
||||
if (m_table != NULL) {
|
||||
if (m_currentCommand != NULL) {
|
||||
if (m_table != nullptr) {
|
||||
if (m_currentCommand != nullptr) {
|
||||
m_table->PutBoolean("hasCommand", true);
|
||||
m_table->PutString("command", m_currentCommand->GetName());
|
||||
} else {
|
||||
@@ -133,14 +133,14 @@ std::string Subsystem::GetSmartDashboardType() const { return "Subsystem"; }
|
||||
|
||||
void Subsystem::InitTable(ITable *table) {
|
||||
m_table = table;
|
||||
if (m_table != NULL) {
|
||||
if (m_defaultCommand != NULL) {
|
||||
if (m_table != nullptr) {
|
||||
if (m_defaultCommand != nullptr) {
|
||||
m_table->PutBoolean("hasDefault", true);
|
||||
m_table->PutString("default", m_defaultCommand->GetName());
|
||||
} else {
|
||||
m_table->PutBoolean("hasDefault", false);
|
||||
}
|
||||
if (m_currentCommand != NULL) {
|
||||
if (m_currentCommand != nullptr) {
|
||||
m_table->PutBoolean("hasCommand", true);
|
||||
m_table->PutString("command", m_currentCommand->GetName());
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user