forked from qt-creator/qt-creator
Valgrind: Use a lambda to provide filtering in the error model
Makes code more compact and local. Change-Id: Id8973558292257e4d8a5a2648cd93f54411984a8 Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
@@ -29,13 +29,12 @@
|
||||
#include <debugger/analyzer/detailederrorview.h>
|
||||
#include <utils/treemodel.h>
|
||||
|
||||
#include <QSharedPointer>
|
||||
#include <functional>
|
||||
|
||||
namespace Valgrind {
|
||||
namespace XmlProtocol {
|
||||
|
||||
class Error;
|
||||
class ErrorListModelPrivate;
|
||||
class Frame;
|
||||
|
||||
class ErrorListModel : public Utils::TreeModel
|
||||
@@ -47,24 +46,22 @@ public:
|
||||
ErrorRole = Debugger::DetailedErrorView::FullTextRole + 1,
|
||||
};
|
||||
|
||||
class RelevantFrameFinder
|
||||
{
|
||||
public:
|
||||
virtual ~RelevantFrameFinder() {}
|
||||
virtual Frame findRelevant(const Error &error) const = 0;
|
||||
};
|
||||
|
||||
explicit ErrorListModel(QObject *parent = 0);
|
||||
~ErrorListModel();
|
||||
|
||||
QSharedPointer<const RelevantFrameFinder> relevantFrameFinder() const;
|
||||
void setRelevantFrameFinder(const QSharedPointer<const RelevantFrameFinder> &finder);
|
||||
typedef std::function<Frame(const Error &)> RelevantFrameFinder;
|
||||
RelevantFrameFinder relevantFrameFinder() const;
|
||||
void setRelevantFrameFinder(const RelevantFrameFinder &relevantFrameFinder);
|
||||
|
||||
public slots:
|
||||
void addError(const Valgrind::XmlProtocol::Error &error);
|
||||
|
||||
private:
|
||||
ErrorListModelPrivate *const d;
|
||||
friend class ErrorItem;
|
||||
friend class StackItem;
|
||||
QVariant errorData(const QModelIndex &index, int role) const;
|
||||
Frame findRelevantFrame(const Error &error) const;
|
||||
QString errorLocation(const Error &error) const;
|
||||
|
||||
RelevantFrameFinder m_relevantFrameFinder;
|
||||
};
|
||||
|
||||
} // namespace XmlProtocol
|
||||
|
||||
Reference in New Issue
Block a user