Skip to content

Commit 05ee1b0

Browse files
committed
use MAYBE_UNUSED in the method declaration
1 parent 8582517 commit 05ee1b0

5 files changed

+9
-17
lines changed

src/core/qgseditformconfig.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ void QgsEditFormConfig::setSuppress( QgsEditFormConfig::FeatureFormSuppress s )
260260

261261
void QgsEditFormConfig::readXml( const QDomNode &node, QgsReadWriteContext &context )
262262
{
263-
MAYBE_UNUSED QgsReadWriteContextCategoryPopper p = context.enterCategory( QObject::tr( "Edit form config" ) );
263+
QgsReadWriteContextCategoryPopper p = context.enterCategory( QObject::tr( "Edit form config" ) );
264264

265265
d.detach();
266266

src/core/qgsmaplayer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ bool QgsMapLayer::readLayerXml( const QDomElement &layerElement, QgsReadWriteCo
430430
// the subclass can also read custom properties
431431
readCustomProperties( layerElement );
432432

433-
MAYBE_UNUSED QgsReadWriteContextCategoryPopper p = context.enterCategory( tr( "Layer" ), mne.text() );
433+
QgsReadWriteContextCategoryPopper p = context.enterCategory( tr( "Layer" ), mne.text() );
434434

435435
// now let the children grab what they need from the Dom node.
436436
layerError = !readXml( layerElement, context );

src/core/qgsreadwritecontext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ QgsReadWriteContextCategoryPopper QgsReadWriteContext::enterCategory( const QStr
4141
if ( !details.isEmpty() )
4242
message.append( QString( " :: %1" ).arg( details ) );
4343
mCategories.push_back( message );
44-
return QgsReadWriteContextCategoryPopper( this );
44+
return QgsReadWriteContextCategoryPopper( *this );
4545
}
4646

4747
void QgsReadWriteContext::leaveCategory()

src/core/qgsreadwritecontext.h

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class CORE_EXPORT QgsReadWriteContext
8888
* \note Not available in the Python bindings.
8989
* \since QGIS 3.2
9090
*/
91-
NODISCARD QgsReadWriteContextCategoryPopper enterCategory( const QString &category, const QString &details = QString() );
91+
MAYBE_UNUSED NODISCARD QgsReadWriteContextCategoryPopper enterCategory( const QString &category, const QString &details = QString() );
9292
#endif
9393

9494
/**
@@ -114,18 +114,10 @@ class CORE_EXPORT QgsReadWriteContext
114114
class QgsReadWriteContextCategoryPopper
115115
{
116116
public:
117-
118-
QgsReadWriteContextCategoryPopper( QgsReadWriteContext *context )
119-
: mContext( context )
120-
{}
121-
122-
~QgsReadWriteContextCategoryPopper()
123-
{
124-
if ( mContext )
125-
mContext->leaveCategory();
126-
}
127-
128-
QgsReadWriteContext *mContext;
117+
QgsReadWriteContextCategoryPopper( QgsReadWriteContext &context ) : mContext( context ) {}
118+
~QgsReadWriteContextCategoryPopper() {mContext.leaveCategory();}
119+
private:
120+
QgsReadWriteContext mContext;
129121
};
130122
///@endcond PRIVATE
131123
#endif

src/core/qgsvectorlayer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1688,7 +1688,7 @@ void QgsVectorLayer::resolveReferences( QgsProject *project )
16881688

16891689
bool QgsVectorLayer::readSymbology( const QDomNode &layerNode, QString &errorMessage, QgsReadWriteContext &context )
16901690
{
1691-
MAYBE_UNUSED QgsReadWriteContextCategoryPopper p = context.enterCategory( tr( "Symbology" ) );
1691+
QgsReadWriteContextCategoryPopper p = context.enterCategory( tr( "Symbology" ) );
16921692

16931693
if ( !mExpressionFieldBuffer )
16941694
mExpressionFieldBuffer = new QgsExpressionFieldBuffer();

0 commit comments

Comments
 (0)