summaryrefslogtreecommitdiff
path: root/src/tools/clangbackend/ipcsource/highlightinginformations.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clangbackend/ipcsource/highlightinginformations.cpp')
-rw-r--r--src/tools/clangbackend/ipcsource/highlightinginformations.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/tools/clangbackend/ipcsource/highlightinginformations.cpp b/src/tools/clangbackend/ipcsource/highlightinginformations.cpp
index f7157768fd..c90ea4a590 100644
--- a/src/tools/clangbackend/ipcsource/highlightinginformations.cpp
+++ b/src/tools/clangbackend/ipcsource/highlightinginformations.cpp
@@ -30,6 +30,10 @@
#include "highlightinginformations.h"
+#include "highlightingmarkcontainer.h"
+
+#include <QVector>
+
namespace ClangBackEnd {
HighlightingInformations::HighlightingInformations(CXTranslationUnit cxTranslationUnit, CXToken *tokens, uint tokensCount)
@@ -56,6 +60,20 @@ HighlightingInformations::const_iterator HighlightingInformations::end() const
return const_iterator(cxCursor.cend(), cxToken + cxTokenCount, cxTranslationUnit);
}
+QVector<HighlightingMarkContainer> HighlightingInformations::toHighlightingMarksContainers() const
+{
+ QVector<HighlightingMarkContainer> containers;
+ containers.reserve(size());
+
+ const auto isValidHighlightMark = [] (const HighlightingInformation &highlightMark) {
+ return !highlightMark.hasType(HighlightingType::Invalid);
+ };
+
+ std::copy_if(begin(), end(), std::back_inserter(containers), isValidHighlightMark);
+
+ return containers;
+}
+
bool HighlightingInformations::isEmpty() const
{
return cxTokenCount == 0;