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

@@ -58,7 +58,7 @@ ViewProviderInventorObject::~ViewProviderInventorObject()
void ViewProviderInventorObject::attach(App::DocumentObject *pcObj)
{
ViewProviderDocumentObject::attach(pcObj);
SoGroup* pcFileBuf = new SoGroup();
auto pcFileBuf = new SoGroup();
pcFileBuf->addChild(pcBuffer);
pcFileBuf->addChild(pcFile);
addDisplayMaskMode(pcFileBuf, "FileBuffer");
@@ -88,7 +88,7 @@ std::vector<std::string> ViewProviderInventorObject::getDisplayModes() const
void ViewProviderInventorObject::updateData(const App::Property* prop)
{
App::InventorObject* ivObj = static_cast<App::InventorObject*>(pcObject);
auto ivObj = static_cast<App::InventorObject*>(pcObject);
if (prop == &ivObj->Buffer) {
// read from buffer
SoInput in;
@@ -135,13 +135,13 @@ void ViewProviderInventorObject::updateData(const App::Property* prop)
// <==> (I-R) * c = 0 ==> c = 0
// This means that the center point must be the origin!
Base::Placement p = static_cast<const App::PropertyPlacement*>(prop)->getValue();
float q0 = (float)p.getRotation().getValue()[0];
float q1 = (float)p.getRotation().getValue()[1];
float q2 = (float)p.getRotation().getValue()[2];
float q3 = (float)p.getRotation().getValue()[3];
float px = (float)p.getPosition().x;
float py = (float)p.getPosition().y;
float pz = (float)p.getPosition().z;
auto q0 = (float)p.getRotation().getValue()[0];
auto q1 = (float)p.getRotation().getValue()[1];
auto q2 = (float)p.getRotation().getValue()[2];
auto q3 = (float)p.getRotation().getValue()[3];
auto px = (float)p.getPosition().x;
auto py = (float)p.getPosition().y;
auto pz = (float)p.getPosition().z;
pcTransform->rotation.setValue(q0,q1,q2,q3);
pcTransform->translation.setValue(px,py,pz);
pcTransform->center.setValue(0.0f,0.0f,0.0f);
@@ -157,7 +157,7 @@ void ViewProviderInventorObject::adjustSelectionNodes(SoNode* child, const char*
static_cast<SoFCSelection*>(child)->objectName = objname;
}
else if (child->getTypeId().isDerivedFrom(SoGroup::getClassTypeId())) {
SoGroup* group = static_cast<SoGroup*>(child);
auto group = static_cast<SoGroup*>(child);
for (int i=0; i<group->getNumChildren(); i++) {
SoNode* subchild = group->getChild(i);
adjustSelectionNodes(subchild, docname, objname);