// Purpose : Constructor
//=======================================================================
SMESH_LogicalFilter::SMESH_LogicalFilter (const QList<SUIT_SelectionFilter*>& theFilters,
- const int theLogOp)
+ const int theLogOp,
+ bool takeOwnership)
+ : myOwnership( takeOwnership )
{
setFilters(theFilters);
setOperation(theLogOp);
//=======================================================================
SMESH_LogicalFilter::~SMESH_LogicalFilter()
{
+ deleteFilters();
}
//=======================================================================
//=======================================================================
void SMESH_LogicalFilter::setFilters (const QList<SUIT_SelectionFilter*>& theFilters)
{
+ deleteFilters();
myFilters = theFilters;
}
{
return myOperation;
}
+//================================================================================
+/*!
+ * \brief Deletes filters if has an ownership
+ */
+//================================================================================
+
+void SMESH_LogicalFilter::deleteFilters()
+{
+ if ( myOwnership )
+ {
+ SUIT_SelectionFilter* filter;
+ foreach( filter, myFilters )
+ delete filter;
+ }
+}
enum { LO_OR, LO_AND, LO_NOT, LO_UNDEFINED };
public:
- SMESH_LogicalFilter( const QList<SUIT_SelectionFilter*>&, const int );
+ SMESH_LogicalFilter( const QList<SUIT_SelectionFilter*>&, const int, bool takeOwnership=false );
virtual ~SMESH_LogicalFilter();
virtual bool isOk (const SUIT_DataOwner*) const;
const QList<SUIT_SelectionFilter*> getFilters() const;
int getOperation() const;
+private:
+ void deleteFilters();
+
private:
QList<SUIT_SelectionFilter*> myFilters;
int myOperation;
+ bool myOwnership;
};
#endif