aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/qmljs/qmljsfindexportedcpptypes.h
blob: bacb7253a440d319982744139acda3a410b39619 (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
// 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 "qmljs_global.h"
#include <cplusplus/CppDocument.h>
#include <languageutils/fakemetaobject.h>

#include <QCoreApplication>
#include <QHash>

namespace QmlJS {

class QMLJS_EXPORT FindExportedCppTypes
{
    Q_DECLARE_TR_FUNCTIONS(QmlJSTools::FindExportedCppTypes)
public:
    FindExportedCppTypes(const CPlusPlus::Snapshot &snapshot);

    // document must have a valid source and ast for the duration of the call
    QStringList operator()(const CPlusPlus::Document::Ptr &document);

    QList<LanguageUtils::FakeMetaObject::ConstPtr> exportedTypes() const;
    QHash<QString, QString> contextProperties() const;

    static bool maybeExportsTypes(const CPlusPlus::Document::Ptr &document);

private:
    CPlusPlus::Snapshot m_snapshot;
    QList<LanguageUtils::FakeMetaObject::ConstPtr> m_exportedTypes;
    QHash<QString, QString> m_contextProperties;
};

} // namespace QmlJS