本文整理汇总了C++中OovString::find方法的典型用法代码示例。如果您正苦于以下问题:C++ OovString::find方法的具体用法?C++ OovString::find怎么用?C++ OovString::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OovString
的用法示例。
在下文中一共展示了OovString::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hasBaseClassRef
bool ModelStatement::hasBaseClassRef() const
{
OovString attrName = getName();
bool present = attrName.find(getBaseClassMemberRefSep()) != std::string::npos;
if(!present)
{
present = attrName.find(getBaseClassMemberCallSep()) != std::string::npos;
}
return(present);
}
示例2: insertLine
void NameValueRecord::insertLine(OovString lineBuf)
{
size_t colonPos = lineBuf.find(mapDelimiter);
if(colonPos != std::string::npos)
{
std::string key = lineBuf.substr(0, colonPos);
size_t termPos = lineBuf.find('\n');
std::string value = lineBuf.substr(colonPos+1, termPos-(colonPos+1));
setNameValue(key, value);
}
}
示例3: FilePathGetPosSegment
size_t FilePathGetPosSegment(OovStringRef const path, OovStringRef const seg)
{
OovString lowerPath;
// Only do case insensitive compares for Windows.
#ifdef __linux__
lowerPath = path;
#else
lowerPath.setLowerCase(path);
#endif
OovString lowerSeg;
#ifdef __linux__
lowerSeg = seg;
#else
lowerSeg.setLowerCase(seg);
#endif
size_t pos = lowerPath.find(lowerSeg);
size_t foundPos = std::string::npos;
if(pos != std::string::npos)
{
if(pos > 0)
{
size_t endPos = pos + lowerSeg.length();
if(FilePathIsPathSep(path, pos-1) &&
FilePathIsPathSep(path, endPos))
{
foundPos = pos-1;
}
}
}
return foundPos;
}
示例4: findPathSep
// returns std::string::npos if not found.
static size_t findPathSep(OovStringRef const path, size_t startPos = 0)
{
const OovString str = path;
size_t bpos = str.find('\\', startPos);
size_t fpos = str.find('/', startPos);
size_t pos = std::string::npos;
if(bpos != std::string::npos && fpos != std::string::npos)
{
pos = (bpos > fpos) ? fpos : bpos;
}
else if(bpos != std::string::npos)
pos = bpos;
else if(fpos != std::string::npos)
pos = fpos;
return pos;
}
示例5: mapPath
static bool mapPath(ZonePathMap const &map, OovString const &origName,
OovString &newName)
{
bool replaced = false;
size_t starti = 0;
newName = origName;
do
{
size_t firstFoundi = OovString::npos;
ZonePathReplaceItem const *repItem = nullptr;
for(auto const &mapItem : map)
{
size_t foundi = newName.find(mapItem.mSearchPath, starti);
if(foundi < firstFoundi)
{
repItem = &mapItem;
firstFoundi = foundi;
}
}
if(firstFoundi != OovString::npos)
{
newName.replace(firstFoundi, repItem->mSearchPath.length(),
repItem->mReplacePath);
starti = firstFoundi + repItem->mReplacePath.length();
replaced = true;
}
else
starti = OovString::npos;
} while(starti != OovString::npos);
return replaced;
}
示例6: isDevelopment
static bool isDevelopment()
{
static enum eDevel { Uninit, Devel, Deploy } devel;
if(devel == Uninit)
{
OovString path = Project::getBinDirectory();
size_t pos = path.find("bin");
if(pos != std::string::npos)
{
path.replace(pos, 3, "lib");
}
OovStatus status(true, SC_File);
if(FileIsDirOnDisk(path, status))
{
devel = Deploy;
}
else
{
devel = Devel;
}
if(status.needReport())
{
status.reported();
}
}
return(devel == Devel);
}
示例7: 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);
}
}
示例8: getSrcRootDirRelativeSrcFileName
OovString Project::getSrcRootDirRelativeSrcFileName(OovStringRef const srcFileName,
OovStringRef const srcRootDir)
{
OovString relSrcFileName = srcFileName;
size_t pos = relSrcFileName.find(srcRootDir.getStr());
if(pos != std::string::npos)
{
relSrcFileName.erase(pos, srcRootDir.numBytes());
FilePathRemovePathSep(relSrcFileName, 0);
}
return relSrcFileName;
}
示例9: insertBufToMap
void NameValueRecord::insertBufToMap(OovString const buf)
{
size_t pos = 0;
mNameValues.clear();
while(pos != std::string::npos)
{
size_t endPos = buf.find('\n', pos);
std::string line(buf, pos, endPos-pos);
insertLine(line);
pos = endPos;
if(pos != std::string::npos)
pos++;
}
}
示例10: makeOrigCovFn
/// Use the filename to make an identifier.
static std::string makeOrigCovFn(OovStringRef const fn)
{
OovString covFn = fn;
if(covFn.find("COV_") != std::string::npos)
{
covFn.erase(0, 4);
}
covFn.replaceStrs("_", "/");
size_t pos = covFn.rfind('/');
if(pos != std::string::npos)
{
covFn.replace(pos, 1, ".");
}
return covFn;
}
示例11: getLibDirectory
OovString const Project::getLibDirectory()
{
OovString path = getBinDirectory();
#ifdef __linux__
// During development, the libs/.so are in the bin dir.
if(!isDevelopment())
{
size_t pos = path.find("bin");
if(pos != std::string::npos)
{
path.replace(pos, 3, "lib");
}
}
#endif
return path;
}
示例12: StringSplit
OovStringVec StringSplit(char const * const str, char const * const delimiterStr)
{
OovString tempStr = str;
OovStringVec tokens;
size_t start = 0;
size_t end = 0;
const size_t delimLen = strlen(delimiterStr);
while(end != std::string::npos)
{
end = tempStr.find(delimiterStr, start);
size_t len = (end == std::string::npos) ? std::string::npos : end - start;
OovString splitStr = tempStr.substr(start, len);
tokens.push_back(splitStr);
start = (( end > (std::string::npos - delimLen)) ?
std::string::npos : end + delimLen);
}
return tokens;
}
示例13: getDiagResults
OovStringVec Tokenizer::getDiagResults()
{
OovStringVec diagResults;
if(mTransUnit)
{
int numDiags = clang_getNumDiagnostics(mTransUnit);
for (int i = 0; i<numDiags && diagResults.size() < 10; i++)
{
CXDiagnostic diag = clang_getDiagnostic(mTransUnit, i);
// CXDiagnosticSeverity sev = clang_getDiagnosticSeverity(diag);
// if(sev >= CXDiagnostic_Error)
OovString diagStr = getDisposedString(clang_formatDiagnostic(diag,
clang_defaultDiagnosticDisplayOptions()));
if(diagStr.find(mSourceFilename) != std::string::npos)
{
diagResults.push_back(diagStr);
}
}
}
return diagResults;
}
示例14: parseStringRef
void CompoundValueRef::parseStringRef(OovStringRef const strIn,
OovStringVec &vec, char delimiter)
{
OovString str = strIn;
size_t startArgPos = 0;
while(startArgPos != std::string::npos)
{
size_t endColonPos = str.find(delimiter, startArgPos);
std::string tempStr = str.substr(startArgPos, endColonPos-startArgPos);
// For compatibility with previous files, allow a string that is
// after the last colon. Previous versions that had the extra string
// did not allow null strings.
if(endColonPos != std::string::npos || tempStr.length() > 0)
{
vec.push_back(tempStr);
}
startArgPos = endColonPos;
if(startArgPos != std::string::npos)
startArgPos++;
}
}
示例15: isTypedefType
bool ModelType::isTypedefType(OovString const &name)
{
return(name.find("<<type") != std::string::npos);
}