本文整理汇总了C++中OovStatus::needReport方法的典型用法代码示例。如果您正苦于以下问题:C++ OovStatus::needReport方法的具体用法?C++ OovStatus::needReport怎么用?C++ OovStatus::needReport使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OovStatus
的用法示例。
在下文中一共展示了OovStatus::needReport方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateGraph
void ComponentGraph::updateGraph(const ComponentDrawOptions &options)
{
ComponentTypesFile compFile;
OovStatus status = compFile.read();
if(status.ok())
{
mNodes.clear();
for(auto const &name : compFile.getComponentNames())
{
ComponentTypesFile::eCompTypes ct = compFile.getComponentType(name);
if(ct != ComponentTypesFile::CT_Unknown)
{
mNodes.push_back(ComponentNode(name,
ComponentNode::CNT_Component, ct));
}
}
BuildPackages buildPkgs(true);
std::vector<Package> packages = buildPkgs.getPackages();
for(auto const &pkg : packages)
{
mNodes.push_back(ComponentNode(pkg.getPkgName(),
ComponentNode::CNT_ExternalPackage));
}
updateConnections(compFile, options);
}
if(status.needReport())
{
status.report(ET_Error, "Unable to update component graph");
}
}
示例2: makeCoverageComponentTypesFile
static bool makeCoverageComponentTypesFile(OovStringRef const srcFn, OovStringRef const dstFn)
{
ComponentTypesFile file;
OovStatus status = file.readTypesOnly(srcFn);
if(status.ok())
{
// Define a static library that contains the code that stores
// the coverage counts that is compiled into exectuables.
static OovStringRef const covLibName = Project::getCovLibName();
CompoundValue names = file.getComponentNames();
if(names.find(covLibName) == CompoundValue::npos)
{
names.push_back(covLibName);
file.setComponentNames(names.getAsString());
file.setComponentType(covLibName,
ComponentTypesFile::getShortComponentTypeName(
ComponentTypesFile::CT_StaticLib));
}
status = file.writeTypesOnly(dstFn);
}
if(status.needReport())
{
OovString err = "Unable to make component types file ";
err += srcFn;
status.report(ET_Error, err);
}
return status.ok();
}
示例3: read
void CoverageCountsReader::read(OovStringRef const fn)
{
File file;
OovStatus status = file.open(fn, "r");
mInstrCounts.clear();
if(status.ok())
{
char buf[100];
int lineCounter = 0;
while(file.getString(buf, sizeof(buf), status))
{
lineCounter++;
int val;
if(sscanf(buf, "%d", &val) == 1)
{
if(lineCounter == 1)
{
mNumInstrumentedLines = val;
}
else
{
mInstrCounts.push_back(val);
}
}
}
}
if(status.needReport())
{
status.report(ET_Error, "Unable to read coverage counts");
}
}
示例4: saveScreen
void BuildSettingsDialog::saveScreen()
{
saveFromScreen(mLastCompName);
OovStatus status = mComponentFile.writeFile();
if(status.needReport())
{
status.report(ET_Error, "Unable to save build settings");
}
}
示例5: read
OovStatusReturn ComponentTypesFile::read()
{
mCompTypesFile.setFilename(Project::getComponentTypesFilePath());
mCompSourceListFile.setFilename(Project::getComponentSourceListFilePath());
OovStatus status = mCompSourceListFile.readFile();
// For new projects, the files are optional.
/// @todo - should detect the difference between missing files and disk errors.
if(status.needReport())
{
status.clearError();
}
status = mCompTypesFile.readFile();
if(status.needReport())
{
status.clearError();
}
return status;
}
示例6: updateCovSourceCounts
/// Copy a single source file and make a comment that contains the hit count
/// for each instrumented line.
static void updateCovSourceCounts(OovStringRef const relSrcFn,
std::vector<int> &counts)
{
FilePath srcFn(Project::getCoverageSourceDirectory(), FP_Dir);
srcFn.appendFile(relSrcFn);
FilePath dstFn(Project::getCoverageProjectDirectory(), FP_Dir);
dstFn.appendFile(relSrcFn);
File srcFile;
OovStatus status = srcFile.open(srcFn, "r");
if(status.ok())
{
status = FileEnsurePathExists(dstFn);
if(status.ok())
{
File dstFile;
status = dstFile.open(dstFn, "w");
if(status.ok())
{
char buf[1000];
size_t instrCount = 0;
while(srcFile.getString(buf, sizeof(buf), status))
{
if(strstr(buf, "COV_IN("))
{
if(instrCount < counts.size())
{
OovString countStr = " // ";
countStr.appendInt(counts[instrCount]);
OovString newStr = buf;
size_t pos = newStr.find('\n');
newStr.insert(pos, countStr);
if(newStr.length() < sizeof(buf)-1)
{
strcpy(buf, newStr.getStr());
}
}
instrCount++;
}
status = dstFile.putString(buf);
if(!status.ok())
{
break;
}
}
}
}
}
if(status.needReport())
{
OovString err = "Unable to transfer coverage ";
err += srcFn;
err += " ";
err += dstFn;
status.report(ET_Error, err);
}
}
示例7: setBuildConfig
void ProjectBuildArgs::setBuildConfig(OovStringRef buildMode, OovStringRef const buildConfig)
{
mBuildEnv.addCurrentFilterValue(OptFilterNameBuildMode, buildMode);
mBuildEnv.addCurrentFilterValue(OptFilterNameBuildConfig, buildConfig);
mBuildEnv.addCurrentFilterValue(OptFilterNamePlatform, OptionsDefaults::getPlatform());
OovStatus status = mProjectPackages.read();
if(status.needReport())
{
// These packages are optional.
status.clearError();
}
status = mBuildPackages.read();
if(status.needReport())
{
// These packages are optional.
status.clearError();
}
}
示例8: checkDebugger
bool EditFiles::checkDebugger()
{
bool ok = false;
NameValueFile projFile(Project::getProjectFilePath());
OovStatus status = projFile.readFile();
if(!status.ok())
{
OovString str = "Unable to get project file to get debugger: ";
str += Project::getProjectFilePath();
status.report(ET_Error, str);
}
getDebugger().setDebuggerFilePath(projFile.getValue(OptToolDebuggerPath));
getDebugger().setDebuggee(mEditOptions.getValue(OptEditDebuggee));
getDebugger().setDebuggeeArgs(mEditOptions.getValue(OptEditDebuggeeArgs));
getDebugger().setWorkingDir(mEditOptions.getValue(OptEditDebuggerWorkingDir));
//Gui::messageBox("Debugging is not recommended. It is very unstable.");
std::string debugger = getDebugger().getDebuggerFilePath();
std::string debuggee = getDebugger().getDebuggeeFilePath();
if(debugger.length() > 0)
{
if(debuggee.length() > 0)
{
// The debugger could be on the path.
// if(fileExists(debugger))
{
if(FileIsFileOnDisk(debuggee, status))
{
ok = true;
}
else
{
Gui::messageBox("Component to debug in Edit/Preferences does not exist");
}
if(status.needReport())
{
status.report(ET_Error, "Unable to check debuggee status");
}
}
// else
// {
// Gui::messageBox("Debugger in Oovaide Analysis/Settings does not exist");
// }
}
else
{
Gui::messageBox("Component to debug must be set in Edit/Preferences");
}
}
else
{
Gui::messageBox("Debugger tool path must be set in Oovaide Analysis/Settings");
}
return ok;
}
示例9: write
void CoverageHeader::write(SharedFile &outDefFile, OovStringRef const /*srcFn*/,
int numInstrLines)
{
std::string fnDef = getFileDefine();
mInstrDefineMap[fnDef] = numInstrLines;
int totalCount = 0;
for(auto const &defItem : mInstrDefineMap)
{
totalCount += defItem.second;
}
if(outDefFile.isOpen())
{
OovString buf;
static char const *lines[] =
{
"// Automatically generated file by OovCovInstr\n",
"// This file should not normally be edited manually.\n",
"#define COV_IN(fileIndex, instrIndex) gCoverage[fileIndex+instrIndex]++;\n",
};
for(size_t i=0; i<sizeof(lines)/sizeof(lines[0]); i++)
{
buf += lines[i];
}
buf += "#define COV_TOTAL_INSTRS ";
buf.appendInt(totalCount);
buf += "\n";
buf += "extern unsigned short gCoverage[COV_TOTAL_INSTRS];\n";
int coverageCount = 0;
for(auto const &defItem : mInstrDefineMap)
{
OovString def = "#define ";
def += defItem.first;
def += " ";
def.appendInt(coverageCount);
coverageCount += defItem.second;
def += " // ";
def.appendInt(defItem.second);
def += "\n";
buf += def;
}
outDefFile.truncate();
OovStatus status = outDefFile.seekBegin();
if(status.ok())
{
status = outDefFile.write(&buf[0], static_cast<int>(buf.size()));
}
if(status.needReport())
{
status.report(ET_Error, "Unable to write coverage source");
}
}
}
示例10: writeTypesOnly
OovStatusReturn ComponentTypesFile::writeTypesOnly(OovStringRef const fn)
{
mCompTypesFile.setFilename(fn);
OovStatus status = mCompTypesFile.writeFile();
if(status.needReport())
{
OovString str = "Unable to write source list file: ";
str += mCompTypesFile.getFilename();
OovError::report(ET_Error, str);
}
return status;
}
示例11: writeFile
OovStatusReturn ComponentTypesFile::writeFile()
{
OovStatus status = mCompTypesFile.writeFile();
if(status.needReport())
{
OovString str = "Unable to write component types file: ";
str += mCompTypesFile.getFilename();
status.report(ET_Error, str);
}
if(status.ok())
{
status = mCompSourceListFile.writeFile();
if(status.needReport())
{
OovString str = "Unable to write source list file: ";
str += mCompSourceListFile.getFilename();
status.report(ET_Error, str);
}
}
return status;
}
示例12: getOutputDir
FilePath Project::getOutputDir()
{
FilePath fp(Project::getProjectDirectory(), FP_Dir);
fp.appendDir("output");
OovStatus status = FileEnsurePathExists(fp);
if(status.needReport())
{
OovString err = "Unable to create directory ";
err += fp;
status.report(ET_Error, fp);
}
return fp;
}
示例13: saveScreenSize
void EditOptions::saveScreenSize(int width, int height)
{
if(getFilename().length() > 0)
{
setScreenCoord("ScreenWidth", width);
setScreenCoord("ScreenHeight", height);
OovStatus status = writeFile();
if(status.needReport())
{
status.report(ET_Error, "Unable to write edit options");
}
}
}
示例14: makeCoverageStats
bool makeCoverageStats()
{
bool success = false;
SharedFile covHeaderFile;
OovString covHeaderFn = CoverageHeaderReader::getFn(
Project::getCoverageSourceDirectory());
eOpenStatus stat = covHeaderFile.open(covHeaderFn, M_ReadShared, OE_Binary);
if(stat == OS_Opened)
{
CoverageHeaderReader covHeaderReader;
OovStatus status = covHeaderReader.read(covHeaderFile);
if(status.needReport())
{
status.report(ET_Error, "Unable to read coverage header");
}
int headerInstrLines = covHeaderReader.getNumInstrumentedLines();
if(headerInstrLines > 0)
{
success = true;
FilePath covCountsFn(Project::getCoverageProjectDirectory(), FP_Dir);
covCountsFn.appendDir("out-Debug");
static char const covCountsFnStr[] = "OovCoverageCounts.txt";
covCountsFn.appendFile(covCountsFnStr);
CoverageCountsReader covCounts;
covCounts.read(covCountsFn);
int covInstrLines = covCounts.getNumInstrumentedLines();
if(headerInstrLines == covInstrLines)
{
makeCoverageStats(covHeaderReader, covCounts);
updateCovSourceCounts(covHeaderReader, covCounts);
}
else
{
fprintf(stderr, "Number of OovCoverage.h lines %d don't match %s lines %d\n",
headerInstrLines, covCountsFnStr, covInstrLines);
}
}
else
{
fprintf(stderr, "No lines are instrumented in %s\n", covHeaderFn.getStr());
}
}
else
{
fprintf(stderr, "Unable to open file %s\n", covHeaderFn.getStr());
}
return success;
}
示例15: getSrcRootDirectory
OovStringRef const Project::getSrcRootDirectory()
{
if(sSourceRootDirectory.length() == 0)
{
NameValueFile file(getProjectFilePath());
OovStatus status = file.readFile();
if(status.needReport())
{
OovString str = "Unable to read project file to get source: ";
str += getProjectFilePath();
status.report(ET_Error, str);
}
sSourceRootDirectory = file.getValue(OptSourceRootDir);
}
return sSourceRootDirectory;
}