Skip to content

Commit

Permalink
Followup 320c696 use clang-modernize to replace 0/NULL use with nullptr
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Dec 15, 2015
1 parent fb2b930 commit 576875e
Show file tree
Hide file tree
Showing 1,071 changed files with 5,128 additions and 5,128 deletions.
2 changes: 1 addition & 1 deletion src/analysis/interpolation/CloughTocherInterpolator.cc
Expand Up @@ -20,7 +20,7 @@
#include <qmath.h>

CloughTocherInterpolator::CloughTocherInterpolator()
: mTIN( 0 )
: mTIN( nullptr )
, mEdgeTolerance( 0.00001 )
, der1X( 0.0 )
, der1Y( 0.0 )
Expand Down
8 changes: 4 additions & 4 deletions src/analysis/interpolation/DualEdgeTriangulation.cc
Expand Up @@ -930,7 +930,7 @@ QList<int>* DualEdgeTriangulation::getSurroundingTriangles( int pointno )

if ( firstedge == -1 )//an error occured
{
return 0;
return nullptr;
}

QList<int>* vlist = new QList<int>();//create the value list on the heap
Expand Down Expand Up @@ -3070,13 +3070,13 @@ QList<int>* DualEdgeTriangulation::getPointsAroundEdge( double x, double y )
else
{
QgsDebugMsg( "warning: null pointer" );
return 0;
return nullptr;
}
}
else
{
QgsDebugMsg( "Edge number negative" );
return 0;
return nullptr;
}
}

Expand All @@ -3102,7 +3102,7 @@ bool DualEdgeTriangulation::saveAsShapefile( const QString& fileName ) const
}
}

QgsVectorFileWriter writer( shapeFileName, "Utf-8", fields, QGis::WKBLineString, 0 );
QgsVectorFileWriter writer( shapeFileName, "Utf-8", fields, QGis::WKBLineString, nullptr );
if ( writer.hasError() != QgsVectorFileWriter::NoError )
{
return false;
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/interpolation/DualEdgeTriangulation.h
Expand Up @@ -181,7 +181,7 @@ inline DualEdgeTriangulation::DualEdgeTriangulation()
, xMin( 0 )
, yMax( 0 )
, yMin( 0 )
, mTriangleInterpolator( 0 )
, mTriangleInterpolator( nullptr )
, mForcedCrossBehaviour( Triangulation::DELETE_FIRST )
, mEdgeColor( 0, 255, 0 )
, mForcedEdgeColor( 0, 0, 255 )
Expand All @@ -202,7 +202,7 @@ inline DualEdgeTriangulation::DualEdgeTriangulation( int nop, Triangulation* dec
, xMin( 0 )
, yMax( 0 )
, yMin( 0 )
, mTriangleInterpolator( 0 )
, mTriangleInterpolator( nullptr )
, mForcedCrossBehaviour( Triangulation::DELETE_FIRST )
, mEdgeColor( 0, 255, 0 )
, mForcedEdgeColor( 0, 0, 255 )
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/interpolation/LinTriangleInterpolator.h
Expand Up @@ -49,7 +49,7 @@ class ANALYSIS_EXPORT LinTriangleInterpolator : public TriangleInterpolator
};

inline LinTriangleInterpolator::LinTriangleInterpolator()
: mTIN( 0 )
: mTIN( nullptr )
{

}
Expand Down
6 changes: 3 additions & 3 deletions src/analysis/interpolation/Node.cc
Expand Up @@ -25,7 +25,7 @@ Node::Node( const Node& n )
}
else
{
mPoint = 0;
mPoint = nullptr;
}

mNext = n.getNext();
Expand All @@ -39,7 +39,7 @@ Node& Node::operator=( const Node & n )
if ( n.getPoint() )//mPoint of n is not a null pointer
{
mPoint = new Point3D( n.getPoint()->getX(), n.getPoint()->getY(), n.getPoint()->getZ() );
if ( mPoint == 0 )//no memory
if ( mPoint == nullptr )//no memory
{
mPoint = tmp;
mNext = n.getNext();
Expand All @@ -49,7 +49,7 @@ Node& Node::operator=( const Node & n )
}
else//mPoint of n is a null pointer
{
mPoint = 0;
mPoint = nullptr;
}

if ( tmp )
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/interpolation/Node.h
Expand Up @@ -42,7 +42,7 @@ class ANALYSIS_EXPORT Node
void setPoint( Point3D* p );
};

