Commit ec82e26a authored by Jan Möbius's avatar Jan Möbius

Use ranges for Object Iteration to simplify code

parent 1a6970ce
......@@ -863,7 +863,7 @@ void DataControlPlugin::propagateDownwards(BaseObject* _obj, int _column ){
*/
void DataControlPlugin::slotBoundingBoxChange( )
{
for (PluginFunctions::ObjectIterator o_it; o_it != PluginFunctions::objectsEnd(); ++o_it) {
for (auto* o_it : PluginFunctions::objects()) {
updateBoundingBox (o_it);
}
......
......@@ -454,8 +454,7 @@ void DataControlPlugin::setAllTarget() {
if ( action != 0 && action->data().isValid() )
type = (DataType) action->data().toUInt();
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS, type) ;
o_it != PluginFunctions::objectsEnd(); ++o_it){
for (auto* o_it : PluginFunctions::objects(PluginFunctions::ALL_OBJECTS, type) ) {
o_it->target(true);
}
}
......@@ -476,8 +475,7 @@ void DataControlPlugin::setAllSource() {
if ( action != 0 && action->data().isValid() )
type = (DataType) action->data().toUInt();
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS, type) ;
o_it != PluginFunctions::objectsEnd(); ++o_it){
for (auto* o_it : PluginFunctions::objects(PluginFunctions::ALL_OBJECTS, type) ) {
o_it->source(true);
}
}
......@@ -498,8 +496,7 @@ void DataControlPlugin::clearAllTarget() {
if ( action != 0 && action->data().isValid() )
type = (DataType) action->data().toUInt();
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS, type) ;
o_it != PluginFunctions::objectsEnd(); ++o_it){
for (auto* o_it : PluginFunctions::objects(PluginFunctions::ALL_OBJECTS, type) ) {
o_it->target(false);
}
}
......@@ -520,8 +517,7 @@ void DataControlPlugin::clearAllSource() {
if ( action != 0 && action->data().isValid() )
type = (DataType) action->data().toUInt();
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS, type) ;
o_it != PluginFunctions::objectsEnd(); ++o_it){
for (auto* o_it : PluginFunctions::objects(PluginFunctions::ALL_OBJECTS, type) ) {
o_it->source(false);
}
}
......@@ -545,8 +541,7 @@ void DataControlPlugin::hideAll() {
if ( action != 0 && action->data().isValid() )
type = (DataType) action->data().toUInt();
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS,type) ;
o_it != PluginFunctions::objectsEnd(); ++o_it){
for (auto* o_it : PluginFunctions::objects(PluginFunctions::ALL_OBJECTS, type) ) {
o_it->hide();
}
......@@ -571,7 +566,7 @@ void DataControlPlugin::showAll() {
if ( action != 0 && action->data().isValid() )
type = (DataType) action->data().toUInt();
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS, type); o_it != PluginFunctions::objectsEnd(); ++o_it){
for (auto* o_it : PluginFunctions::objects(PluginFunctions::ALL_OBJECTS, type) ) {
o_it->show();
}
......@@ -586,8 +581,9 @@ IdList DataControlPlugin::getTargetObjects(DataType _type) {
IdList list;
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::TARGET_OBJECTS, _type); o_it != PluginFunctions::objectsEnd(); ++o_it)
for (auto* o_it : PluginFunctions::objects(PluginFunctions::TARGET_OBJECTS, _type) ) {
list.push_back( o_it->id() );
}
return list;
}
......@@ -601,8 +597,9 @@ IdList DataControlPlugin::getSourceObjects(DataType _type) {
IdList list;
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::SOURCE_OBJECTS, _type); o_it != PluginFunctions::objectsEnd(); ++o_it)
for (auto* o_it : PluginFunctions::objects(PluginFunctions::SOURCE_OBJECTS, _type) ) {
list.push_back( o_it->id() );
}
return list;
}
......@@ -614,8 +611,9 @@ IdList DataControlPlugin::getSourceObjects(DataType _type) {
*/
void DataControlPlugin::printObjectInfoToLog() {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS); o_it != PluginFunctions::objectsEnd(); ++o_it)
for (auto* o_it : PluginFunctions::objects(PluginFunctions::ALL_OBJECTS) ) {
emit log(LOGINFO, tr("Object \"%1\" with ID %2 of type %3 ").arg(o_it->name()).arg(o_it->id()).arg(o_it->dataType().name()));
}
}
//******************************************************************************
......@@ -628,8 +626,8 @@ void DataControlPlugin::printObjectInfoToLog() {
*/
unsigned int DataControlPlugin::groupCount() const {
unsigned int count = 0;
for ( PluginFunctions::BaseObjectIterator o_it(PluginFunctions::ALL_OBJECTS,DATA_GROUP); o_it != PluginFunctions::objectsEnd(); ++o_it)
++count;
for (auto* o_it : PluginFunctions::objects(PluginFunctions::ALL_OBJECTS, DATA_GROUP) )
++count;
return count;
}
......
......@@ -321,8 +321,7 @@ void DataControlPlugin::slotHeaderCustomContextMenuRequested ( const QPoint & _p
//get all used types
QVector<DataType> types;
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS) ;
o_it != PluginFunctions::objectsEnd(); ++o_it)
for (auto* o_it : PluginFunctions::objects(PluginFunctions::ALL_OBJECTS) )
if ( !types.contains( o_it->dataType() ) )
types.push_back( o_it->dataType() );
......@@ -478,8 +477,7 @@ void DataControlPlugin::slotCopyMaterialToTargeted() {
BaseObjectData* itemData = dynamic_cast< BaseObjectData* > (item);
const ACG::SceneGraph::Material &sourceMaterial = itemData->materialNode()->material();
for (PluginFunctions::ObjectIterator o_it(PluginFunctions::TARGET_OBJECTS);
o_it != PluginFunctions::objectsEnd(); ++o_it) {
for (auto* o_it : PluginFunctions::objects(PluginFunctions::TARGET_OBJECTS) ) {
MaterialNode * const materialNode = o_it->materialNode();
if (materialNode) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment