本文整理汇总了C++中errorlogger::ErrorMessage类的典型用法代码示例。如果您正苦于以下问题:C++ ErrorMessage类的具体用法?C++ ErrorMessage怎么用?C++ ErrorMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ErrorMessage类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: reportErr
void ThreadResult::reportErr(const ErrorLogger::ErrorMessage &msg)
{
QMutexLocker locker(&mutex);
QList<unsigned int> lines;
QStringList files;
for (std::list<ErrorLogger::ErrorMessage::FileLocation>::const_iterator tok = msg._callStack.begin();
tok != msg._callStack.end();
++tok)
{
files << QString((*tok).getfile(false).c_str());
lines << (*tok).line;
}
ErrorItem item;
item.file = QString(callStackToString(msg._callStack).c_str());
item.files = files;
item.id = QString(msg._id.c_str());
item.lines = lines;
item.summary = QString::fromStdString(msg.shortMessage());
item.message = QString::fromStdString(msg.verboseMessage());
item.severity = msg._severity;
item.inconclusive = msg._inconclusive;
if (msg._severity != Severity::debug)
emit Error(item);
else
emit DebugError(item);
}
开发者ID:zblair,项目名称:cppcheck,代码行数:30,代码来源:threadresult.cpp
示例2: xml
void xml()
{
// Test the errorlogger..
ErrorLogger::ErrorMessage errmsg;
errmsg._msg = "ab<cd>ef";
ASSERT_EQUALS("<error id=\"\" severity=\"\" msg=\"ab<cd>ef\"/>", errmsg.toXML());
}
开发者ID:gscacco,项目名称:cppcheck,代码行数:7,代码来源:testcppcheck.cpp
示例3: handleRead
int ThreadExecutor::handleRead(int rpipe, unsigned int &result)
{
char type = 0;
if (read(rpipe, &type, 1) <= 0) {
if (errno == EAGAIN)
return 0;
return -1;
}
if (type != REPORT_OUT && type != REPORT_ERROR && type != REPORT_INFO && type != CHILD_END) {
std::cerr << "#### You found a bug from cppcheck.\nThreadExecutor::handleRead error, type was:" << type << std::endl;
exit(0);
}
unsigned int len = 0;
if (read(rpipe, &len, sizeof(len)) <= 0) {
std::cerr << "#### You found a bug from cppcheck.\nThreadExecutor::handleRead error, type was:" << type << std::endl;
exit(0);
}
char *buf = new char[len];
if (read(rpipe, buf, len) <= 0) {
std::cerr << "#### You found a bug from cppcheck.\nThreadExecutor::handleRead error, type was:" << type << std::endl;
exit(0);
}
if (type == REPORT_OUT) {
_errorLogger.reportOut(buf);
} else if (type == REPORT_ERROR || type == REPORT_INFO) {
ErrorLogger::ErrorMessage msg;
msg.deserialize(buf);
std::string file;
unsigned int line(0);
if (!msg._callStack.empty()) {
file = msg._callStack.back().getfile(false);
line = msg._callStack.back().line;
}
if (!_settings.nomsg.isSuppressed(msg._id, file, line)) {
// Alert only about unique errors
std::string errmsg = msg.toString(_settings._verbose);
if (std::find(_errorList.begin(), _errorList.end(), errmsg) == _errorList.end()) {
_errorList.push_back(errmsg);
if (type == REPORT_ERROR)
_errorLogger.reportErr(msg);
else
_errorLogger.reportInfo(msg);
}
}
} else if (type == CHILD_END) {
std::istringstream iss(buf);
unsigned int fileResult = 0;
iss >> fileResult;
result += fileResult;
delete [] buf;
return -1;
}
开发者ID:kasumar,项目名称:TscanCode,代码行数:59,代码来源:threadexecutor.cpp
示例4: include
void include()
{
ErrorLogger::ErrorMessage errmsg;
ErrorLogger::ErrorMessage::FileLocation loc;
loc.file = "ab/cd/../ef.h";
errmsg._callStack.push_back(loc);
ASSERT_EQUALS("<error file=\"ab/ef.h\" line=\"0\" id=\"\" severity=\"\" msg=\"\"/>", errmsg.toXML());
ASSERT_EQUALS("[ab/ef.h:0]: ", errmsg.toText());
}
开发者ID:gscacco,项目名称:cppcheck,代码行数:9,代码来源:testcppcheck.cpp
示例5: reportErr
void CppCheckExecutor::reportErr(const ErrorLogger::ErrorMessage &msg)
{
if (errorlist) {
reportOut(msg.toXML(false, _settings->_xml_version));
} else if (_settings->_xml) {
reportErr(msg.toXML(_settings->_verbose, _settings->_xml_version));
} else {
reportErr(msg.toString(_settings->_verbose, _settings->_outputFormat));
}
}
开发者ID:bnagesh,项目名称:cppcheck,代码行数:10,代码来源:cppcheckexecutor.cpp
示例6: reportErr
void CppCheckExecutor::reportErr(const ErrorLogger::ErrorMessage &msg)
{
if (_settings._xml)
{
reportErr(msg.toXML());
}
else
{
reportErr(msg.toText());
}
}
开发者ID:gscacco,项目名称:cppcheck,代码行数:11,代码来源:cppcheckexecutor.cpp
示例7: handleRead
bool ThreadExecutor::handleRead(unsigned int &result)
{
char type = 0;
if (read(_pipe[0], &type, 1) <= 0)
{
return false;
}
if (type != '1' && type != '2' && type != '3')
{
std::cerr << "#### You found a bug from cppcheck.\nThreadExecutor::handleRead error, type was:" << type << std::endl;
exit(0);
}
unsigned int len = 0;
if (read(_pipe[0], &len, sizeof(len)) <= 0)
{
std::cerr << "#### You found a bug from cppcheck.\nThreadExecutor::handleRead error, type was:" << type << std::endl;
exit(0);
}
char *buf = new char[len];
if (read(_pipe[0], buf, len) <= 0)
{
std::cerr << "#### You found a bug from cppcheck.\nThreadExecutor::handleRead error, type was:" << type << std::endl;
exit(0);
}
if (type == '1')
{
_errorLogger.reportOut(buf);
}
else if (type == '2')
{
ErrorLogger::ErrorMessage msg;
msg.deserialize(buf);
// Alert only about unique errors
std::string errmsg = msg.toText();
if (std::find(_errorList.begin(), _errorList.end(), errmsg) == _errorList.end())
{
_errorList.push_back(errmsg);
_errorLogger.reportErr(msg);
}
}
else if (type == '3')
{
_fileCount++;
std::istringstream iss(buf);
unsigned int fileResult = 0;
iss >> fileResult;
result += fileResult;
_errorLogger.reportStatus(_fileCount, _filenames.size());
}
开发者ID:RVictor,项目名称:EmbeddedLite,代码行数:54,代码来源:threadexecutor.cpp
示例8: TestPatternSearchReplace
void TestPatternSearchReplace(const std::string& idPlaceholder, const std::string& id) const {
const std::string plainText = "text";
ErrorLogger::ErrorMessage message;
message._id = id;
std::string serialized = message.toString(true, idPlaceholder + plainText + idPlaceholder);
ASSERT_EQUALS(id + plainText + id, serialized);
serialized = message.toString(true, idPlaceholder + idPlaceholder);
ASSERT_EQUALS(id + id, serialized);
serialized = message.toString(true, plainText + idPlaceholder + plainText);
ASSERT_EQUALS(plainText + id + plainText, serialized);
}
开发者ID:matthiaskrgr,项目名称:cppcheck,代码行数:15,代码来源:testerrorlogger.cpp
示例9: errorId
ErrorItem::ErrorItem(const ErrorLogger::ErrorMessage &errmsg)
: errorId(QString::fromStdString(errmsg._id))
, severity(errmsg._severity)
, inconclusive(errmsg._inconclusive)
, summary(QString::fromStdString(errmsg.shortMessage()))
, message(QString::fromStdString(errmsg.verboseMessage()))
, cwe(errmsg._cwe.id)
, symbolNames(QString::fromStdString(errmsg.symbolNames()))
{
for (std::list<ErrorLogger::ErrorMessage::FileLocation>::const_iterator loc = errmsg._callStack.begin();
loc != errmsg._callStack.end();
++loc) {
errorPath << QErrorPathItem(*loc);
}
}
开发者ID:imasaaki,项目名称:cppcheck,代码行数:15,代码来源:erroritem.cpp
示例10: reportErr
void CppCheck::reportErr(const ErrorLogger::ErrorMessage &msg)
{
if (!_settings.library.reportErrors(msg.file0))
return;
const std::string errmsg = msg.toString(_settings.verbose);
if (errmsg.empty())
return;
// Alert only about unique errors
if (std::find(_errorList.begin(), _errorList.end(), errmsg) != _errorList.end())
return;
std::string file;
unsigned int line(0);
if (!msg._callStack.empty()) {
file = msg._callStack.back().getfile(false);
line = msg._callStack.back().line;
}
if (_useGlobalSuppressions) {
if (_settings.nomsg.isSuppressed(msg._id, file, line))
return;
} else {
if (_settings.nomsg.isSuppressedLocal(msg._id, file, line))
return;
}
if (!_settings.nofail.isSuppressed(msg._id, file, line))
exitcode = 1;
_errorList.push_back(errmsg);
_errorLogger.reportErr(msg);
}
开发者ID:HeisSpiter,项目名称:cppcheck,代码行数:35,代码来源:cppcheck.cpp
示例11: reportErr
void CppCheck::reportErr(const ErrorLogger::ErrorMessage &msg)
{
mSuppressInternalErrorFound = false;
if (!mSettings.library.reportErrors(msg.file0))
return;
const std::string errmsg = msg.toString(mSettings.verbose);
if (errmsg.empty())
return;
// Alert only about unique errors
if (std::find(mErrorList.begin(), mErrorList.end(), errmsg) != mErrorList.end())
return;
const Suppressions::ErrorMessage errorMessage = msg.toSuppressionsErrorMessage();
if (mUseGlobalSuppressions) {
if (mSettings.nomsg.isSuppressed(errorMessage)) {
mSuppressInternalErrorFound = true;
return;
}
} else {
if (mSettings.nomsg.isSuppressedLocal(errorMessage)) {
mSuppressInternalErrorFound = true;
return;
}
}
if (!mSettings.nofail.isSuppressed(errorMessage) && (mUseGlobalSuppressions || !mSettings.nomsg.isSuppressed(errorMessage)))
mExitCode = 1;
mErrorList.push_back(errmsg);
mErrorLogger.reportErr(msg);
mAnalyzerInformation.reportErr(msg, mSettings.verbose);
if (!mSettings.plistOutput.empty() && plistFile.is_open()) {
plistFile << ErrorLogger::plistData(msg);
}
}
开发者ID:eranif,项目名称:codelite,代码行数:40,代码来源:cppcheck.cpp
示例12: reportErr
void CppCheck::reportErr(const ErrorLogger::ErrorMessage &msg)
{
const std::string errmsg = msg.toString(_settings._verbose);
if (errmsg.empty())
return;
if (_settings.debugFalsePositive) {
// Don't print out error
_errorList.push_back(errmsg);
return;
}
// Alert only about unique errors
if (std::find(_errorList.begin(), _errorList.end(), errmsg) != _errorList.end())
return;
std::string file;
unsigned int line(0);
if (!msg._callStack.empty()) {
file = msg._callStack.back().getfile(false);
line = msg._callStack.back().line;
}
if (_useGlobalSuppressions) {
if (_settings.nomsg.isSuppressed(msg._id, file, line))
return;
} else {
if (_settings.nomsg.isSuppressedLocal(msg._id, file, line))
return;
}
if (!_settings.nofail.isSuppressed(msg._id, file, line))
exitcode = 1;
_errorList.push_back(errmsg);
std::string errmsg2(errmsg);
if (_settings._verbose) {
errmsg2 += "\n Defines=\'" + cfg + "\'\n";
}
_errorLogger.reportErr(msg);
_errout << errmsg2 << std::endl;
}
开发者ID:Drahakar,项目名称:cppcheck,代码行数:44,代码来源:cppcheck.cpp
示例13: report
void TscThreadExecutor::report(const ErrorLogger::ErrorMessage &msg, MessageType msgType)
{
std::string file;
unsigned int line(0);
if (!msg._callStack.empty()) {
file = msg._callStack.back().getfile(false);
line = msg._callStack.back().line;
}
if (_settings.nomsg.isSuppressed(msg._id, file, line))
return;
// Alert only about unique errors
bool reportError = false;
std::string errmsg = msg.toString(_settings._verbose);
TSC_LOCK_ENTER(&_errorSync);
if (std::find(_errorList.begin(), _errorList.end(), errmsg) == _errorList.end()) {
_errorList.push_back(errmsg);
reportError = true;
}
TSC_LOCK_LEAVE(&_errorSync);
if (reportError) {
TSC_LOCK_ENTER(&_reportSync);
switch (msgType) {
case REPORT_ERROR:
_errorLogger.reportErr(msg);
break;
case REPORT_INFO:
_errorLogger.reportInfo(msg);
break;
}
TSC_LOCK_LEAVE(&_reportSync);
}
}
开发者ID:hxofgithub,项目名称:TscanCode,代码行数:38,代码来源:tscthreadexecutor.cpp
示例14: reportErr
void TestFixture::reportErr(const ErrorLogger::ErrorMessage &msg)
{
errout << msg.toText() << std::endl;
}
开发者ID:gscacco,项目名称:cppcheck,代码行数:4,代码来源:testsuite.cpp
示例15: reportError
void Check::reportError(const ErrorLogger::ErrorMessage &errmsg)
{
std::cout << errmsg.toXML(true, 1) << std::endl;
}
开发者ID:lasergnu,项目名称:cppcheck,代码行数:4,代码来源:check.cpp
示例16: reportErr
void reportErr(const ErrorLogger::ErrorMessage &msg)
{
const std::string str(msg.toXML(true,2U));
printf("%s\n", str.c_str());
}
开发者ID:kimmov,项目名称:cppcheck,代码行数:5,代码来源:democlient.cpp
示例17: reportInfo
void CppCheck::reportInfo(const ErrorLogger::ErrorMessage &msg)
{
const Suppressions::ErrorMessage &errorMessage = msg.toSuppressionsErrorMessage();
if (!mSettings.nomsg.isSuppressed(errorMessage))
mErrorLogger.reportInfo(msg);
}
开发者ID:eranif,项目名称:codelite,代码行数:6,代码来源:cppcheck.cpp
示例18: reportErr
void AnalyzerInformation::reportErr(const ErrorLogger::ErrorMessage &msg, bool verbose)
{
if (fout.is_open())
fout << msg.toXML(verbose,2) << '\n';
}
开发者ID:JIghtuse,项目名称:cppcheck,代码行数:5,代码来源:analyzerinfo.cpp
示例19: reportErr
void TestFixture::reportErr(const ErrorLogger::ErrorMessage &msg)
{
const std::string errormessage(msg.toString(false));
if (errout.str().find(errormessage) == std::string::npos)
errout << errormessage << std::endl;
}
开发者ID:NightOfTwelve,项目名称:cppcheck,代码行数:6,代码来源:testsuite.cpp
注:本文中的errorlogger::ErrorMessage类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论