inline Node::Node() : mPoint( 0 ), mNext( 0 )
inline Node::Node() : mPoint( nullptr ), mNext( nullptr )
{

}
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/interpolation/NormVecDecorator.cc
Expand Up @@ -518,7 +518,7 @@ bool NormVecDecorator::estimateFirstDerivatives( QProgressDialog* d )
{
d->setMinimum( 0 );
d->setMaximum( getNumberOfPoints() );
d->setCancelButton( 0 ); //we cannot cancel derivative estimation
d->setCancelButton( nullptr ); //we cannot cancel derivative estimation
d->show();
}

Expand Down
8 changes: 4 additions & 4 deletions src/analysis/interpolation/NormVecDecorator.h
Expand Up @@ -45,7 +45,7 @@ class ANALYSIS_EXPORT NormVecDecorator: public TriDecorator
/** Estimates the first derivative a point. Return true in case of succes and false otherwise*/
bool estimateFirstDerivative( int pointno );
/** This method adds the functionality of estimating normals at the data points. Return true in the case of success and false otherwise*/
bool estimateFirstDerivatives( QProgressDialog* d = 0 );
bool estimateFirstDerivatives( QProgressDialog* d = nullptr );
/** Returns a pointer to the normal vector for the point with the number n*/
Vector3D* getNormal( int n ) const;
/** Finds out, in which triangle a point with coordinates x and y is and assigns the triangle points to p1, p2, p3 and the estimated normals to v1, v2, v3. The vectors are normaly taken from 'mNormVec', exept if p1, p2 or p3 is a point on a breakline. In this case, the normal is calculated on-the-fly. Returns false, if something went wrong and true otherwise*/
Expand Down Expand Up @@ -78,12 +78,12 @@ class ANALYSIS_EXPORT NormVecDecorator: public TriDecorator
void setState( int pointno, pointState s );
};

inline NormVecDecorator::NormVecDecorator(): TriDecorator(), mInterpolator( 0 ), mNormVec( new QVector<Vector3D*>( mDefaultStorageForNormals ) ), mPointState( new QVector<pointState>( mDefaultStorageForNormals ) )
inline NormVecDecorator::NormVecDecorator(): TriDecorator(), mInterpolator( nullptr ), mNormVec( new QVector<Vector3D*>( mDefaultStorageForNormals ) ), mPointState( new QVector<pointState>( mDefaultStorageForNormals ) )
{
alreadyestimated = false;
}

inline NormVecDecorator::NormVecDecorator( Triangulation* tin ): TriDecorator( tin ), mInterpolator( 0 ), mNormVec( new QVector<Vector3D*>( mDefaultStorageForNormals ) ), mPointState( new QVector<pointState>( mDefaultStorageForNormals ) )
inline NormVecDecorator::NormVecDecorator( Triangulation* tin ): TriDecorator( tin ), mInterpolator( nullptr ), mNormVec( new QVector<Vector3D*>( mDefaultStorageForNormals ) ), mPointState( new QVector<pointState>( mDefaultStorageForNormals ) )
{
alreadyestimated = false;
}
Expand All @@ -102,7 +102,7 @@ inline Vector3D* NormVecDecorator::getNormal( int n ) const
else
{
QgsDebugMsg( "warning, null pointer" );
return 0;
return nullptr;
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/analysis/interpolation/ParametricLine.cc
Expand Up @@ -47,7 +47,7 @@ void ParametricLine::calcPoint( float t, Point3D *p )
ParametricLine* ParametricLine::getParent() const
{
QgsDebugMsg( "warning, derive a class from ParametricLine" );
return 0;
return nullptr;
}

void ParametricLine::remove( int i )
Expand Down Expand Up @@ -78,11 +78,11 @@ const Point3D* ParametricLine::getControlPoint( int number ) const
{
Q_UNUSED( number );
QgsDebugMsg( "warning, derive a class from ParametricLine" );
return 0;
return nullptr;
}

const QVector<Point3D*>* ParametricLine::getControlPoly() const
{
QgsDebugMsg( "warning, derive a class from ParametricLine" );
return 0;
return nullptr;
}
2 changes: 1 addition & 1 deletion src/analysis/interpolation/ParametricLine.h
Expand Up @@ -58,7 +58,7 @@ class ANALYSIS_EXPORT ParametricLine

//-----------------------------------------constructors and destructor----------------------

inline ParametricLine::ParametricLine() : mDegree( 0 ), mParent( 0 ), mControlPoly( 0 )
inline ParametricLine::ParametricLine() : mDegree( 0 ), mParent( nullptr ), mControlPoly( nullptr )
{

}
Expand Down
6 changes: 3 additions & 3 deletions src/analysis/interpolation/TriDecorator.cc
Expand Up @@ -93,7 +93,7 @@ Point3D* TriDecorator::getPoint( unsigned int i ) const
else
{
QgsDebugMsg( "warning, null pointer" );
return 0;
return nullptr;
}
}

