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:
Tyler Veness
2015-06-23 04:49:51 -07:00
parent 7a711a21f9
commit b1befed14f
113 changed files with 604 additions and 618 deletions

View File

@@ -39,16 +39,12 @@ void LiveWindow::SetEnabled(bool enabled) {
}
m_scheduler->SetEnabled(false);
m_scheduler->RemoveAll();
for (std::map<LiveWindowSendable *, LiveWindowComponent>::iterator it =
m_components.begin();
it != m_components.end(); ++it) {
it->first->StartLiveWindowMode();
for (auto& elem : m_components) {
elem.first->StartLiveWindowMode();
}
} else {
for (std::map<LiveWindowSendable *, LiveWindowComponent>::iterator it =
m_components.begin();
it != m_components.end(); ++it) {
it->first->StopLiveWindowMode();
for (auto& elem : m_components) {
elem.first->StopLiveWindowMode();
}
m_scheduler->SetEnabled(true);
}
@@ -94,7 +90,7 @@ void LiveWindow::AddSensor(std::string type, int channel,
std::ostringstream oss;
oss << type << "[" << channel << "]";
std::string types(oss.str());
char *cc = new char[types.size() + 1];
auto cc = new char[types.size() + 1];
types.copy(cc, types.size());
cc[types.size()] = '\0';
AddSensor("Ungrouped", cc, component);
@@ -111,7 +107,7 @@ void LiveWindow::AddActuator(std::string type, int channel,
std::ostringstream oss;
oss << type << "[" << channel << "]";
std::string types(oss.str());
char *cc = new char[types.size() + 1];
auto cc = new char[types.size() + 1];
types.copy(cc, types.size());
cc[types.size()] = '\0';
AddActuator("Ungrouped", cc, component);
@@ -125,7 +121,7 @@ void LiveWindow::AddActuator(std::string type, int module, int channel,
std::ostringstream oss;
oss << type << "[" << module << "," << channel << "]";
std::string types(oss.str());
char *cc = new char[types.size() + 1];
auto cc = new char[types.size() + 1];
types.copy(cc, types.size());
cc[types.size()] = '\0';
AddActuator("Ungrouped", cc, component);
@@ -137,8 +133,8 @@ void LiveWindow::AddActuator(std::string type, int module, int channel,
* SmartDashboard widgets.
*/
void LiveWindow::UpdateValues() {
for (unsigned int i = 0; i < m_sensors.size(); i++) {
m_sensors[i]->UpdateTable();
for (auto& elem : m_sensors) {
elem->UpdateTable();
}
}
@@ -164,11 +160,9 @@ void LiveWindow::Run() {
* addActuator and addSensor.
*/
void LiveWindow::InitializeLiveWindowComponents() {
for (std::map<LiveWindowSendable *, LiveWindowComponent>::iterator it =
m_components.begin();
it != m_components.end(); ++it) {
LiveWindowSendable *component = it->first;
LiveWindowComponent c = it->second;
for (auto& elem : m_components) {
LiveWindowSendable *component = elem.first;
LiveWindowComponent c = elem.second;
std::string subsystem = c.subsystem;
std::string name = c.name;
m_liveWindowTable->GetSubTable(subsystem)