aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/cplusplus/ExpressionUnderCursor.h
blob: 4ad95a7c71ffd2ccb4d94c96bbbb530e12a0c22a (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
// 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/CPlusPlusForwardDeclarations.h>
#include <cplusplus/Token.h>

#include <QList>

QT_BEGIN_NAMESPACE
class QString;
class QTextCursor;
QT_END_NAMESPACE

namespace CPlusPlus {

class BackwardsScanner;

class CPLUSPLUS_EXPORT ExpressionUnderCursor
{
public:
    ExpressionUnderCursor(const LanguageFeatures &languageFeatures);

    QString operator()(const QTextCursor &cursor);
    int startOfFunctionCall(const QTextCursor &cursor) const;

private:
    int startOfExpression(BackwardsScanner &tk, int index);
    int startOfExpression_helper(BackwardsScanner &tk, int index);

private:
    bool _jumpedComma;
    LanguageFeatures _languageFeatures;
};

} // namespace CPlusPlus