Expand Down Expand Up @@ -162,7 +162,7 @@ QList<int>* TriDecorator::getSurroundingTriangles( int pointno )
else
{
QgsDebugMsg( "warning, null pointer" );
return 0;
return nullptr;
}
}

Expand Down Expand Up @@ -342,6 +342,6 @@ QList<int>* TriDecorator::getPointsAroundEdge( double x, double y )
else
{
QgsDebugMsg( "warning, null pointer" );
return 0;
return nullptr;
}
}
2 changes: 1 addition & 1 deletion src/analysis/interpolation/TriDecorator.h
Expand Up @@ -59,7 +59,7 @@ class ANALYSIS_EXPORT TriDecorator : public Triangulation
Triangulation* mTIN;
};

inline TriDecorator::TriDecorator(): mTIN( 0 )
inline TriDecorator::TriDecorator(): mTIN( nullptr )
{

}
Expand Down
6 changes: 3 additions & 3 deletions src/analysis/interpolation/qgsgridfilewriter.cpp
Expand Up @@ -35,7 +35,7 @@ QgsGridFileWriter::QgsGridFileWriter( QgsInterpolator* i, const QString& outputP
}

QgsGridFileWriter::QgsGridFileWriter()
: mInterpolator( 0 )
: mInterpolator( nullptr )
, mNumColumns( 0 )
, mNumRows( 0 )
, mCellSizeX( 0 )
Expand Down Expand Up @@ -72,10 +72,10 @@ int QgsGridFileWriter::writeFile( bool showProgressDialog )
double currentXValue;
double interpolatedValue;

QProgressDialog* progressDialog = 0;
QProgressDialog* progressDialog = nullptr;
if ( showProgressDialog )
{
progressDialog = new QProgressDialog( QObject::tr( "Interpolating..." ), QObject::tr( "Abort" ), 0, mNumRows, 0 );
progressDialog = new QProgressDialog( QObject::tr( "Interpolating..." ), QObject::tr( "Abort" ), 0, mNumRows, nullptr );
progressDialog->setWindowModality( Qt::WindowModal );
}

Expand Down
2 changes: 1 addition & 1 deletion src/analysis/interpolation/qgsinterpolator.cpp
Expand Up @@ -54,7 +54,7 @@ int QgsInterpolator::cacheBaseData()

