summaryrefslogtreecommitdiff
path: root/src/plugins/boostbuildprojectmanager/b2project.h
blob: 4ac1cc89ff5eeb2aa39e4bed8727d9e76b553acf (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
//
// 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

#include <coreplugin/idocument.h>
#include <projectexplorer/project.h>
#include <utils/fileutils.h>

#include <QFuture>
#include <QString>

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();

    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;
    bool fromMap(QVariantMap const& map);

private:
    void setProjectName(QString const& name);

    // Corresponding project manager passed to the constructor
    ProjectManager *m_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 m_projectName;

    // Jamfile passed to the constructor (Jamroot, Jamfile, Jamfile.v2).
    QString m_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 m_filesFilePath;
    QStringList m_files;
    QStringList m_filesRaw;
    QHash<QString, QString> m_entriesRaw;

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

    ProjectFile *m_projectFile;
    ProjectNode *m_projectNode;

    QFuture<void> m_cppModelFuture;
};

} // namespace Internal
} // namespace BoostBuildProjectManager

#endif // BBPROJECT_HPP