OSDN Git Service

98d32ea00f5c1219eeef2dd7bb46cf692657fb04
[qt-creator-jp/qt-creator-jp.git] / src / plugins / projectexplorer / toolchain.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
8 **
9 ** No Commercial Usage
10 **
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
14 ** this package.
15 **
16 ** GNU Lesser General Public License Usage
17 **
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file.  Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights.  These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
31 **
32 **************************************************************************/
33
34 #ifndef TOOLCHAIN_H
35 #define TOOLCHAIN_H
36
37 #include "projectexplorer_export.h"
38
39 #include <QtCore/QObject>
40 #include <QtCore/QString>
41 #include <QtCore/QVariantMap>
42
43 namespace Utils {
44 class Environment;
45 }
46
47 namespace ProjectExplorer {
48
49 namespace Internal {
50 class ToolChainPrivate;
51 }
52
53 class Abi;
54 class HeaderPath;
55 class IOutputParser;
56 class ToolChainConfigWidget;
57 class ToolChainFactory;
58 class ToolChainManager;
59
60 // --------------------------------------------------------------------------
61 // ToolChain
62 // --------------------------------------------------------------------------
63
64 class PROJECTEXPLORER_EXPORT ToolChain
65 {
66 public:
67     virtual ~ToolChain();
68
69     QString displayName() const;
70     void setDisplayName(const QString &name);
71
72     bool isAutoDetected() const;
73     QString id() const;
74
75     virtual QString typeName() const = 0;
76     virtual Abi targetAbi() const = 0;
77
78     virtual bool isValid() const = 0;
79
80     /// Returns a list of target ids that this tool chain is restricted to.
81     /// An empty list is shows that the toolchain is compatible with all targets.
82     virtual QStringList restrictedToTargets() const;
83
84     virtual QByteArray predefinedMacros() const = 0;
85     virtual QList<HeaderPath> systemHeaderPaths() const = 0;
86     virtual void addToEnvironment(Utils::Environment &env) const = 0;
87     virtual QString makeCommand() const = 0;
88
89     virtual QString debuggerCommand() const = 0;
90     virtual QString defaultMakeTarget() const;
91     virtual IOutputParser *outputParser() const = 0;
92
93     virtual bool operator ==(const ToolChain &) const;
94
95     virtual ToolChainConfigWidget *configurationWidget() = 0;
96     virtual bool canClone() const;
97     virtual ToolChain *clone() const = 0;
98
99     // Used by the toolchainmanager to save user-generated tool chains.
100     // Make sure to call this method when deriving!
101     virtual QVariantMap toMap() const;
102
103 protected:
104     ToolChain(const QString &id, bool autoDetect);
105     explicit ToolChain(const ToolChain &);
106
107     void setId(const QString &id);
108
109     void toolChainUpdated();
110
111     // Make sure to call this method when deriving!
112     virtual bool fromMap(const QVariantMap &data);
113
114 private:
115     void setAutoDetected(bool);
116
117     Internal::ToolChainPrivate *const m_d;
118
119     friend class ToolChainManager;
120     friend class ToolChainFactory;
121 };
122
123 // --------------------------------------------------------------------------
124 // ToolChainFactory
125 // --------------------------------------------------------------------------
126
127 class PROJECTEXPLORER_EXPORT ToolChainFactory : public QObject
128 {
129     Q_OBJECT
130
131 public:
132     // Name used to display the name of the tool chain that will be created.
133     virtual QString displayName() const = 0;
134     virtual QString id() const = 0;
135
136     virtual QList<ToolChain *> autoDetect();
137
138     virtual bool canCreate();
139     virtual ToolChain *create();
140
141     // Used by the ToolChainManager to restore user-generated tool chains
142     virtual bool canRestore(const QVariantMap &data);
143     virtual ToolChain *restore(const QVariantMap &data);
144
145     static QString idFromMap(const QVariantMap &data);
146 };
147
148 } // namespace ProjectExplorer
149
150 #endif // TOOLCHAIN_H