Cppcheck
threadexecutor.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 THREADEXECUTOR_H
20 #define THREADEXECUTOR_H
21 
22 #include "cppcheck.h"
23 #include "executor.h"
24 
25 #include <cstddef>
26 #include <list>
27 #include <string>
28 #include <utility>
29 
30 class Settings;
31 class ErrorLogger;
32 class SuppressionList;
33 struct FileSettings;
34 class FileWithDetails;
35 
36 /// @addtogroup CLI
37 /// @{
38 
39 /**
40  * This class will take a list of filenames and settings and check then
41  * all files using threads.
42  */
43 class ThreadExecutor : public Executor {
44  friend class SyncLogForwarder;
45 
46 public:
47  ThreadExecutor(const std::list<FileWithDetails> &files, const std::list<FileSettings>& fileSettings, const Settings &settings, SuppressionList &suppressions, ErrorLogger &errorLogger, CppCheck::ExecuteCmdFn executeCommand);
48  ThreadExecutor(const ThreadExecutor &) = delete;
50 
51  unsigned int check() override;
52 
54 };
55 
56 /// @}
57 
58 #endif // THREADEXECUTOR_H
std::function< int(std::string, std::vector< std::string >, std::string, std::string &)> ExecuteCmdFn
Definition: cppcheck.h:62
This is an interface, which the class responsible of error logging should implement.
Definition: errorlogger.h:214
This class will take a list of filenames and settings and check then all files using threads.
Definition: executor.h:43
This is just a container for general settings so that we don't need to pass individual values to func...
Definition: settings.h:95
class for handling suppressions
Definition: suppressions.h:42
This class will take a list of filenames and settings and check then all files using threads.
unsigned int check() override
CppCheck::ExecuteCmdFn mExecuteCommand
ThreadExecutor(const ThreadExecutor &)=delete
ThreadExecutor(const std::list< FileWithDetails > &files, const std::list< FileSettings > &fileSettings, const Settings &settings, SuppressionList &suppressions, ErrorLogger &errorLogger, CppCheck::ExecuteCmdFn executeCommand)
ThreadExecutor & operator=(const ThreadExecutor &)=delete
File settings.
Definition: filesettings.h:57