Gui: Use auto and range-based for (#7481)

* On lines where the variable type is obvious from inspection, avoid repeating the type using auto. 
* When possible use a ranged for loop instead of begin() and end() iterators
This commit is contained in:
berniev
2022-09-15 04:25:13 +10:00
committed by GitHub
parent d7792826b4
commit 75acacd1b7
175 changed files with 2051 additions and 2057 deletions

View File

@@ -100,13 +100,13 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev)
// Keyboard handling
if (type.isDerivedFrom(SoKeyboardEvent::getClassTypeId())) {
const SoKeyboardEvent * const event = static_cast<const SoKeyboardEvent *>(ev);
const auto * const event = static_cast<const SoKeyboardEvent *>(ev);
processed = processKeyboardEvent(event);
}
// Mouse Button / Spaceball Button handling
if (type.isDerivedFrom(SoMouseButtonEvent::getClassTypeId())) {
const SoMouseButtonEvent * const event = (const SoMouseButtonEvent *) ev;
const auto * const event = (const SoMouseButtonEvent *) ev;
const int button = event->getButton();
const SbBool press = event->getState() == SoButtonEvent::DOWN ? true : false;
@@ -207,7 +207,7 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev)
// Mouse Movement handling
if (type.isDerivedFrom(SoLocation2Event::getClassTypeId())) {
this->lockrecenter = true;
const SoLocation2Event * const event = (const SoLocation2Event *) ev;
const auto * const event = (const SoLocation2Event *) ev;
if (this->currentmode == NavigationStyle::ZOOMING) {
this->zoomByCursor(posn, prevnormalized);
processed = true;
@@ -227,7 +227,7 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev)
// Spaceball & Joystick handling
if (type.isDerivedFrom(SoMotion3Event::getClassTypeId())) {
const SoMotion3Event * const event = static_cast<const SoMotion3Event *>(ev);
const auto * const event = static_cast<const SoMotion3Event *>(ev);
if (event)
this->processMotionEvent(event);
processed = true;