本文整理汇总了C++中errorlogger::errormessage::FileLocation::getfile方法的典型用法代码示例。如果您正苦于以下问题:C++ FileLocation::getfile方法的具体用法?C++ FileLocation::getfile怎么用?C++ FileLocation::getfile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类errorlogger::errormessage::FileLocation
的用法示例。
在下文中一共展示了FileLocation::getfile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: file
QErrorPathItem::QErrorPathItem(const ErrorLogger::ErrorMessage::FileLocation &loc)
: file(QString::fromStdString(loc.getfile(false)))
, line(loc.line)
, col(loc.col)
, info(QString::fromStdString(loc.getinfo()))
{
}
示例2: FileLocationSetFile
void FileLocationSetFile()
{
ErrorLogger::ErrorMessage::FileLocation loc;
loc.setfile("foo.cpp");
ASSERT_EQUALS("foo.cpp", loc.getfile());
ASSERT_EQUALS(0, loc.line);
}
示例3: checkFile
//.........这里部分代码省略.........
// Analyze info..
if (!mSettings.buildDir.empty())
checkUnusedFunctions.parseTokens(mTokenizer, filename.c_str(), &mSettings);
// simplify more if required, skip rest of iteration if failed
if (mSimplify) {
// if further simplification fails then skip rest of iteration
Timer timer3("Tokenizer::simplifyTokenList2", mSettings.showtime, &S_timerResults);
result = mTokenizer.simplifyTokenList2();
timer3.Stop();
if (!result)
continue;
// Check simplified tokens
checkSimplifiedTokens(mTokenizer);
}
} catch (const simplecpp::Output &o) {
// #error etc during preprocessing
configurationError.push_back((mCurrentConfig.empty() ? "\'\'" : mCurrentConfig) + " : [" + o.location.file() + ':' + MathLib::toString(o.location.line) + "] " + o.msg);
--checkCount; // don't count invalid configurations
continue;
} catch (const InternalError &e) {
std::list<ErrorLogger::ErrorMessage::FileLocation> locationList;
ErrorLogger::ErrorMessage::FileLocation loc;
if (e.token) {
loc.line = e.token->linenr();
const std::string fixedpath = Path::toNativeSeparators(mTokenizer.list.file(e.token));
loc.setfile(fixedpath);
} else {
ErrorLogger::ErrorMessage::FileLocation loc2;
loc2.setfile(Path::toNativeSeparators(filename));
locationList.push_back(loc2);
loc.setfile(mTokenizer.list.getSourceFilePath());
}
locationList.push_back(loc);
ErrorLogger::ErrorMessage errmsg(locationList,
mTokenizer.list.getSourceFilePath(),
Severity::error,
e.errorMessage,
e.id,
false);
reportErr(errmsg);
if (!mSuppressInternalErrorFound)
internalErrorFound = true;
}
}
if (!hasValidConfig && configurations.size() > 1 && mSettings.isEnabled(Settings::INFORMATION)) {
std::string msg;
msg = "This file is not analyzed. Cppcheck failed to extract a valid configuration. Use -v for more details.";
msg += "\nThis file is not analyzed. Cppcheck failed to extract a valid configuration. The tested configurations have these preprocessor errors:";
for (const std::string &s : configurationError)
msg += '\n' + s;
std::list<ErrorLogger::ErrorMessage::FileLocation> locationList;
ErrorLogger::ErrorMessage::FileLocation loc;
loc.setfile(Path::toNativeSeparators(filename));
locationList.push_back(loc);
ErrorLogger::ErrorMessage errmsg(locationList,
loc.getfile(),
Severity::information,
msg,
"noValidConfiguration",
false);
reportErr(errmsg);
}
// dumped all configs, close root </dumps> element now
if (mSettings.dump && fdump.is_open())
fdump << "</dumps>" << std::endl;
} catch (const std::runtime_error &e) {
internalError(filename, e.what());
} catch (const std::bad_alloc &e) {
internalError(filename, e.what());
} catch (const InternalError &e) {
internalError(filename, e.errorMessage);
mExitCode=1; // e.g. reflect a syntax error
}
mAnalyzerInformation.setFileInfo("CheckUnusedFunctions", checkUnusedFunctions.analyzerInfo());
mAnalyzerInformation.close();
// In jointSuppressionReport mode, unmatched suppressions are
// collected after all files are processed
if (!mSettings.jointSuppressionReport && (mSettings.isEnabled(Settings::INFORMATION) || mSettings.checkConfiguration)) {
reportUnmatchedSuppressions(mSettings.nomsg.getUnmatchedLocalSuppressions(filename, isUnusedFunctionCheckEnabled()));
}
mErrorList.clear();
if (internalErrorFound && (mExitCode==0)) {
mExitCode = 1;
}
return mExitCode;
}
示例4: FileLocationDefaults
void FileLocationDefaults() const {
ErrorLogger::ErrorMessage::FileLocation loc;
ASSERT_EQUALS("", loc.getfile());
ASSERT_EQUALS(0, loc.line);
}