From e5233e2c11f03c5c01c83ba782e2dc2766f45bc7 Mon Sep 17 00:00:00 2001 From: Julien Cabieces Date: Wed, 7 May 2025 13:30:56 +0200 Subject: [PATCH] refactor(core): make deleted copy ctor/operator= private --- .../auto_generated/qgssqlstatement.sip.in | 10 --- .../auto_generated/qgssqlstatement.sip.in | 10 --- src/core/qgssqlstatement.h | 68 +++++++++++-------- 3 files changed, 38 insertions(+), 50 deletions(-) diff --git a/python/PyQt6/core/auto_generated/qgssqlstatement.sip.in b/python/PyQt6/core/auto_generated/qgssqlstatement.sip.in index 079dc6b28ba..d1f081301ed 100644 --- a/python/PyQt6/core/auto_generated/qgssqlstatement.sip.in +++ b/python/PyQt6/core/auto_generated/qgssqlstatement.sip.in @@ -312,7 +312,6 @@ Unary logical/arithmetical operator ( NOT, - ). Constructor %End - QgsSQLStatement::UnaryOperator op() const; %Docstring Operator @@ -351,7 +350,6 @@ Binary logical/arithmetical operator (AND, OR, =, +, ...). Constructor %End - QgsSQLStatement::BinaryOperator op() const; %Docstring Operator @@ -406,7 +404,6 @@ An 'x IN (y, z)' operator. Constructor %End - QgsSQLStatement::Node *node() const; %Docstring Variable at the left of IN @@ -449,7 +446,6 @@ An 'X BETWEEN y and z' operator. %Docstring Constructor %End - QgsSQLStatement::Node *node() const; %Docstring Variable at the left of BETWEEN @@ -498,7 +494,6 @@ Function with a name and arguments node. Constructor %End - QString name() const; %Docstring Returns function name @@ -628,7 +623,6 @@ Selected column. Constructor %End - void setAlias( const QString &alias ); %Docstring Sets alias name @@ -676,7 +670,6 @@ CAST operator. Constructor %End - QgsSQLStatement::Node *node() const; %Docstring Node that is referred to @@ -777,7 +770,6 @@ Constructor with table definition, ON expression Constructor with table definition and USING columns %End - QgsSQLStatement::NodeTableDef *tableDef() const; %Docstring Table definition @@ -831,7 +823,6 @@ Column in a ORDER BY. Constructor %End - QgsSQLStatement::NodeColumnRef *column() const; %Docstring The name of the column. @@ -875,7 +866,6 @@ Constructor %End ~NodeSelect(); - void setJoins( const QList &joins /Transfer/ ); %Docstring Sets joins diff --git a/python/core/auto_generated/qgssqlstatement.sip.in b/python/core/auto_generated/qgssqlstatement.sip.in index fec6173ef78..8a94d09990a 100644 --- a/python/core/auto_generated/qgssqlstatement.sip.in +++ b/python/core/auto_generated/qgssqlstatement.sip.in @@ -312,7 +312,6 @@ Unary logical/arithmetical operator ( NOT, - ). Constructor %End - QgsSQLStatement::UnaryOperator op() const; %Docstring Operator @@ -351,7 +350,6 @@ Binary logical/arithmetical operator (AND, OR, =, +, ...). Constructor %End - QgsSQLStatement::BinaryOperator op() const; %Docstring Operator @@ -406,7 +404,6 @@ An 'x IN (y, z)' operator. Constructor %End - QgsSQLStatement::Node *node() const; %Docstring Variable at the left of IN @@ -449,7 +446,6 @@ An 'X BETWEEN y and z' operator. %Docstring Constructor %End - QgsSQLStatement::Node *node() const; %Docstring Variable at the left of BETWEEN @@ -498,7 +494,6 @@ Function with a name and arguments node. Constructor %End - QString name() const; %Docstring Returns function name @@ -628,7 +623,6 @@ Selected column. Constructor %End - void setAlias( const QString &alias ); %Docstring Sets alias name @@ -676,7 +670,6 @@ CAST operator. Constructor %End - QgsSQLStatement::Node *node() const; %Docstring Node that is referred to @@ -777,7 +770,6 @@ Constructor with table definition, ON expression Constructor with table definition and USING columns %End - QgsSQLStatement::NodeTableDef *tableDef() const; %Docstring Table definition @@ -831,7 +823,6 @@ Column in a ORDER BY. Constructor %End - QgsSQLStatement::NodeColumnRef *column() const; %Docstring The name of the column. @@ -875,7 +866,6 @@ Constructor %End ~NodeSelect(); - void setJoins( const QList &joins /Transfer/ ); %Docstring Sets joins diff --git a/src/core/qgssqlstatement.h b/src/core/qgssqlstatement.h index edcd6365743..0902d26bf92 100644 --- a/src/core/qgssqlstatement.h +++ b/src/core/qgssqlstatement.h @@ -328,9 +328,6 @@ class CORE_EXPORT QgsSQLStatement //! Constructor NodeUnaryOperator( QgsSQLStatement::UnaryOperator op, QgsSQLStatement::Node *operand SIP_TRANSFER ) : mOp( op ), mOperand( operand ) {} - NodeUnaryOperator( const NodeUnaryOperator &other ) = delete; - NodeUnaryOperator &operator=( const NodeUnaryOperator &other ) = delete; - //! Operator QgsSQLStatement::UnaryOperator op() const { return mOp; } @@ -344,6 +341,10 @@ class CORE_EXPORT QgsSQLStatement QgsSQLStatement::Node *clone() const override SIP_FACTORY; private: + + NodeUnaryOperator( const NodeUnaryOperator &other ) = delete; + NodeUnaryOperator &operator=( const NodeUnaryOperator &other ) = delete; + #ifdef SIP_RUN NodeUnaryOperator( const NodeUnaryOperator &other ); #endif @@ -367,9 +368,6 @@ class CORE_EXPORT QgsSQLStatement , mOpRight( opRight ) {} - NodeBinaryOperator( const NodeBinaryOperator &other ) = delete; - NodeBinaryOperator &operator=( const NodeBinaryOperator &other ) = delete; - //! Operator QgsSQLStatement::BinaryOperator op() const { return mOp; } @@ -392,6 +390,10 @@ class CORE_EXPORT QgsSQLStatement bool leftAssociative() const; private: + + NodeBinaryOperator( const NodeBinaryOperator &other ) = delete; + NodeBinaryOperator &operator=( const NodeBinaryOperator &other ) = delete; + #ifdef SIP_RUN NodeBinaryOperator( const NodeBinaryOperator &other ); #endif @@ -413,9 +415,6 @@ class CORE_EXPORT QgsSQLStatement //! Constructor NodeInOperator( QgsSQLStatement::Node *node SIP_TRANSFER, QgsSQLStatement::NodeList *list SIP_TRANSFER, bool notin = false ) : mNode( node ), mList( list ), mNotIn( notin ) {} - NodeInOperator( const NodeInOperator &other ) = delete; - NodeInOperator &operator=( const NodeInOperator &other ) = delete; - //! Variable at the left of IN QgsSQLStatement::Node *node() const { return mNode.get(); } @@ -432,6 +431,10 @@ class CORE_EXPORT QgsSQLStatement QgsSQLStatement::Node *clone() const override SIP_FACTORY; private: + + NodeInOperator( const NodeInOperator &other ) = delete; + NodeInOperator &operator=( const NodeInOperator &other ) = delete; + #ifdef SIP_RUN NodeInOperator( const NodeInOperator &other ); #endif @@ -453,9 +456,6 @@ class CORE_EXPORT QgsSQLStatement NodeBetweenOperator( QgsSQLStatement::Node *node SIP_TRANSFER, QgsSQLStatement::Node *minVal SIP_TRANSFER, QgsSQLStatement::Node *maxVal SIP_TRANSFER, bool notBetween = false ) : mNode( node ), mMinVal( minVal ), mMaxVal( maxVal ), mNotBetween( notBetween ) {} - NodeBetweenOperator( const NodeBetweenOperator &other ) = delete; - NodeBetweenOperator &operator=( const NodeBetweenOperator &other ) = delete; - //! Variable at the left of BETWEEN QgsSQLStatement::Node *node() const { return mNode.get(); } @@ -475,6 +475,10 @@ class CORE_EXPORT QgsSQLStatement QgsSQLStatement::Node *clone() const override SIP_FACTORY; private: + + NodeBetweenOperator( const NodeBetweenOperator &other ) = delete; + NodeBetweenOperator &operator=( const NodeBetweenOperator &other ) = delete; + #ifdef SIP_RUN NodeBetweenOperator( const NodeBetweenOperator &other ); #endif @@ -496,9 +500,6 @@ class CORE_EXPORT QgsSQLStatement //! Constructor NodeFunction( const QString &name, QgsSQLStatement::NodeList *args SIP_TRANSFER ) : mName( name ), mArgs( args ) {} - NodeFunction( const NodeFunction &other ) = delete; - NodeFunction &operator=( const NodeFunction &other ) = delete; - //! Returns function name QString name() const { return mName; } @@ -512,6 +513,10 @@ class CORE_EXPORT QgsSQLStatement QgsSQLStatement::Node *clone() const override SIP_FACTORY; private: + + NodeFunction( const NodeFunction &other ) = delete; + NodeFunction &operator=( const NodeFunction &other ) = delete; + #ifdef SIP_RUN NodeFunction( const NodeFunction &other ); #endif @@ -597,9 +602,6 @@ class CORE_EXPORT QgsSQLStatement //! Constructor NodeSelectedColumn( QgsSQLStatement::Node *node SIP_TRANSFER ) : mColumnNode( node ) {} - NodeSelectedColumn( const NodeSelectedColumn &other ) = delete; - NodeSelectedColumn &operator=( const NodeSelectedColumn &other ) = delete; - //! Sets alias name void setAlias( const QString &alias ) { mAlias = alias; } @@ -618,6 +620,10 @@ class CORE_EXPORT QgsSQLStatement QgsSQLStatement::NodeSelectedColumn *cloneThis() const SIP_FACTORY; private: + + NodeSelectedColumn( const NodeSelectedColumn &other ) = delete; + NodeSelectedColumn &operator=( const NodeSelectedColumn &other ) = delete; + #ifdef SIP_RUN NodeSelectedColumn( const NodeSelectedColumn &other ); #endif @@ -637,9 +643,6 @@ class CORE_EXPORT QgsSQLStatement //! Constructor NodeCast( QgsSQLStatement::Node *node SIP_TRANSFER, const QString &type ) : mNode( node ), mType( type ) {} - NodeCast( const NodeCast &other ) = delete; - NodeCast &operator=( const NodeCast &other ) = delete; - //! Node that is referred to QgsSQLStatement::Node *node() const { return mNode.get(); } @@ -654,6 +657,9 @@ class CORE_EXPORT QgsSQLStatement private: + NodeCast( const NodeCast &other ) = delete; + NodeCast &operator=( const NodeCast &other ) = delete; + #ifdef SIP_RUN NodeCast( const NodeCast &other ); #endif @@ -720,9 +726,6 @@ class CORE_EXPORT QgsSQLStatement //! Constructor with table definition and USING columns NodeJoin( QgsSQLStatement::NodeTableDef *tabledef SIP_TRANSFER, const QList &usingColumns, QgsSQLStatement::JoinType type ) : mTableDef( tabledef ), mUsingColumns( usingColumns ), mType( type ) {} - NodeJoin( const NodeJoin &other ) = delete; - NodeJoin &operator=( const NodeJoin &other ) = delete; - //! Table definition QgsSQLStatement::NodeTableDef *tableDef() const { return mTableDef.get(); } @@ -744,6 +747,10 @@ class CORE_EXPORT QgsSQLStatement QgsSQLStatement::NodeJoin *cloneThis() const SIP_FACTORY; private: + + NodeJoin( const NodeJoin &other ) = delete; + NodeJoin &operator=( const NodeJoin &other ) = delete; + #ifdef SIP_RUN NodeJoin( const NodeJoin &other ); #endif @@ -765,9 +772,6 @@ class CORE_EXPORT QgsSQLStatement //! Constructor NodeColumnSorted( QgsSQLStatement::NodeColumnRef *column SIP_TRANSFER, bool asc ) : mColumn( column ), mAsc( asc ) {} - NodeColumnSorted( const NodeColumnSorted &other ) = delete; - NodeColumnSorted &operator=( const NodeColumnSorted &other ) = delete; - //! The name of the column. QgsSQLStatement::NodeColumnRef *column() const { return mColumn.get(); } @@ -783,6 +787,10 @@ class CORE_EXPORT QgsSQLStatement QgsSQLStatement::NodeColumnSorted *cloneThis() const SIP_FACTORY; private: + + NodeColumnSorted( const NodeColumnSorted &other ) = delete; + NodeColumnSorted &operator=( const NodeColumnSorted &other ) = delete; + #ifdef SIP_RUN NodeColumnSorted( const NodeColumnSorted &other ); #endif @@ -803,9 +811,6 @@ class CORE_EXPORT QgsSQLStatement NodeSelect( const QList &tableList SIP_TRANSFER, const QList &columns SIP_TRANSFER, bool distinct ) : mTableList( tableList ), mColumns( columns ), mDistinct( distinct ) {} ~NodeSelect() override; - NodeSelect( const NodeSelect &other ) = delete; - NodeSelect &operator=( const NodeSelect &other ) = delete; - //! Sets joins void setJoins( const QList &joins SIP_TRANSFER ) { qDeleteAll( mJoins ); mJoins = joins; } //! Append a join @@ -836,6 +841,9 @@ class CORE_EXPORT QgsSQLStatement private: + NodeSelect( const NodeSelect &other ) = delete; + NodeSelect &operator=( const NodeSelect &other ) = delete; + #ifdef SIP_RUN NodeSelect( const NodeSelect &other ); #endif