summaryrefslogtreecommitdiff
path: root/src/plugins/boostbuildprojectmanager/b2projectnode.h
blob: 9a1e5422dafd9354a200b13832fa8eb6c774625e (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
//
// Copyright (C) 2013 Mateusz Łoskot <mateusz@loskot.net>
// Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
//
// 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 BBPROJECTNODE_HPP
#define BBPROJECTNODE_HPP

// Qt Creator
#include <projectexplorer/projectnodes.h>
// Qt
#include <QFutureInterface>
#include <QList>
#include <QSet>
#include <QString>
#include <QStringList>

namespace Core {
class IDocument;
}

namespace ProjectExplorer {
class RunConfiguration;
}

namespace BoostBuildProjectManager {
namespace Internal {

class Project;

// An in-memory presentation of a Project.
// Represents a file or a folder of the project tree.
// No special operations (addFiles(), removeFiles(), renameFile(), etc.) are offered.
class ProjectNode : public ProjectExplorer::ProjectNode
{

public:
    ProjectNode(Project* project, Core::IDocument* projectFile);

    bool hasBuildTargets() const;
    QList<ProjectExplorer::ProjectAction> supportedActions(Node* node) const;
    bool canAddSubProject(QString const& filePath) const;
    bool addSubProjects(QStringList const& filePaths);
    bool removeSubProjects(QStringList const& filePaths);
    bool addFiles(QStringList const& filePaths, QStringList* notAdded /*= 0*/);
    bool removeFiles(QStringList const& filePaths, QStringList* notRemoved /*= 0*/);
    bool deleteFiles(QStringList const& filePaths);
    bool renameFile(QString const& filePath, QString const& newFilePath);
    QList<ProjectExplorer::RunConfiguration*> runConfigurationsFor(Node* node);

    void refresh(QSet<QString> oldFileList);

private:

    ProjectExplorer::FolderNode*
    createFolderByName(QStringList const& components, int end);

    ProjectExplorer::FolderNode*
    findFolderByName(QStringList const& components, int end) const;

    void removeEmptySubFolders(FolderNode* parent, FolderNode* subParent);

    Project* project_;
    Core::IDocument* projectFile_;
};

} // namespace Internal
} // namespace BoostBuildProjectManager

#endif // BBPROJECTNODE_HPP