mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-22 00:06:12 -05:00
Catch another variant of make_unique
This commit is contained in:
parent
038036d021
commit
2db0254c9e
@ -96,6 +96,9 @@ qlatin1str_single_char = re.compile(
|
||||
make_unique = re.compile(
|
||||
r"""^(\s*)std::unique_ptr<\s*(.*?)\s*>(\s*.*?\s*=\s*std::make_unique<\s*(.*?)\s*>.*)$"""
|
||||
)
|
||||
make_unique2 = re.compile(
|
||||
r"""^(\s*)std::unique_ptr<\s*(.*?)\s*>(?:\s*(.*?)\s*\()\s*(std::make_unique<\s*(.*?)\s*>.*?)\s*\)\s*;$"""
|
||||
)
|
||||
|
||||
|
||||
def qlatin1char_or_string(x):
|
||||
@ -233,5 +236,9 @@ while i < len(lines):
|
||||
if m and m.group(2) == m.group(4):
|
||||
line = m.group(1) + "auto" + m.group(3)
|
||||
|
||||
m = make_unique2.match(line)
|
||||
if m and m.group(2) == m.group(5):
|
||||
line = m.group(1) + "auto " + m.group(3) + " = " + m.group(4) + ";"
|
||||
|
||||
print(line)
|
||||
i += 1
|
||||
|
@ -1230,7 +1230,7 @@ void QgsAbstractDatabaseProviderConnection::addField( const QgsField &field, con
|
||||
|
||||
QgsVectorLayer::LayerOptions options { false, false };
|
||||
options.skipCrsValidation = true;
|
||||
std::unique_ptr<QgsVectorLayer> vl( std::make_unique<QgsVectorLayer>( tableUri( schema, tableName ), QStringLiteral( "temp_layer" ), mProviderKey, options ) );
|
||||
auto vl = std::make_unique<QgsVectorLayer>( tableUri( schema, tableName ), QStringLiteral( "temp_layer" ), mProviderKey, options ) ;
|
||||
if ( ! vl->isValid() )
|
||||
{
|
||||
throw QgsProviderConnectionException( QObject::tr( "Could not create a vector layer for table '%1' in schema '%2'" )
|
||||
@ -1255,7 +1255,7 @@ void QgsAbstractDatabaseProviderConnection::renameField( const QString &schema,
|
||||
|
||||
QgsVectorLayer::LayerOptions options { false, false };
|
||||
options.skipCrsValidation = true;
|
||||
std::unique_ptr<QgsVectorLayer> vl( std::make_unique<QgsVectorLayer>( tableUri( schema, tableName ), QStringLiteral( "temp_layer" ), mProviderKey, options ) );
|
||||
auto vl = std::make_unique<QgsVectorLayer>( tableUri( schema, tableName ), QStringLiteral( "temp_layer" ), mProviderKey, options ) ;
|
||||
if ( ! vl->isValid() )
|
||||
{
|
||||
throw QgsProviderConnectionException( QObject::tr( "Could not create a vector layer for table '%1' in schema '%2'" )
|
||||
|
@ -191,7 +191,7 @@ QgsFeature TestQgsProcessingAlgsPt1::runForFeature( const std::unique_ptr<QgsPro
|
||||
QgsProcessingFeedback feedback;
|
||||
context->setFeedback( &feedback );
|
||||
|
||||
std::unique_ptr<QgsVectorLayer> inputLayer( std::make_unique<QgsVectorLayer>( layerType, QStringLiteral( "layer" ), QStringLiteral( "memory" ) ) );
|
||||
auto inputLayer = std::make_unique<QgsVectorLayer>( layerType, QStringLiteral( "layer" ), QStringLiteral( "memory" ) );
|
||||
inputLayer->dataProvider()->addFeature( feature );
|
||||
|
||||
parameters.insert( QStringLiteral( "INPUT" ), QVariant::fromValue<QgsMapLayer *>( inputLayer.get() ) );
|
||||
@ -4479,7 +4479,7 @@ void TestQgsProcessingAlgsPt1::bookmarksToLayer()
|
||||
|
||||
void TestQgsProcessingAlgsPt1::layerToBookmarks()
|
||||
{
|
||||
std::unique_ptr<QgsVectorLayer> inputLayer( std::make_unique<QgsVectorLayer>( QStringLiteral( "Polygon?crs=epsg:4326&field=province:string&field=municipality:string" ), QStringLiteral( "layer" ), QStringLiteral( "memory" ) ) );
|
||||
auto inputLayer = std::make_unique<QgsVectorLayer>( QStringLiteral( "Polygon?crs=epsg:4326&field=province:string&field=municipality:string" ), QStringLiteral( "layer" ), QStringLiteral( "memory" ) );
|
||||
QVERIFY( inputLayer->isValid() );
|
||||
|
||||
QgsFeature f;
|
||||
|
@ -132,7 +132,7 @@ QgsFeature TestQgsProcessingAlgsPt2::runForFeature( const std::unique_ptr<QgsPro
|
||||
QgsProcessingFeedback feedback;
|
||||
context->setFeedback( &feedback );
|
||||
|
||||
std::unique_ptr<QgsVectorLayer> inputLayer( std::make_unique<QgsVectorLayer>( layerType, QStringLiteral( "layer" ), QStringLiteral( "memory" ) ) );
|
||||
auto inputLayer = std::make_unique<QgsVectorLayer>( layerType, QStringLiteral( "layer" ), QStringLiteral( "memory" ) );
|
||||
inputLayer->dataProvider()->addFeature( feature );
|
||||
|
||||
parameters.insert( QStringLiteral( "INPUT" ), QVariant::fromValue<QgsMapLayer *>( inputLayer.get() ) );
|
||||
|
@ -1515,9 +1515,9 @@ void TestQgsLegendRenderer::testDiagramMeshLegend()
|
||||
rendererSettings.setActiveVectorDatasetGroup( vectorIndex );
|
||||
layer->setRendererSettings( rendererSettings );
|
||||
|
||||
std::unique_ptr<QgsLayerTree> root( std::make_unique<QgsLayerTree>() );
|
||||
auto root = std::make_unique<QgsLayerTree>();
|
||||
root->addLayer( layer );
|
||||
std::unique_ptr<QgsLayerTreeModel> legendModel( std::make_unique<QgsLayerTreeModel>( root.get() ) );
|
||||
auto legendModel = std::make_unique<QgsLayerTreeModel>( root.get() );
|
||||
|
||||
QgsLegendSettings settings;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user