Cppcheck
Public Slots | Signals | Public Member Functions | Protected Attributes | List of all members
ThreadResult Class Reference

Threads use this class to obtain new files to process and to publish results. More...

#include <threadresult.h>

Inheritance diagram for ThreadResult:
ErrorLogger

Public Slots

void fileChecked (const QString &file)
 Slot threads use to signal this class that a specific file is checked. More...
 

Signals

void progress (int value, const QString &description)
 Progress signal. More...
 
void error (const ErrorItem &item)
 Signal of a new error. More...
 
void log (const QString &logline)
 Signal of a new log message. More...
 
void debugError (const ErrorItem &item)
 Signal of a debug error. More...
 

Public Member Functions

 ThreadResult ()=default
 
QString getNextFile ()
 Get next unprocessed file. More...
 
FileSettings getNextFileSettings ()
 
void setFiles (const QStringList &files)
 Set list of files to check. More...
 
void setProject (const ImportProject &prj)
 
void clearFiles ()
 Clear files to check. More...
 
int getFileCount () const
 Get the number of files to check. More...
 
void reportOut (const std::string &outmsg, Color c=Color::Reset) override
 ErrorLogger methods. More...
 
void reportErr (const ErrorMessage &msg) override
 Information about found errors and warnings is directed here. More...
 
- Public Member Functions inherited from ErrorLogger
 ErrorLogger ()=default
 
virtual ~ErrorLogger ()=default
 
virtual void reportProgress (const std::string &filename, const char stage[], const std::size_t value)
 Report progress to client. More...
 

Protected Attributes

std::mutex mutex
 Mutex. More...
 
QStringList mFiles
 List of files to check. More...
 
std::list< FileSettingsmFileSettings
 
quint64 mMaxProgress {}
 Max progress. More...
 
quint64 mProgress {}
 Current progress. More...
 
unsigned long mFilesChecked {}
 Current number of files checked. More...
 
unsigned long mTotalFiles {}
 Total number of files. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ErrorLogger
static std::string callStackToString (const std::list< ErrorMessage::FileLocation > &callStack)
 
static std::string toxml (const std::string &str)
 Convert XML-sensitive characters into XML entities. More...
 
static std::string plistHeader (const std::string &version, const std::vector< std::string > &files)
 
static std::string plistData (const ErrorMessage &msg)
 
static const char * plistFooter ()
 
static bool isCriticalErrorId (const std::string &id)
 

Detailed Description

Threads use this class to obtain new files to process and to publish results.

Definition at line 46 of file threadresult.h.

Constructor & Destructor Documentation

◆ ThreadResult()

ThreadResult::ThreadResult ( )
default

Member Function Documentation

◆ clearFiles()

void ThreadResult::clearFiles ( )

Clear files to check.

Definition at line 114 of file threadresult.cpp.

References mFiles, mFilesChecked, mFileSettings, mTotalFiles, and mutex.

Referenced by ThreadHandler::clearFiles().

◆ debugError

void ThreadResult::debugError ( const ErrorItem item)
signal

Signal of a debug error.

Parameters
itemError data

Referenced by ThreadHandler::initialize(), and reportErr().

◆ error

void ThreadResult::error ( const ErrorItem item)
signal

Signal of a new error.

Parameters
itemError data

Referenced by ThreadHandler::initialize(), and reportErr().

◆ fileChecked

void ThreadResult::fileChecked ( const QString &  file)
slot

Slot threads use to signal this class that a specific file is checked.

Parameters
fileFile that is checked

Definition at line 36 of file threadresult.cpp.

References mFilesChecked, mMaxProgress, mProgress, mTotalFiles, mutex, progress(), and PROGRESS_MAX.

Referenced by ThreadHandler::removeThreads(), and ThreadHandler::setThreadCount().

◆ getFileCount()

int ThreadResult::getFileCount ( ) const

Get the number of files to check.

Definition at line 123 of file threadresult.cpp.

References mFiles, mFileSettings, and mutex.

Referenced by ThreadHandler::check().

◆ getNextFile()

QString ThreadResult::getNextFile ( )

Get next unprocessed file.

Returns
File path

Definition at line 61 of file threadresult.cpp.

References mFiles, and mutex.

◆ getNextFileSettings()

FileSettings ThreadResult::getNextFileSettings ( )

Definition at line 71 of file threadresult.cpp.

References mFileSettings, and mutex.

◆ log

void ThreadResult::log ( const QString &  logline)
signal

Signal of a new log message.

Parameters
loglineLog line

Referenced by ThreadHandler::initialize(), and reportOut().

◆ progress

void ThreadResult::progress ( int  value,
const QString &  description 
)
signal

Progress signal.

Parameters
valueCurrent progress
descriptionDescription of the current stage

Referenced by fileChecked(), and ThreadHandler::initialize().

◆ reportErr()

void ThreadResult::reportErr ( const ErrorMessage msg)
overridevirtual

Information about found errors and warnings is directed here.

Override this to receive the errormessages.

Parameters
msgLocation and other information about the found error.

Implements ErrorLogger.

Definition at line 51 of file threadresult.cpp.

References debug, debugError(), error(), mutex, and ErrorMessage::severity.

Referenced by CheckThread::parseClangErrors().

◆ reportOut()

void ThreadResult::reportOut ( const std::string &  outmsg,
Color  c = Color::Reset 
)
overridevirtual

ErrorLogger methods.

Implements ErrorLogger.

Definition at line 31 of file threadresult.cpp.

References log().

◆ setFiles()

void ThreadResult::setFiles ( const QStringList &  files)

Set list of files to check.

Parameters
filesList of files to check

Definition at line 82 of file threadresult.cpp.

References mFiles, mFilesChecked, mMaxProgress, mProgress, mTotalFiles, and mutex.

Referenced by MainWindow::analyzeCode(), ThreadHandler::setCheckFiles(), and ThreadHandler::setFiles().

◆ setProject()

void ThreadResult::setProject ( const ImportProject prj)

Member Data Documentation

◆ mFiles

QStringList ThreadResult::mFiles
protected

List of files to check.

Definition at line 137 of file threadresult.h.

Referenced by clearFiles(), getFileCount(), getNextFile(), setFiles(), and setProject().

◆ mFilesChecked

unsigned long ThreadResult::mFilesChecked {}
protected

Current number of files checked.

Definition at line 157 of file threadresult.h.

Referenced by clearFiles(), fileChecked(), setFiles(), and setProject().

◆ mFileSettings

std::list<FileSettings> ThreadResult::mFileSettings
protected

Definition at line 139 of file threadresult.h.

Referenced by clearFiles(), getFileCount(), getNextFileSettings(), and setProject().

◆ mMaxProgress

quint64 ThreadResult::mMaxProgress {}
protected

Max progress.

Definition at line 145 of file threadresult.h.

Referenced by fileChecked(), setFiles(), and setProject().

◆ mProgress

quint64 ThreadResult::mProgress {}
protected

Current progress.

Definition at line 151 of file threadresult.h.

Referenced by fileChecked(), setFiles(), and setProject().

◆ mTotalFiles

unsigned long ThreadResult::mTotalFiles {}
protected

Total number of files.

Definition at line 163 of file threadresult.h.

Referenced by clearFiles(), fileChecked(), setFiles(), and setProject().

◆ mutex

std::mutex ThreadResult::mutex
mutableprotected

The documentation for this class was generated from the following files: