//-----------------------------------------------------------------------------
// File: TransactionalPortsFilter.h
//-----------------------------------------------------------------------------
// Project: Kactus2
// Author: Mikko Teuho
// Date: 08.05.2019
//
// Description:
// Sorting proxy model for transactional ports.
//-----------------------------------------------------------------------------

#ifndef TRANSACTIONALPORTSFILTER_H
#define TRANSACTIONALPORTSFILTER_H

#include <editors/ComponentEditor/ports/PortsFilter.h>

//-----------------------------------------------------------------------------
//! Sorting proxy model for transactional ports.
//-----------------------------------------------------------------------------
class TransactionalPortsFilter : public PortsFilter
{
    Q_OBJECT

public:

	 /*!
      *  Constructor.
      *
      *      @param [in] portsInterface     Interface for accessing the component ports.
      *      @param [in] parent             The parent object.
      */
    TransactionalPortsFilter(QSharedPointer<PortsInterface> portInterface, QObject* parent = 0);

	 /*!
      *  Destructor.
      */
    virtual ~TransactionalPortsFilter() = default;

    // No copying. No assignments.
    TransactionalPortsFilter(TransactionalPortsFilter const& rhs) = delete;
    TransactionalPortsFilter& operator=(TransactionalPortsFilter const& rhs) = delete;

private:

    /*!
     *  Get the index of the name column.
     *
     *      @return Index of the name column.
     */
    virtual int nameColumn() const override final;

    /*!
     *  Check if a port is filtered.
     *
     *      @param [in] portName    Name of the selected port.
     *
     *      @return True, if the port is accepted, false otherwise.
     */
    virtual bool portIsAccepted(QString const& portName) const override final;
};

#endif // TRANSACTIONALPORTSFILTER_H