Cppcheck
application.h
Go to the documentation of this file.
1 /*
2  * Cppcheck - A tool for static C/C++ code analysis
3  * Copyright (C) 2007-2024 Cppcheck team.
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef APPLICATION_H
20 #define APPLICATION_H
21 
22 #include <QString>
23 
24 /**
25  * @brief A class containing information of the application to execute.
26  *
27  * Each application has a name and a path. Name is displayed to the user
28  * and has no other meaning. It isn't used to start the application.
29  * Path contains the full path to the application containing the executable name.
30  * Parameters contains the command line arguments for the executable.
31  *
32  * User can also specify certain predefined strings to parameters. These strings
33  * will be replaced with appropriate values concerning the error. Strings are:
34  * (file) - Filename containing the error
35  * (line) - Line number containing the error
36  * (message) - Error message
37  * (severity) - Error severity
38  *
39  * Example opening a file with Kate and make Kate scroll to the correct line.
40  * Executable: kate
41  * Parameters: -l(line) (file)
42  */
43 class Application {
44 public:
45  Application() = default;
46  Application(QString name, QString path, QString params);
47 
48  /**
49  * @brief Get application name.
50  * @return Application name.
51  */
52  const QString& getName() const {
53  return mName;
54  }
55 
56  /**
57  * @brief Get application path.
58  * @return Application path.
59  */
60  const QString& getPath() const {
61  return mPath;
62  }
63 
64  /**
65  * @brief Get application command line parameters.
66  * @return Application command line parameters.
67  */
68  const QString& getParameters() const {
69  return mParameters;
70  }
71 
72  /**
73  * @brief Set application name.
74  * @param name Application name.
75  */
76  void setName(const QString &name) {
77  mName = name;
78  }
79 
80  /**
81  * @brief Set application path.
82  * @param path Application path.
83  */
84  void setPath(const QString &path) {
85  mPath = path;
86  }
87 
88  /**
89  * @brief Set application command line parameters.
90  * @param parameters Application command line parameters.
91  */
92  void setParameters(const QString &parameters) {
93  mParameters = parameters;
94  }
95 
96 private:
97 
98  /**
99  * @brief Application's name
100  */
101  QString mName;
102 
103  /**
104  * @brief Application's path
105  */
106  QString mPath;
107 
108  /**
109  * @brief Application's parameters
110  */
111  QString mParameters;
112 };
113 
114 #endif // APPLICATION_H
A class containing information of the application to execute.
Definition: application.h:43
Application()=default
const QString & getParameters() const
Get application command line parameters.
Definition: application.h:68
void setPath(const QString &path)
Set application path.
Definition: application.h:84
void setName(const QString &name)
Set application name.
Definition: application.h:76
void setParameters(const QString &parameters)
Set application command line parameters.
Definition: application.h:92
const QString & getPath() const
Get application path.
Definition: application.h:60
const QString & getName() const
Get application name.
Definition: application.h:52
QString mName
Application's name.
Definition: application.h:101
QString mParameters
Application's parameters.
Definition: application.h:111
QString mPath
Application's path.
Definition: application.h:106