mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
Add braces to C++ single-line loops and conditionals (NFC) (#2973)
This makes code easier to read and more consistent between C++ and Java. Also update clang-format settings to always add a line break (even if no braces are used).
This commit is contained in:
@@ -44,21 +44,29 @@ void HALProvider::Update() {
|
||||
// check for visible windows that need displays (typically this is due to
|
||||
// file loading)
|
||||
for (auto&& window : m_windows) {
|
||||
if (!window->IsVisible() || window->HasView()) continue;
|
||||
if (!window->IsVisible() || window->HasView()) {
|
||||
continue;
|
||||
}
|
||||
auto id = window->GetId();
|
||||
auto it = FindViewEntry(id);
|
||||
if (it == m_viewEntries.end() || (*it)->name != id) continue;
|
||||
if (it == m_viewEntries.end() || (*it)->name != id) {
|
||||
continue;
|
||||
}
|
||||
Show(it->get(), window.get());
|
||||
}
|
||||
}
|
||||
|
||||
glass::Model* HALProvider::GetModel(wpi::StringRef name) {
|
||||
auto it = FindModelEntry(name);
|
||||
if (it == m_modelEntries.end() || (*it)->name != name) return nullptr;
|
||||
if (it == m_modelEntries.end() || (*it)->name != name) {
|
||||
return nullptr;
|
||||
}
|
||||
auto entry = it->get();
|
||||
|
||||
// get or create model
|
||||
if (!entry->model) entry->model = entry->createModel();
|
||||
if (!entry->model) {
|
||||
entry->model = entry->createModel();
|
||||
}
|
||||
return entry->model.get();
|
||||
}
|
||||
|
||||
@@ -70,18 +78,27 @@ void HALProvider::Show(ViewEntry* entry, glass::Window* window) {
|
||||
}
|
||||
|
||||
// get or create model
|
||||
if (!entry->modelEntry->model)
|
||||
if (!entry->modelEntry->model) {
|
||||
entry->modelEntry->model = entry->modelEntry->createModel();
|
||||
if (!entry->modelEntry->model) return;
|
||||
}
|
||||
if (!entry->modelEntry->model) {
|
||||
return;
|
||||
}
|
||||
|
||||
// the window might exist and we're just not associated to it yet
|
||||
if (!window) window = GetOrAddWindow(entry->name, true);
|
||||
if (!window) return;
|
||||
if (!window) {
|
||||
window = GetOrAddWindow(entry->name, true);
|
||||
}
|
||||
if (!window) {
|
||||
return;
|
||||
}
|
||||
entry->window = window;
|
||||
|
||||
// create view
|
||||
auto view = entry->createView(window, entry->modelEntry->model.get());
|
||||
if (!view) return;
|
||||
if (!view) {
|
||||
return;
|
||||
}
|
||||
window->SetView(std::move(view));
|
||||
|
||||
entry->window->SetVisible(true);
|
||||
|
||||
Reference in New Issue
Block a user