Skip to content
Permalink
Browse files

Followup 320c696 use clang-modernize to replace 0/NULL use with nullptr

  • Loading branch information
nyalldawson committed Dec 14, 2015
1 parent fb2b930 commit 576875e9982270639d2ec450cfceb4e80f476dbe
Showing 1,071 changed files with 5,128 additions and 5,128 deletions.
@@ -20,7 +20,7 @@
#include <qmath.h>

CloughTocherInterpolator::CloughTocherInterpolator()
: mTIN( 0 )
: mTIN( nullptr )
, mEdgeTolerance( 0.00001 )
, der1X( 0.0 )
, der1Y( 0.0 )
@@ -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
@@ -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;
}
}

@@ -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;
@@ -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 )
@@ -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 )
@@ -49,7 +49,7 @@ class ANALYSIS_EXPORT LinTriangleInterpolator : public TriangleInterpolator
};

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

}
@@ -25,7 +25,7 @@ Node::Node( const Node& n )
}
else
{
mPoint = 0;
mPoint = nullptr;
}

mNext = n.getNext();
@@ -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();
@@ -49,7 +49,7 @@ Node& Node::operator=( const Node & n )
}
else//mPoint of n is a null pointer
{
mPoint = 0;
mPoint = nullptr;
}

if ( tmp )
@@ -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 )
{

}
@@ -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();
}

@@ -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*/
@@ -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;
}
@@ -102,7 +102,7 @@ inline Vector3D* NormVecDecorator::getNormal( int n ) const
else
{
QgsDebugMsg( "warning, null pointer" );
return 0;
return nullptr;
}
}

@@ -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 )
@@ -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;
}
@@ -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 )
{

}
@@ -93,7 +93,7 @@ Point3D* TriDecorator::getPoint( unsigned int i ) const
else
{
QgsDebugMsg( "warning, null pointer" );
return 0;
return nullptr;
}
}

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

@@ -342,6 +342,6 @@ QList<int>* TriDecorator::getPointsAroundEdge( double x, double y )
else
{
QgsDebugMsg( "warning, null pointer" );
return 0;
return nullptr;
}
}
@@ -59,7 +59,7 @@ class ANALYSIS_EXPORT TriDecorator : public Triangulation
Triangulation* mTIN;
};

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

}
@@ -35,7 +35,7 @@ QgsGridFileWriter::QgsGridFileWriter( QgsInterpolator* i, const QString& outputP
}

QgsGridFileWriter::QgsGridFileWriter()
: mInterpolator( 0 )
: mInterpolator( nullptr )
, mNumColumns( 0 )
, mNumRows( 0 )
, mCellSizeX( 0 )
@@ -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 );
}

@@ -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;
}
@@ -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 )
@@ -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();
@@ -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 );
}

@@ -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();
@@ -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 )
@@ -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;
}
@@ -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 );
@@ -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;
}
@@ -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
@@ -29,7 +29,7 @@ QgsGraphBuilder::QgsGraphBuilder( const QgsCoordinateReferenceSystem& crs, bool

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

@@ -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;
}
@@ -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;

0 comments on commit 576875e

Please sign in to comment.
You can’t perform that action at this time.