本文整理汇总了C++中OovString::size方法的典型用法代码示例。如果您正苦于以下问题:C++ OovString::size方法的具体用法?C++ OovString::size怎么用?C++ OovString::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OovString
的用法示例。
在下文中一共展示了OovString::size方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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");
}
}
}
示例2: FileIsFileOnDisk
bool FileIsFileOnDisk(OovStringRef const path, bool &success)
{
OovString tempPath = path;
FilePathRemovePathSep(tempPath, tempPath.size()-1);
struct OovStat32 statval;
int statRet = OovStat32(tempPath.getStr(), &statval);
// Indicate there is an error only if the error is not ENOENT.
success = ((statRet == 0) || (errno == ENOENT));
// Only indicate the file exists if there was no error, and it is a file.
return((statRet == 0) && !S_ISDIR(statval.st_mode));
}
示例3: parseProjRefs
void ComponentsFile::parseProjRefs(OovStringRef const arg, OovString &rootDir,
OovStringVec &excludes)
{
excludes.clear();
OovStringVec tokens = StringSplit(arg, '!');
if(rootDir.size() == 0)
rootDir = tokens[0];
if(tokens.size() > 1)
{
excludes.resize(tokens.size()-1);
std::copy(tokens.begin()+1, tokens.end(), excludes.begin());
}
}
示例4: includedPathsChanged
bool IncDirDependencyMap::includedPathsChanged(OovStringRef includerFn,
std::set<std::string> const &includedInfoStr) const
{
bool changed = false;
// First check if the includer filename exists in the dependency file.
OovString origIncludedInfoStr = getValue(includerFn);
if(origIncludedInfoStr.size() > 0)
{
CompoundValue origIncludedInfoCompVal;
// get the changed time, which is the first value and discard
// everything else.
origIncludedInfoCompVal.parseString(origIncludedInfoStr);
// Check that counts of the number of includes is the same in
// the new and original map. This will detect deleted includes.
if(origIncludedInfoCompVal.size()-IncDirMapNumTimeVals !=
(includedInfoStr.size() * IncDirMapNumIncPathParts))
{
changed = true;
}
else
{
// Every included file in the new map must exist in the
// original map.
for(const auto &included : includedInfoStr)
{
CompoundValue incPathParts;
incPathParts.parseString(included);
if(incPathParts.size() == 2)
{
if(std::find(origIncludedInfoCompVal.begin(),
origIncludedInfoCompVal.end(), incPathParts[1]) ==
origIncludedInfoCompVal.end())
{
changed = true;
}
}
else
{
changed = true;
}
}
}
}
else
{
changed = true;
}
return changed;
}
示例5: writeFileExclusive
OovStatusReturn NameValueFile::writeFileExclusive(class SharedFile &file)
{
OovStatus status(true, SC_File);
bool success = file.isOpen();
if(success)
{
OovString buf;
readMapToBuf(buf);
file.truncate();
status = file.seekBegin();
if(status.ok())
{
status = file.write(&buf[0], static_cast<int>(buf.size()));
}
}
else
{
status.set(false, SC_File);
}
return status;
}