diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2016-04-19 12:36:11 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2016-04-20 12:16:25 +0000 |
commit | f32a1b1e4ce4af1f6e223ca045a4041657cdaa13 (patch) | |
tree | 9141b5af452acc0742b6c6246179802df62bc410 /src/plugins/projectexplorer/buildsteplist.h | |
parent | 385237dbbd5261ff2825e5b054166ae6a225e423 (diff) |
ProjectExplorer: Add some more functions to buildsteplist
Use those functions instead of repeating code all over the place.
Change-Id: I03161663b4d5c538fb2ea667353ab7846373ad81
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
Diffstat (limited to 'src/plugins/projectexplorer/buildsteplist.h')
-rw-r--r-- | src/plugins/projectexplorer/buildsteplist.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/plugins/projectexplorer/buildsteplist.h b/src/plugins/projectexplorer/buildsteplist.h index 313c67f130..40a8614189 100644 --- a/src/plugins/projectexplorer/buildsteplist.h +++ b/src/plugins/projectexplorer/buildsteplist.h @@ -47,6 +47,27 @@ public: ~BuildStepList() override; QList<BuildStep *> steps() const; + QList<BuildStep *> steps(const std::function<bool(const BuildStep *)> &filter) const; + template <class BS> BS *firstOfType() { + BS *bs = nullptr; + for (int i = 0; i < count(); ++i) { + bs = qobject_cast<BS *>(at(i)); + if (bs) + return bs; + } + return nullptr; + } + template <class BS> QList<BS *>allOfType() { + QList<BS *> result; + BS *bs = nullptr; + for (int i = 0; i < count(); ++i) { + bs = qobject_cast<BS *>(at(i)); + if (bs) + result.append(bs); + } + return result; + } + bool isNull() const; int count() const; bool isEmpty() const; |