1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
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
16 ** GNU Lesser General Public License Usage
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.
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.
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
32 **************************************************************************/
34 #ifndef PROCESSPARAMETERS_H
35 #define PROCESSPARAMETERS_H
37 #include "projectexplorer_export.h"
39 #include <utils/environment.h>
42 class AbstractMacroExpander;
45 namespace ProjectExplorer {
48 ProcessParameters aggregates all parameters needed to start a process.
50 It offers a set of functions which expand macros and environment variables
51 inside the raw parameters to obtain final values for starting a process
52 or for display purposes.
55 class PROJECTEXPLORER_EXPORT ProcessParameters
60 /// setCommand() sets the executable to run
61 void setCommand(const QString &cmd);
62 QString command() const { return m_command; }
64 /// sets the command line arguments used by the process
65 void setArguments(const QString &arguments);
66 QString arguments() const { return m_arguments; }
68 /// sets the workingDirectory for the process for a buildConfiguration
69 /// should be called from init()
70 void setWorkingDirectory(const QString &workingDirectory);
71 QString workingDirectory() const { return m_workingDirectory; }
73 /// Set the Environment for running the command
74 /// should be called from init()
75 void setEnvironment(const Utils::Environment &env) { m_environment = env; }
76 Utils::Environment environment() const { return m_environment; }
78 /// Set the macro expander to use on the command, arguments and working dir.
79 /// Note that the caller retains ownership of the object.
80 void setMacroExpander(Utils::AbstractMacroExpander *mx) { m_macroExpander = mx; }
81 Utils::AbstractMacroExpander *macroExpander() const { return m_macroExpander; }
83 /// Get the fully expanded working directory:
84 QString effectiveWorkingDirectory() const;
85 /// Get the fully expanded command name to run:
86 QString effectiveCommand() const;
87 /// Get the fully expanded arguments to use:
88 QString effectiveArguments() const;
90 /// True if effectiveCommand() would return only a fallback
91 bool commandMissing() const;
93 QString prettyCommand() const;
94 QString prettyArguments() const;
95 QString summary(const QString &displayName) const;
96 QString summaryInWorkdir(const QString &displayName) const;
99 QString m_workingDirectory;
102 Utils::Environment m_environment;
103 Utils::AbstractMacroExpander *m_macroExpander;
105 mutable QString m_effectiveWorkingDirectory;
106 mutable QString m_effectiveCommand;
107 mutable QString m_effectiveArguments;
108 mutable bool m_commandMissing;
111 } // namespace ProjectExplorer
113 #endif // PROCESSPARAMETERS_H