aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cppeditor/functionutils.h
blob: 1a6243677396b03e6e51bfc655ba810a98a3dbac (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
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0

#pragma once

#include <QList>
#include <QObject>

namespace CPlusPlus {
class Class;
class Function;
class LookupContext;
class Snapshot;
class Symbol;
} // namespace CPlusPlus

namespace CppEditor::Internal {

class FunctionUtils
{
public:
    static bool isVirtualFunction(const CPlusPlus::Function *function,
                                  const CPlusPlus::LookupContext &context,
                                  QList<const CPlusPlus::Function *> *firstVirtuals = nullptr);

    static bool isPureVirtualFunction(const CPlusPlus::Function *function,
                                      const CPlusPlus::LookupContext &context,
                                      QList<const CPlusPlus::Function *> *firstVirtuals = nullptr);

    static QList<CPlusPlus::Function *> overrides(CPlusPlus::Function *function,
                                                  CPlusPlus::Class *functionsClass,
                                                  CPlusPlus::Class *staticClass,
                                                  const CPlusPlus::Snapshot &snapshot);
};

#ifdef WITH_TESTS
class FunctionUtilsTest : public QObject
{
    Q_OBJECT

private slots:
    void testVirtualFunctions();
    void testVirtualFunctions_data();
};
#endif // WITH_TESTS

} // namespace CppEditor::Internal