for ( ; v_it != mLayerData.end(); ++v_it )
{
if ( v_it->vectorLayer == 0 )
if ( v_it->vectorLayer == nullptr )
{
continue;
}
Expand Down
14 changes: 7 additions & 7 deletions src/analysis/interpolation/qgstininterpolator.cpp
Expand Up @@ -29,8 +29,8 @@

QgsTINInterpolator::QgsTINInterpolator( const QList<LayerData>& inputData, TIN_INTERPOLATION interpolation, bool showProgressDialog )
: QgsInterpolator( inputData )
, mTriangulation( 0 )
, mTriangleInterpolator( 0 )
, mTriangulation( nullptr )
, mTriangleInterpolator( nullptr )
, mIsInitialized( false )
, mShowProgressDialog( showProgressDialog )
, mExportTriangulationToFile( false )
Expand Down Expand Up @@ -67,7 +67,7 @@ int QgsTINInterpolator::interpolatePoint( double x, double y, double& result )

void QgsTINInterpolator::initialize()
{
DualEdgeTriangulation* theDualEdgeTriangulation = new DualEdgeTriangulation( 100000, 0 );
DualEdgeTriangulation* theDualEdgeTriangulation = new DualEdgeTriangulation( 100000, nullptr );
if ( mInterpolation == CloughTocher )
{
NormVecDecorator* dec = new NormVecDecorator();
Expand All @@ -94,10 +94,10 @@ void QgsTINInterpolator::initialize()
}
}

QProgressDialog* theProgressDialog = 0;
QProgressDialog* theProgressDialog = nullptr;
if ( mShowProgressDialog )
{
theProgressDialog = new QProgressDialog( QObject::tr( "Building triangulation..." ), QObject::tr( "Abort" ), 0, nFeatures, 0 );
theProgressDialog = new QProgressDialog( QObject::tr( "Building triangulation..." ), QObject::tr( "Abort" ), 0, nFeatures, nullptr );
theProgressDialog->setWindowModality( Qt::WindowModal );
}

Expand Down Expand Up @@ -140,7 +140,7 @@ void QgsTINInterpolator::initialize()
NormVecDecorator* dec = dynamic_cast<NormVecDecorator*>( mTriangulation );
if ( dec )
{
QProgressDialog* progressDialog = 0;
QProgressDialog* progressDialog = nullptr;
if ( mShowProgressDialog ) //show a progress dialog because it can take a long time...
{
progressDialog = new QProgressDialog();
Expand Down Expand Up @@ -203,7 +203,7 @@ int QgsTINInterpolator::insertData( QgsFeature* f, bool zCoord, int attr, InputT
double x, y, z;
QgsConstWkbPtr currentWkbPtr( g->asWkb() + 1 + sizeof( int ) );
//maybe a structure or break line
Line3D* line = 0;
Line3D* line = nullptr;

QGis::WkbType wkbType = g->wkbType();
switch ( wkbType )
Expand Down
10 changes: 5 additions & 5 deletions src/analysis/network/qgsgraphanalyzer.cpp
Expand Up @@ -28,8 +28,8 @@

void QgsGraphAnalyzer::dijkstra( const QgsGraph* source, int startPointIdx, int criterionNum, QVector<int>* resultTree, QVector<double>* resultCost )
{
QVector< double > * result = NULL;
if ( resultCost != NULL )
QVector< double > * result = nullptr;
if ( resultCost != nullptr )
{
result = resultCost;
}
Expand All @@ -42,7 +42,7 @@ void QgsGraphAnalyzer::dijkstra( const QgsGraph* source, int startPointIdx, int
result->insert( result->begin(), source->vertexCount(), std::numeric_limits<double>::infinity() );
( *result )[ startPointIdx ] = 0.0;

if ( resultTree != NULL )
if ( resultTree != nullptr )
{
resultTree->clear();
resultTree->insert( resultTree->begin(), source->vertexCount(), -1 );
Expand Down Expand Up @@ -73,15 +73,15 @@ void QgsGraphAnalyzer::dijkstra( const QgsGraph* source, int startPointIdx, int
if ( cost < ( *result )[ arc.inVertex()] )
{
( *result )[ arc.inVertex()] = cost;
if ( resultTree != NULL )
if ( resultTree != nullptr )
{
( *resultTree )[ arc.inVertex()] = *arcIt;
}
not_begin.insert( cost, arc.inVertex() );
}
}
}
if ( resultCost == NULL )
if ( resultCost == nullptr )
{
delete result;
}
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/network/qgsgraphanalyzer.h
Expand Up @@ -39,7 +39,7 @@ class ANALYSIS_EXPORT QgsGraphAnalyzer
* @param resultTree array represents the shortest path tree. resultTree[ vertexIndex ] == inboundingArcIndex if vertex reacheble and resultTree[ vertexIndex ] == -1 others.
* @param resultCost array of cost paths
*/
static void dijkstra( const QgsGraph* source, int startVertexIdx, int criterionNum, QVector<int>* resultTree = NULL, QVector<double>* resultCost = NULL );
static void dijkstra( const QgsGraph* source, int startVertexIdx, int criterionNum, QVector<int>* resultTree = nullptr, QVector<double>* resultCost = nullptr );

/**
* return shortest path tree with root-node in startVertexIdx
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/network/qgsgraphbuilder.cpp
Expand Up @@ -29,7 +29,7 @@ QgsGraphBuilder::QgsGraphBuilder( const QgsCoordinateReferenceSystem& crs, bool

QgsGraphBuilder::~QgsGraphBuilder()
{
if ( mGraph != NULL )
if ( mGraph != nullptr )
delete mGraph;
}

Expand All @@ -46,6 +46,6 @@ void QgsGraphBuilder::addArc( int pt1id, const QgsPoint&, int pt2id, const QgsPo
QgsGraph* QgsGraphBuilder::graph()
{
QgsGraph* res = mGraph;
mGraph = NULL;
mGraph = nullptr;
return res;
}
2 changes: 1 addition & 1 deletion src/analysis/network/qgslinevectorlayerdirector.cpp
Expand Up @@ -130,7 +130,7 @@ void QgsLineVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, c
{
QgsVectorLayer *vl = mVectorLayer;

if ( vl == NULL )
if ( vl == nullptr )
return;

int featureCount = ( int ) vl->featureCount() * 2;
Expand Down

0 comments on commit 576875e

Please sign in to comment.