本文整理汇总了C++中OovStatus::ok方法的典型用法代码示例。如果您正苦于以下问题:C++ OovStatus::ok方法的具体用法?C++ OovStatus::ok怎么用?C++ OovStatus::ok使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OovStatus
的用法示例。
在下文中一共展示了OovStatus::ok方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: append
/*
class OovMonitorWriter
{
public:
OovMonitorWriter():
mFp(0)
{}
~OovMonitorWriter()
{
fclose(mFp);
}
void append(int fileIndex, int instrIndex)
{
if(!mFp)
{
mFp = fopen("OovMonitor.txt", "a");
}
{
// std::lock_guard<std::mutex> writeMutexLock(mWriteMutex);
std::stringstream id;
id << std::this_thread::get_id();
fprintf(mFp, "%s %d %d\n", id.str().c_str(), fileIndex, instrIndex);
fflush(mFp);
}
}
private:
FILE *mFp;
// std::mutex mWriteMutex;
};
OovMonitorWriter sOovMonitor;
void OovMonitor(int fileIndex, int instrIndex)
{
sOovMonitor.append(fileIndex, instrIndex);
}
*/
void CppInstr::updateCoverageSource(OovStringRef const /*fn*/, OovStringRef const covDir)
{
FilePath outFn(covDir, FP_Dir);
outFn.appendDir("covLib");
OovStatus status = FileEnsurePathExists(outFn);
if(status.ok())
{
outFn.appendFile("OovCoverage.cpp");
if(!FileIsFileOnDisk(outFn, status))
{
File file;
status = file.open(outFn, "w");
static char const *lines[] = {
"// Automatically generated file by OovCovInstr\n",
"// This appends coverage data to either a new or existing file,\n"
"// although the number of instrumented lines in the project must match.\n"
"// This file must be compiled and linked into the project.\n",
"#include <stdio.h>\n",
"#include \"OovCoverage.h\"\n",
"\n",
"unsigned short gCoverage[COV_TOTAL_INSTRS];\n",
"\n",
"class cCoverageOutput\n",
" {\n",
" public:\n",
" cCoverageOutput()\n",
" {\n",
" // Initialize because some compilers may not initialize statics (TI)\n",
" for(int i=0; i<COV_TOTAL_INSTRS; i++)\n",
" gCoverage[i] = 0;\n",
" }\n",
" ~cCoverageOutput()\n",
" {\n",
" update();\n",
" }\n",
" void update()\n",
" {\n",
" read();\n",
" write();\n",
" }\n",
"\n",
" private:\n",
" int getFirstIntFromLine(FILE *fp)\n",
" {\n",
" char buf[80];\n",
" fgets(buf, sizeof(buf), fp);\n",
" unsigned int tempInt = 0;\n",
" sscanf(buf, \"%u\", &tempInt);\n",
" return tempInt;\n",
" }\n",
" void read()\n",
" {\n",
" FILE *fp = fopen(\"OovCoverageCounts.txt\", \"r\");\n",
" if(fp)\n",
" {\n",
" int numInstrs = getFirstIntFromLine(fp);\n",
" if(numInstrs == COV_TOTAL_INSTRS)\n",
" {\n",
" for(int i=0; i<COV_TOTAL_INSTRS; i++)\n",
" {\n",
//.........这里部分代码省略.........
示例2: loadDiagram
OovStatusReturn ClassDiagram::loadDiagram(File &file)
{
NameValueFile nameValFile;
OovStatus status = nameValFile.readFile(file);
if(status.ok())
{
CompoundValue names;
names.parseString(nameValFile.getValue("Names"));
CompoundValue xPositions;
xPositions.parseString(nameValFile.getValue("XPositions"));
CompoundValue yPositions;
yPositions.parseString(nameValFile.getValue("YPositions"));
std::vector<ClassNode> &nodes = getNodes();
for(size_t i=0; i<names.size(); i++)
{
OovString name = names[i];
if(i == 0)
{
// The node at index zero is the graph key, and is not stored in
// the graph with a name or type.
// The node at index one is the first class, which is typically the
// same as the drawing name.
eDiagramStorageTypes drawingType;
OovString drawingName;
DiagramStorage::getDrawingHeader(nameValFile, drawingType, drawingName);
// This adds the key automatically as item index zero.
// Call this function to set the last selected class name for the journal.
clearGraphAndAddClass(drawingName, ClassGraph::AN_All,
ClassDiagram::DEPTH_SINGLE_CLASS, false);
int x=0;
int y=0;
xPositions[i].getInt(0, INT_MAX, x);
yPositions[i].getInt(0, INT_MAX, y);
if(nodes.size() > 0)
{
nodes[0].setPosition(GraphPoint(x, y));
}
}
else
{
// This will not add duplicates, so if the name is different
// from the drawingName, it will be added.
addClass(name, ClassGraph::AN_All,
ClassDiagram::DEPTH_SINGLE_CLASS, false);
}
auto nodeIter = std::find_if(nodes.begin(), nodes.end(),
[&name](ClassNode &node)
{ return(node.getType() && name == node.getType()->getName()); });
if(nodeIter != nodes.end())
{
int x=0;
int y=0;
xPositions[i].getInt(0, INT_MAX, x);
yPositions[i].getInt(0, INT_MAX, y);
nodeIter->setPosition(GraphPoint(x, y));
}
}
}
return status;
}