本文整理汇总了C++中OovString::length方法的典型用法代码示例。如果您正苦于以下问题:C++ OovString::length方法的具体用法?C++ OovString::length怎么用?C++ OovString::length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OovString
的用法示例。
在下文中一共展示了OovString::length方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FilePathGetWithoutEndPathSep
OovString FilePathGetWithoutEndPathSep(
OovStringRef const path)
{
OovString str = path;
FilePathRemovePathSep(str, str.length()-1);
return str;
}
示例2: write
bool CppFileContents::write(OovStringRef const fn)
{
SimpleFile file;
eOpenStatus openStat = file.open(fn, M_WriteExclusiveTrunc, OE_Binary);
OovStatus status(openStat == OS_Opened, SC_File);
if(status.ok())
{
OovString includeCov = "#include \"OovCoverage.h\"";
appendLineEnding(includeCov);
updateMemory();
status = file.write(includeCov.c_str(), includeCov.length());
}
if(status.ok())
{
status = file.write(mFileContents.data(), mFileContents.size());
}
if(!status.ok())
{
OovString str = "Unable to write %s ";
str += fn;
str += "\n";
status.report(ET_Error, str.getStr());
}
return status.ok();
}
示例3: StringToLower
void StringToLower(OovString &str)
{
for(size_t i=0; i<str.length(); ++i)
{
str.at(i) = static_cast<char>(tolower(str.at(i)));
}
}
示例4: 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;
}
示例5: getAnalysisPath
std::string BuildConfig::getAnalysisPath() const
{
// If a build is being performed, it is possible that an analysis was never
// done, so there will be no analysis string. So get the one from the
// debug or release build. They should normally be all the same since
// it is mainly a CRC of the project related paths.
OovString crcStr = getCrcAsStr(BuildConfigAnalysis, CT_AnalysisArgsCrc);
if(crcStr.length() == 0)
{
crcStr = getCrcAsStr(BuildConfigDebug, CT_AnalysisArgsCrc);
if(crcStr.length() == 0)
{
crcStr = getCrcAsStr(BuildConfigRelease, CT_AnalysisArgsCrc);
}
}
return getAnalysisPathUsingCRC(crcStr);
}
示例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: appendNames
void CMaker::appendNames(OovStringVec const &names,
char delim, OovString &str)
{
for(auto const &name : names)
{
str += name;
str += delim;
size_t startpos = str.rfind('\n');
if(startpos == std::string::npos)
startpos = 0;
if(str.length() - startpos > 70)
{
str += "\n ";
}
}
int len = str.length();
if(len > 0 && str[len-1] == delim)
str.resize(len-1);
}
示例8: saveDiagram
OovStatusReturn ClassDiagram::saveDiagram(File &file)
{
OovStatus status(true, SC_File);
NameValueFile nameValFile;
CompoundValue names;
CompoundValue xPositions;
CompoundValue yPositions;
OovString drawingName;
for(auto const &node : mClassGraph.getNodes())
{
if(node.getType())
{
if(drawingName.length() == 0)
{
drawingName = node.getType()->getName();
}
names.addArg(node.getType()->getName());
}
else
{
names.addArg("Oov-Key");
}
OovString num;
num.appendInt(node.getPosition().x);
xPositions.addArg(num);
num.clear();
num.appendInt(node.getPosition().y);
yPositions.addArg(num);
}
if(drawingName.length() > 0)
{
DiagramStorage::setDrawingHeader(nameValFile, DST_Class, drawingName);
nameValFile.setNameValue("Names", names.getAsString());
nameValFile.setNameValue("XPositions", xPositions.getAsString());
nameValFile.setNameValue("YPositions", yPositions.getAsString());
status = nameValFile.writeFile(file);
}
return status;
}
示例9: codeComplete
OovStringVec Tokenizer::codeComplete(size_t offset)
{
CLangAutoLock lock(mCLangLock, __LINE__, this);
OovStringVec strs;
unsigned options = 0;
// This gets more than we want.
// unsigned options = clang_defaultCodeCompleteOptions();
unsigned int line;
unsigned int column;
getLineColumn(offset, line, column);
CXCodeCompleteResults *results = clang_codeCompleteAt(mTransUnit,
mSourceFilename.getStr(), line, column,
nullptr, 0, options);
if(results)
{
clang_sortCodeCompletionResults(&results->Results[0], results->NumResults);
for(size_t ri=0; ri<results->NumResults /*&& ri < 50*/; ri++)
{
OovString str;
CXCompletionString compStr = results->Results[ri].CompletionString;
size_t numChunks = clang_getNumCompletionChunks(compStr);
for(size_t ci=0; ci<numChunks && ci < 30; ci++)
{
CXCompletionChunkKind chunkKind = clang_getCompletionChunkKind(compStr, ci);
// We will discard return values from functions, so the first
// chunk returned will be the identifier or function name. Function
// arguments will be returned after a space, so they can be
// discarded easily.
if(chunkKind == CXCompletionChunk_TypedText || str.length())
{
std::string chunkStr = getDisposedString(clang_getCompletionChunkText(compStr, ci));
if(str.length() != 0)
str += ' ';
str += chunkStr;
}
}
strs.push_back(str);
}
clang_disposeCodeCompleteResults(results);
}
return strs;
}
示例10: getBinDirectory
OovString const Project::getBinDirectory()
{
static OovString path;
if(path.length() == 0)
{
OovStatus status(true, SC_File);
#ifdef __linux__
char buf[300];
ssize_t len = readlink("/proc/self/exe", buf, sizeof(buf));
if(len >= 0)
{
buf[len] = '\0';
path = buf;
size_t pos = path.rfind('/');
if(pos == std::string::npos)
{
pos = path.rfind('\\');
}
if(pos != std::string::npos)
{
path.resize(pos+1);
}
}
/*
if(FileIsFileOnDisk("./oovaide", status))
{
path = "./";
}
else if(FileIsFileOnDisk("/usr/local/bin/oovaide", status))
{
path = "/usr/local/bin/";
}
*/
else
{
path = "/usr/bin";
}
#else
if(FileIsFileOnDisk("./oovaide.exe", status))
{
path = "./";
}
else
{
path = FilePathGetDrivePath(sArgv0);
}
#endif
if(status.needReport())
{
status.report(ET_Error, "Unable to get bin directory");
}
}
return path;
}
示例11: getCompSources
OovStringVec CMaker::getCompSources(OovStringRef const compName)
{
OovStringVec sources = mCompTypes.getComponentSources(compName);
OovString compPath = mCompTypes.getComponentAbsolutePath(compName);
for(auto &src : sources)
{
src.erase(0, compPath.length());
}
std::sort(sources.begin(), sources.end(), compareNoCase);
return sources;
}
示例12: getLine
bool NameValueRecord::getLine(File &file, OovString &str, OovStatus &status)
{
char lineBuf[1000];
str.resize(0);
// Read many times until the \n is found.
while(file.getString(lineBuf, sizeof(lineBuf), status))
{
str += lineBuf;
size_t len = str.length();
if(str[len-1] == '\n')
{
str.resize(len-1);
break;
}
else if(len > 50000)
{
break;
}
}
return(str.length() > 0);
}
示例13: deleteSelected
void deleteSelected()
{
OovString selStr = mPathMapList.getSelected();
if(selStr.length() > 0)
{
OovStringVec vec = selStr.split(" > ");
if(vec.size() == 2)
{
mPathMapList.removeSelected();
mDiagramPathMap->remove(ZonePathReplaceItem(vec[0], vec[1]));
}
}
}
示例14: getScreenCoord
bool EditOptions::getScreenCoord(char const * const tag, int &val)
{
OovString str = getValue(tag);
bool got = false;
if(str.length() > 0)
{
if(str.getInt(0, 100000, val))
{
got = true;
}
}
return got;
}
示例15: winScanDirectories
void ProjectPackagesDialog::winScanDirectories()
{
Package pkg = mProjectPackages.getPackage(
mProjectPackagesList.getSelected());
if(pkg.getPkgName().length() > 0)
{
OovString rootDir = getEntry("PackageRootDirEntry");
FilePaths dirs;
dirs.push_back(FilePath("/", FP_Dir));
dirs.push_back(FilePath("/Program Files", FP_Dir));
OovString dir = findMatchingDir(dirs, rootDir);
if(dir.length())
{
pkg.setRootDir(dir);
// move to project packages.
mProjectPackages.insertPackage(pkg);
}
setEntry("PackageRootDirEntry", pkg.getRootDir());
}
else
Gui::messageBox("Select a package to scan", GTK_MESSAGE_INFO);
}