Commit b46b18d9 authored by Albert Astals Cid's avatar Albert Astals Cid

const &-ification of non pointer foreach variables

svn path=/trunk/KDE/kdeedu/kmplot/; revision=623378
parent 6d8833ae
......@@ -125,7 +125,7 @@ void EquationHighlighter::highlightBlock( const QString & text )
{
bool found = false;
foreach ( QString var, variables )
foreach ( const QString &var, variables )
{
if ( text.indexOf( var, i ) == i )
{
......@@ -138,7 +138,7 @@ void EquationHighlighter::highlightBlock( const QString & text )
if ( found )
continue;
foreach ( QString f, functions )
foreach ( const QString &f, functions )
{
if ( text.indexOf( f, i ) == i )
{
......
......@@ -778,7 +778,7 @@ QList< Plot > Function::plots( PlotCombinations combinations ) const
if ( m_parameters.useList )
{
int pos = 0;
foreach ( Value v, m_parameters.list )
foreach ( const Value &v, m_parameters.list )
{
Parameter param( Parameter::List );
param.setListPos( pos++ );
......@@ -846,7 +846,7 @@ QList< Plot > Function::plots( PlotCombinations combinations ) const
// Generate a plot for each signature in signatures
QList< Plot > duplicated;
foreach ( QVector<bool> signature, signatures )
foreach ( const QVector<bool> &signature, signatures )
{
int at = 0;
QList< QVector<bool> > pmSignature;
......
......@@ -134,12 +134,12 @@ void FunctionTools::updateEquationList()
for ( int i = 0; i < function->eq.size(); ++i )
{
foreach ( Plot plot, plots )
foreach ( const Plot &plot, plots )
m_equations << EquationPair( plot, i );
}
}
foreach ( EquationPair eq, m_equations )
foreach ( const EquationPair &eq, m_equations )
{
Equation * equation = eq.first.function()->eq[ eq.second ];
QListWidgetItem * item = new QListWidgetItem( equation->fstr(), m_widget->list );
......
......@@ -320,7 +320,7 @@ void InitialConditionsEditor::remove()
QModelIndexList selected = view->selectionModel()->selectedIndexes();
QMap< int, void * > sorted;
foreach ( QModelIndex index, selected )
foreach ( const QModelIndex &index, selected )
sorted.insert( -index.row(), 0l );
QList<int> indexes = sorted.keys();
......
......@@ -133,7 +133,7 @@ void KGradientEditor::paintEvent( QPaintEvent * )
//BEGIN draw arrows
painter.setRenderHint( QPainter::Antialiasing, true );
QGradientStops stops = m_gradient.stops();
foreach ( QGradientStop stop, stops )
foreach ( const QGradientStop &stop, stops )
drawArrow( & painter, stop );
//END draw arrows
}
......
......@@ -205,7 +205,7 @@ void KmPlotIO::addFunction( QDomDocument & doc, QDomElement & root, Function * f
tag.setAttribute( "use-parameter-list", function->m_parameters.useList );
QStringList str_parameters;
foreach ( Value k, function->m_parameters.list )
foreach ( const Value &k, function->m_parameters.list )
str_parameters << k.expression();
if( !str_parameters.isEmpty() )
......@@ -232,7 +232,7 @@ void KmPlotIO::addFunction( QDomDocument & doc, QDomElement & root, Function * f
bool first = true;
QString ys;
foreach ( Value y, state->y0 )
foreach ( const Value &y, state->y0 )
{
if ( !first )
ys += ';';
......@@ -603,7 +603,7 @@ void KmPlotIO::parseDifferentialStates( const QDomElement & n, Equation * equati
state->x0.updateExpression( x );
int at = 0;
foreach ( QString f, y )
foreach ( const QString &f, y )
state->y0[at++] = f;
}
node = node.nextSibling();
......@@ -816,7 +816,7 @@ void KmPlotIO::oldParseFunction( const QDomElement & n )
QString KmPlotIO::gradientToString( const QGradientStops & stops )
{
QString string;
foreach ( QGradientStop stop, stops )
foreach ( const QGradientStop &stop, stops )
string += QString( "%1;%2," ).arg( stop.first ).arg( stop.second.name() );
return string;
}
......@@ -828,7 +828,7 @@ QGradientStops KmPlotIO::stringToGradient( const QString & string )
QStringList stopStrings = string.split( ',', QString::SkipEmptyParts );
QGradientStops stops;
foreach ( QString stopString, stopStrings )
foreach ( const QString &stopString, stopStrings )
{
QString pos = stopString.section( ';', 0, 0 );
QString color = stopString.section( ';', 1, 1 );
......
......@@ -58,7 +58,7 @@ KParameterEditor::KParameterEditor( QList<Value> *l, QWidget *parent )
setCaption( i18n("Parameter Editor") );
setButtons( Ok|Cancel );
foreach ( Value v, *m_parameter )
foreach ( const Value &v, *m_parameter )
m_mainWidget->list->addItem( v.expression() );
connect( m_mainWidget->cmdNew, SIGNAL( clicked() ), this, SLOT( cmdNew_clicked() ));
......
......@@ -871,10 +871,10 @@ bool Parser::tryVariable()
// match e.g. "ab" before "a"
typedef QMultiMap <int, QString> ISMap;
ISMap sorted;
foreach ( QString var, variables )
foreach ( const QString &var, variables )
sorted.insert( -var.length(), var );
foreach ( QString var, sorted )
foreach ( const QString &var, sorted )
{
if ( match( var ) )
{
......
......@@ -1299,7 +1299,7 @@ void View::drawImplicit( Function * function, QPainter * painter )
assert( circular.function() );
const QList< Plot > plots = function->plots();
foreach ( Plot plot, plots )
foreach ( const Plot &plot, plots )
{
bool setAliased = false;
if ( plot.parameter.type() == Parameter::Animated )
......@@ -1353,11 +1353,11 @@ void View::drawImplicit( Function * function, QPainter * painter )
FuzzyPointMap singularSorted;
FuzzyPoint::dx = (m_xmax-m_xmin) * SegmentMin * 0.1 / m_clipRect.width();
FuzzyPoint::dy = (m_ymax-m_ymin) * SegmentMin * 0.1 / m_clipRect.height();
foreach ( QPointF point, singular )
foreach ( const QPointF &point, singular )
singularSorted.insert( point, point );
singular = singularSorted.values();
foreach ( QPointF point, singular )
foreach ( const QPointF &point, singular )
{
// radius of circle around singular point
double epsilon = qMin( FuzzyPoint::dx, FuzzyPoint::dy );
......@@ -1693,12 +1693,12 @@ void View::drawFunction( Function * function, QPainter * painter )
function->plotAppearance( Function::Derivative0 ).showTangentField )
{
QList<Plot> plots = function->plots( Function::PlotCombinations(Function::AllCombinations) & ~Function::DifferentInitialStates );
foreach ( Plot plot, plots )
foreach ( const Plot &plot, plots )
drawTangentField( plot, painter );
}
QList<Plot> plots = function->plots();
foreach ( Plot plot, plots )
foreach ( const Plot &plot, plots )
drawPlot( plot, painter );
}
......@@ -2066,7 +2066,7 @@ void View::drawFunctionInfo( QPainter * painter )
if ( m_stopCalculating )
break;
foreach ( Plot plot, function->plots() )
foreach ( const Plot &plot, function->plots() )
{
plot.updateFunction();
......@@ -2074,7 +2074,7 @@ void View::drawFunctionInfo( QPainter * painter )
if ( (function->type() == Function::Cartesian) && function->plotAppearance( plot.plotMode ).showExtrema )
{
QList<QPointF> stationaryPoints = findStationaryPoints( plot );
foreach ( QPointF realValue, stationaryPoints )
foreach ( const QPointF &realValue, stationaryPoints )
{
painter->setPen( QPen( Qt::black, millimetersToPixels( 1.5, painter->device() ) ) );
painter->drawPoint( toPixel( realValue ) );
......@@ -3127,7 +3127,7 @@ QPointF View::getPlotUnderMouse()
foreach ( Function * function, XParser::self()->m_ufkt )
{
const QList< Plot > plots = function->plots();
foreach ( Plot plot, plots )
foreach ( const Plot &plot, plots )
{
plot.updateFunction();
......
......@@ -640,7 +640,7 @@ QStringList XParser::functionParameterList(uint id)
return QStringList();
Function *item = m_ufkt[id];
QStringList str_parameter;
foreach ( Value it, item->m_parameters.list )
foreach ( const Value &it, item->m_parameters.list )
str_parameter << it.expression();
return str_parameter;
}
......@@ -651,7 +651,7 @@ bool XParser::functionAddParameter(uint id, const QString &new_parameter)
Function *tmp_ufkt = m_ufkt[id];
//check if the parameter already exists
foreach ( Value it, tmp_ufkt->m_parameters.list )
foreach ( const Value &it, tmp_ufkt->m_parameters.list )
{
if ( it.expression() == new_parameter )
return false;
......
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