cppsemanticinfo.h 2.8 KB
Newer Older
hjk's avatar
hjk committed
1
/****************************************************************************
2
**
3
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
hjk's avatar
hjk committed
4
** Contact: http://www.qt-project.org/legal
5
**
hjk's avatar
hjk committed
6
** This file is part of Qt Creator.
7
**
hjk's avatar
hjk committed
8 9 10 11 12
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.  For licensing terms and
Eike Ziller's avatar
Eike Ziller committed
13 14
** conditions see http://www.qt.io/licensing.  For further information
** use the contact form at http://www.qt.io/contact-us.
15 16
**
** GNU Lesser General Public License Usage
hjk's avatar
hjk committed
17
** Alternatively, this file may be used under the terms of the GNU Lesser
Eike Ziller's avatar
Eike Ziller committed
18 19 20 21 22 23
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file.  Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
hjk's avatar
hjk committed
24 25 26
**
** In addition, as a special exception, Digia gives you certain additional
** rights.  These rights are described in the Digia Qt LGPL Exception
con's avatar
con committed
27 28
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
hjk's avatar
hjk committed
29
****************************************************************************/
30 31 32 33

#ifndef CPPSEMANTICINFO_H
#define CPPSEMANTICINFO_H

34 35
#include "cpptools_global.h"

36 37
#include <texteditor/semantichighlighter.h>

38
#include <cplusplus/CppDocument.h>
39

40
#include <QHash>
41

42
namespace CppTools {
43

44
class CPPTOOLS_EXPORT SemanticInfo
45
{
46 47 48 49
public:
    struct Source
    {
        const QString fileName;
50
        const QByteArray code;
51
        const unsigned revision;
52
        CPlusPlus::Snapshot snapshot;
53 54
        const bool force;

55
        Source() : revision(0), force(false) {}
56

57
        Source(const QString &fileName,
58
               const QByteArray &code,
59
               unsigned revision,
60
               const CPlusPlus::Snapshot &snapshot,
61
               bool force)
62 63 64
            : fileName(fileName)
            , code(code)
            , revision(revision)
65
            , snapshot(snapshot)
66 67
            , force(force)
        {}
68 69
    };

70
public:
Erik Verbruggen's avatar
Erik Verbruggen committed
71
    typedef TextEditor::HighlightingResult Use;
72 73 74 75 76 77 78

    typedef QHash<CPlusPlus::Symbol *, QList<Use> > LocalUseMap;
    typedef QHashIterator<CPlusPlus::Symbol *, QList<Use> > LocalUseIterator;

    SemanticInfo();

    unsigned revision;
79
    bool complete;
80 81
    CPlusPlus::Snapshot snapshot;
    CPlusPlus::Document::Ptr doc;
82 83 84

    // Widget specific (e.g. related to cursor position)
    bool localUsesUpdated;
85
    LocalUseMap localUses;
86 87
};

88
} // namespace CppTools
89 90

#endif // CPPSEMANTICINFO_H