本文整理汇总了C++中CompoundValue::find方法的典型用法代码示例。如果您正苦于以下问题:C++ CompoundValue::find方法的具体用法?C++ CompoundValue::find怎么用?C++ CompoundValue::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CompoundValue
的用法示例。
在下文中一共展示了CompoundValue::find方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
示例2: write
/// For every includer file that is run across during parsing, this means that
/// the includer file was fully parsed, and that no old included information
/// needs to be kept, except to check if the old included information has not
/// changed.
///
/// This code assumes that no tricks are played with ifdef values, and
/// ifdef values must be the same every time a the same file is included.
void IncDirDependencyMap::write()
{
bool anyChanges = false;
time_t curTime;
time_t changedTime = 0;
time(&curTime);
#if(SHARED_FILE)
SharedFile file;
if(!writeFileExclusiveReadUpdate(file))
{
fprintf(stderr, "\nOovCppParser - Write file sharing error %s\n", getFilename().c_str());
}
#endif
// Append new values from parsed includes into the original NameValueFile.
// Update existing values times and make new dependencies.
for(const auto &newMapItem : mParsedIncludeDependencies)
{
bool changed = includedPathsChanged(newMapItem.first, newMapItem.second);
if(changed)
{
// Cheat and say updated time and checked time are the same.
changedTime = curTime;
CompoundValue newIncludedInfoCompVal;
OovString changeStr;
changeStr.appendInt(changedTime);
newIncludedInfoCompVal.addArg(changeStr);
OovString checkedStr;
checkedStr.appendInt(curTime);
newIncludedInfoCompVal.addArg(checkedStr);
for(const auto &str : newMapItem.second)
{
size_t pos = newIncludedInfoCompVal.find(str);
if(pos == CompoundValue::npos)
{
newIncludedInfoCompVal.addArg(str);
}
}
setNameValue(newMapItem.first, newIncludedInfoCompVal.getAsString());
anyChanges = true;
}
}
if(file.isOpen() && anyChanges)
{
#if(SHARED_FILE)
if(!writeFileExclusive(file))
{
OovString str = "Unable to write include map file";
OovError::report(ET_Error, str);
}
#else
writeFile();
#endif
}
}