Cppcheck
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Static Private Member Functions | Private Attributes
ErrorLogger::ErrorMessage Class Reference

Wrapper for error messages, provided by reportErr() More...

#include <errorlogger.h>

List of all members.

Classes

class  FileLocation
 File name and line number. More...

Public Member Functions

 ErrorMessage (const std::list< FileLocation > &callStack, Severity::SeverityType severity, const std::string &msg, const std::string &id, bool inconclusive)
 ErrorMessage (const std::list< const Token * > &callstack, const TokenList *list, Severity::SeverityType severity, const std::string &id, const std::string &msg, bool inconclusive)
 ErrorMessage ()
std::string toXML (bool verbose, int ver) const
 Format the error message in XML format.
std::string toString (bool verbose, const std::string &outputFormat="") const
 Format the error message into a string.
std::string serialize () const
bool deserialize (const std::string &data)
void setmsg (const std::string &msg)
 set short and verbose messages
const std::string & shortMessage () const
 Short message (single line short message)
const std::string & verboseMessage () const
 Verbose message (may be the same as the short message)

Static Public Member Functions

static std::string getXMLHeader (int xml_version)
static std::string getXMLFooter (int xml_version)

Public Attributes

std::list< FileLocation_callStack
std::string _id
std::string file0
 source file (not header)
Severity::SeverityType _severity
bool _inconclusive

Static Private Member Functions

static void findAndReplace (std::string &source, const std::string &searchFor, const std::string &replaceWith)
 Replace all occurrences of searchFor with replaceWith in the given source.

Private Attributes

std::string _shortMessage
 Short message.
std::string _verboseMessage
 Verbose message.

Detailed Description

Wrapper for error messages, provided by reportErr()

Definition at line 154 of file errorlogger.h.


Constructor & Destructor Documentation

ErrorLogger::ErrorMessage::ErrorMessage ( const std::list< FileLocation > &  callStack,
Severity::SeverityType  severity,
const std::string &  msg,
const std::string &  id,
bool  inconclusive 
)

Definition at line 38 of file errorlogger.cpp.

References setmsg().

ErrorLogger::ErrorMessage::ErrorMessage ( const std::list< const Token * > &  callstack,
const TokenList list,
Severity::SeverityType  severity,
const std::string &  id,
const std::string &  msg,
bool  inconclusive 
)

Definition at line 48 of file errorlogger.cpp.

References _callStack, file0, TokenList::getFiles(), and setmsg().

Definition at line 33 of file errorlogger.cpp.


Member Function Documentation

bool ErrorLogger::ErrorMessage::deserialize ( const std::string &  data)
void ErrorLogger::ErrorMessage::findAndReplace ( std::string &  source,
const std::string &  searchFor,
const std::string &  replaceWith 
) [static, private]

Replace all occurrences of searchFor with replaceWith in the given source.

Parameters:
sourceThe string to modify
searchForWhat should be searched for
replaceWithWhat will replace the found item

Definition at line 270 of file errorlogger.cpp.

std::string ErrorLogger::ErrorMessage::getXMLFooter ( int  xml_version) [static]

Definition at line 198 of file errorlogger.cpp.

Referenced by CppCheckExecutor::check(), and CppCheckExecutor::parseFromArgs().

std::string ErrorLogger::ErrorMessage::getXMLHeader ( int  xml_version) [static]

Definition at line 175 of file errorlogger.cpp.

References CppCheck::version().

Referenced by CppCheckExecutor::check(), and CppCheckExecutor::parseFromArgs().

std::string ErrorLogger::ErrorMessage::serialize ( ) const

Definition at line 88 of file errorlogger.cpp.

References Severity::toString().

void ErrorLogger::ErrorMessage::setmsg ( const std::string &  msg)

set short and verbose messages

Definition at line 66 of file errorlogger.cpp.

Referenced by ErrorMessage(), and Preprocessor::getcfgs().

const std::string& ErrorLogger::ErrorMessage::shortMessage ( ) const [inline]

Short message (single line short message)

Definition at line 235 of file errorlogger.h.

Referenced by ThreadResult::reportErr().

std::string ErrorLogger::ErrorMessage::toString ( bool  verbose,
const std::string &  outputFormat = "" 
) const

Format the error message into a string.

Parameters:
verboseuse verbose message
outputFormatEmpty string to use default output format or template to be used. E.g. "{file}:{line},{severity},{id},{message}"

Definition at line 279 of file errorlogger.cpp.

References ErrorLogger::callStackToString(), Severity::none, and Severity::toString().

Referenced by CppCheckExecutor::reportErr(), and CppCheck::reportErr().

std::string ErrorLogger::ErrorMessage::toXML ( bool  verbose,
int  ver 
) const

Format the error message in XML format.

Parameters:
verboseuse verbose message
verXML version

Definition at line 224 of file errorlogger.cpp.

References Severity::error, stringToXml(), and Severity::toString().

Referenced by CppCheckExecutor::reportErr(), and Check::reportError().

const std::string& ErrorLogger::ErrorMessage::verboseMessage ( ) const [inline]

Verbose message (may be the same as the short message)

Definition at line 240 of file errorlogger.h.

Referenced by ThreadResult::reportErr().


Member Data Documentation

Definition at line 229 of file errorlogger.h.

Referenced by ThreadResult::reportErr().

Definition at line 228 of file errorlogger.h.

Referenced by Preprocessor::getcfgs(), and ThreadResult::reportErr().

Short message.

Definition at line 255 of file errorlogger.h.

Verbose message.

Definition at line 258 of file errorlogger.h.

source file (not header)

Definition at line 226 of file errorlogger.h.

Referenced by ErrorMessage(), Preprocessor::missingInclude(), and ThreadResult::reportErr().


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