summaryrefslogtreecommitdiff
path: root/src/plugins/boostbuildprojectmanager/b2project.h
blob: 6b8a813443aa2c6a5f0fdc9ba1b81c3c675878f3 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
//
// Copyright (C) 2013 Mateusz Łoskot <mateusz@loskot.net>
//
// This file is part of Qt Creator Boost.Build plugin project.
//
// This is free software; you can redistribute and/or modify it under
// the terms of the GNU Lesser General Public License, Version 2.1
// as published by the Free Software Foundation.
// See accompanying file LICENSE.txt or copy at
// http://www.gnu.org/licenses/lgpl-2.1-standalone.html.
//
#ifndef BBPROJECT_HPP
#define BBPROJECT_HPP

// Qt Creator
#include <app/app_version.h>
#include <coreplugin/idocument.h>
#include <projectexplorer/project.h>
#include <utils/fileutils.h>
// Qt
#include <QString>
#include <QFuture>
#include <QFutureInterface>

namespace BoostBuildProjectManager {
namespace Internal {

class ProjectFile;
class ProjectManager;
class ProjectNode;

// Represents a project node in the project explorer.
class Project : public ProjectExplorer::Project
{
    Q_OBJECT

public:
    Project(ProjectManager* manager, QString const& fileName);
    ~Project();

#if defined(IDE_VERSION_MAJOR) && (IDE_VERSION_MAJOR == 3 && IDE_VERSION_MINOR == 0)
    Core::Id id() const;
#endif
    QString displayName() const;
    Core::IDocument* document() const;
    ProjectExplorer::IProjectManager* projectManager() const;
    ProjectExplorer::ProjectNode* rootProjectNode() const;
    QStringList files(FilesMode fileMode) const;

    bool needsConfiguration() const;

    void refresh();

    QString filesFilePath() const;
    QStringList files() const;

    QString includesFilePath() const;

    static QString defaultProjectName(QString const& fileName);
    static QString defaultBuildDirectory(QString const& top);
    static QString defaultWorkingDirectory(QString const& top);

protected:

     QVariantMap toMap() const;

    // Deserializes all project data from the map object
    // Calls the base ProjectExplorer::Project::fromMap function first.
    bool fromMap(QVariantMap const& map);

private:

    void setProjectName(QString const& name);

    // Corresponding project manager passed to the constructor
    ProjectManager* manager_;

    // By default, name of directory with Jamfile.
    // Boost.Build treats each Jamfile is a separate project,
    // where hierarchy of Jamfiles makes hierarchy of projects.
    QString projectName_;

    // Jamfile passed to the constructor (Jamroot, Jamfile, Jamfile.v2).
    QString filePath_;

    // Auxiliary file Jamfile.${JAMFILE_FILES_EXT} with list of source files.
    // Role of this file is similar to the .files file in the GenericProjectManager,
    // hence managing of this file is implemented in very similar manner.
    QString filesFilePath_;
    QStringList files_;
    QStringList filesRaw_;
    QHash<QString, QString> entriesRaw_;

    // Auxiliary file Jamfile.${JAMFILE_INCLUDES_EXT} with list of source files.
    QString includesFilePath_;

    ProjectFile* projectFile_;
    ProjectNode* projectNode_;

    QFuture<void> cppModelFuture_;
};

} // namespace Internal
} // namespace BoostBuildProjectManager

#endif // BBPROJECT_HPP