Cppcheck
Public Member Functions | Static Public Member Functions | Static Private Attributes | List of all members
ErrorLogger Class Referenceabstract

This is an interface, which the class responsible of error logging should implement. More...

#include <errorlogger.h>

Inheritance diagram for ErrorLogger:
CppCheck SyncLogForwarder ThreadResult

Public Member Functions

 ErrorLogger ()=default
 
virtual ~ErrorLogger ()=default
 
virtual void reportOut (const std::string &outmsg, Color c=Color::Reset)=0
 Information about progress is directed here. More...
 
virtual void reportErr (const ErrorMessage &msg)=0
 Information about found errors and warnings is directed here. More...
 
virtual void reportProgress (const std::string &filename, const char stage[], const std::size_t value)
 Report progress to client. More...
 

Static Public Member Functions

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)
 

Static Private Attributes

static const std::set< std::string > mCriticalErrorIds
 

Detailed Description

This is an interface, which the class responsible of error logging should implement.

Definition at line 217 of file errorlogger.h.

Constructor & Destructor Documentation

◆ ErrorLogger()

ErrorLogger::ErrorLogger ( )
default

◆ ~ErrorLogger()

virtual ErrorLogger::~ErrorLogger ( )
virtualdefault

Member Function Documentation

◆ callStackToString()

std::string ErrorLogger::callStackToString ( const std::list< ErrorMessage::FileLocation > &  callStack)
static

Definition at line 711 of file errorlogger.cpp.

Referenced by ErrorMessage::toString().

◆ isCriticalErrorId()

static bool ErrorLogger::isCriticalErrorId ( const std::string &  id)
inlinestatic

◆ plistData()

std::string ErrorLogger::plistData ( const ErrorMessage msg)
static

◆ plistFooter()

static const char* ErrorLogger::plistFooter ( )
inlinestatic

Definition at line 261 of file errorlogger.h.

Referenced by CppCheck::checkFile(), and CppCheck::~CppCheck().

◆ plistHeader()

std::string ErrorLogger::plistHeader ( const std::string &  version,
const std::vector< std::string > &  files 
)
static

Definition at line 797 of file errorlogger.cpp.

References toxml().

Referenced by CppCheck::checkFile().

◆ reportErr()

virtual void ErrorLogger::reportErr ( const ErrorMessage msg)
pure virtual

◆ reportOut()

virtual void ErrorLogger::reportOut ( const std::string &  outmsg,
Color  c = Color::Reset 
)
pure virtual

Information about progress is directed here.

Override this to receive the progress messages.

Parameters
outmsgMessage to show e.g. "Checking main.cpp..."

Implemented in CppCheck, ThreadResult, and SyncLogForwarder.

Referenced by CppCheck::checkClang(), CppCheck::checkFile(), ProcessExecutor::handleRead(), SyncLogForwarder::reportOut(), CppCheck::reportOut(), and Executor::reportStatus().

◆ reportProgress()

virtual void ErrorLogger::reportProgress ( const std::string &  filename,
const char  stage[],
const std::size_t  value 
)
inlinevirtual

Report progress to client.

Parameters
filenamemain file that is checked
stagefor example preprocess / tokenize / simplify / check
valueprogress value (0-100)

Reimplemented in CppCheck.

Definition at line 244 of file errorlogger.h.

Referenced by SymbolDatabase::createSymbolDatabaseFindAllScopes(), CppCheck::reportProgress(), TemplateSimplifier::simplifyTemplateInstantiations(), Tokenizer::simplifyTypedefCpp(), and Tokenizer::simplifyUsing().

◆ toxml()

std::string ErrorLogger::toxml ( const std::string &  str)
static

Member Data Documentation

◆ mCriticalErrorIds

const std::set< std::string > ErrorLogger::mCriticalErrorIds
staticprivate
Initial value:
{
"cppcheckError",
"cppcheckLimit",
"internalAstError",
"instantiationError",
"internalError",
"misra-config",
"premium-internalError",
"premium-invalidArgument",
"premium-invalidLicense",
"preprocessorErrorDirective",
"syntaxError",
"unknownMacro"
}

Definition at line 272 of file errorlogger.h.


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