summaryrefslogtreecommitdiff
path: root/src/plugins/clangcodemodel/clangactivationsequenceprocessor.h
blob: 511159e91ff6b1307cb18286a93b4db024623245 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#pragma once

#include <cplusplus/Token.h>

#include <QString>

namespace ClangCodeModel {
namespace Internal {

class ActivationSequenceProcessor
{
public:
    ActivationSequenceProcessor(const QString &activationString,
                                int positionInDocument,
                                bool wantFunctionCall);

    CPlusPlus::Kind completionKind() const;
    int offset() const;
    int operatorStartPosition() const; // e.g. points to '.' for "foo.bar<CURSOR>"

private:
    void extractCharactersBeforePosition(const QString &activationString);
    void process();
    void processDot();
    void processComma();
    void processLeftParen();
    void processLeftBrace();
    void processColonColon();
    void processArrow();
    void processDotStar();
    void processArrowStar();
    void processDoxyGenComment();
    void processAngleStringLiteral();
    void processStringLiteral();
    void processSlash();
    void processPound();

private:
    CPlusPlus::Kind m_completionKind = CPlusPlus::T_EOF_SYMBOL;
    int m_offset = 0;
    int m_positionInDocument;
    QChar m_char1;
    QChar m_char2;
    QChar m_char3;
    bool m_wantFunctionCall;
};

} // namespace Internal
} // namespace ClangCodeModel