File indexing completed on 2024-04-21 04:35:59

0001 /* This file is part of KDevelop
0002    Copyright 2017 Anton Anikin <anton@anikin.xyz>
0003 
0004    This program is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU General Public
0006    License as published by the Free Software Foundation; either
0007    version 2 of the License, or (at your option) any later version.
0008 
0009    This program is distributed in the hope that it will be useful,
0010    but WITHOUT ANY WARRANTY; without even the implied warranty of
0011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0012    General Public License for more details.
0013 
0014    You should have received a copy of the GNU General Public License
0015    along with this program; see the file COPYING. If not, write to
0016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017    Boston, MA 02110-1301, USA.
0018 */
0019 
0020 #pragma once
0021 
0022 #include <QString>
0023 
0024 namespace KDevelop
0025 {
0026 
0027 class ILauncher;
0028 class ILaunchConfiguration;
0029 class LaunchConfigurationPageFactory;
0030 
0031 }
0032 
0033 namespace Valgrind
0034 {
0035 
0036 class Job;
0037 
0038 class Tool
0039 {
0040 public:
0041     virtual ~Tool() = default;
0042 
0043     /// Short name, used in UI.
0044     /// Example: i18n("Memcheck").
0045     QString name() const;
0046 
0047     /// Full name, used in UI (description).
0048     /// Example: i18n("Memcheck: a memory error detector").
0049     QString fullName() const;
0050 
0051     /// Internal Valgrind tool name, used in jobs.
0052     /// Example: "memcheck".
0053     QString valgrindToolName() const;
0054 
0055     /// Internal id, used as id for launcher and config group name.
0056     /// Example: "Memcheck".
0057     QString id() const;
0058 
0059     /// "Analyze" menu action name, used when tool action added to action collection.
0060     /// Example: "memcheck_tool".
0061     QString menuActionName() const;
0062 
0063     /// True if tool has view
0064     bool hasView() const;
0065 
0066     KDevelop::ILauncher* createLauncher() const;
0067 
0068     virtual Job* createJob(KDevelop::ILaunchConfiguration* launchConfig) const = 0;
0069 
0070     virtual KDevelop::LaunchConfigurationPageFactory* createConfigPageFactory() const = 0;
0071 
0072 protected:
0073     Tool(
0074         const QString& id,
0075         const QString& name,
0076         const QString& fullName,
0077         const QString& valgrindToolName,
0078         const QString& menuActionName,
0079         bool hasView
0080     );
0081 
0082 private:
0083     QString m_id;
0084     QString m_name;
0085     QString m_fullName;
0086     QString m_valgrindToolName;
0087     QString m_menuActionName;
0088     bool m_hasView;
0089 };
0090 
0091 }