Skip to content

Commit

Permalink
use MAYBE_UNUSED in the method declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Feb 28, 2018
1 parent 8582517 commit 05ee1b0
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/core/qgseditformconfig.cpp
Expand Up @@ -260,7 +260,7 @@ void QgsEditFormConfig::setSuppress( QgsEditFormConfig::FeatureFormSuppress s )

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

d.detach();

Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsmaplayer.cpp
Expand Up @@ -430,7 +430,7 @@ bool QgsMapLayer::readLayerXml( const QDomElement &layerElement, QgsReadWriteCo
// the subclass can also read custom properties
readCustomProperties( layerElement );

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

// now let the children grab what they need from the Dom node.
layerError = !readXml( layerElement, context );
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsreadwritecontext.cpp
Expand Up @@ -41,7 +41,7 @@ QgsReadWriteContextCategoryPopper QgsReadWriteContext::enterCategory( const QStr
if ( !details.isEmpty() )
message.append( QString( " :: %1" ).arg( details ) );
mCategories.push_back( message );
return QgsReadWriteContextCategoryPopper( this );
return QgsReadWriteContextCategoryPopper( *this );
}

void QgsReadWriteContext::leaveCategory()
Expand Down
18 changes: 5 additions & 13 deletions src/core/qgsreadwritecontext.h
Expand Up @@ -88,7 +88,7 @@ class CORE_EXPORT QgsReadWriteContext
* \note Not available in the Python bindings.
* \since QGIS 3.2
*/
NODISCARD QgsReadWriteContextCategoryPopper enterCategory( const QString &category, const QString &details = QString() );
MAYBE_UNUSED NODISCARD QgsReadWriteContextCategoryPopper enterCategory( const QString &category, const QString &details = QString() );
#endif

/**
Expand All @@ -114,18 +114,10 @@ class CORE_EXPORT QgsReadWriteContext
class QgsReadWriteContextCategoryPopper
{
public:

QgsReadWriteContextCategoryPopper( QgsReadWriteContext *context )
: mContext( context )
{}

~QgsReadWriteContextCategoryPopper()
{
if ( mContext )
mContext->leaveCategory();
}

QgsReadWriteContext *mContext;
QgsReadWriteContextCategoryPopper( QgsReadWriteContext &context ) : mContext( context ) {}
~QgsReadWriteContextCategoryPopper() {mContext.leaveCategory();}
private:
QgsReadWriteContext mContext;
};
///@endcond PRIVATE
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsvectorlayer.cpp
Expand Up @@ -1688,7 +1688,7 @@ void QgsVectorLayer::resolveReferences( QgsProject *project )

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

if ( !mExpressionFieldBuffer )
mExpressionFieldBuffer = new QgsExpressionFieldBuffer();
Expand Down

0 comments on commit 05ee1b0

Please sign in to comment.