当前位置: 首页>>代码示例>>C++>>正文


C++ OovString::length方法代码示例

本文整理汇总了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;
}
开发者ID:8l,项目名称:oovcde,代码行数:7,代码来源:FilePath.cpp

示例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();
    }
开发者ID:animatedb,项目名称:oovaide,代码行数:25,代码来源:CppInstr.cpp

示例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)));
        }
    }
开发者ID:sguzwf,项目名称:oovaide,代码行数:7,代码来源:OovString.cpp

示例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;
}
开发者ID:8l,项目名称:oovcde,代码行数:31,代码来源:FilePath.cpp

示例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);
    }
开发者ID:Purplenigma,项目名称:oovaide,代码行数:17,代码来源:BuildConfigReader.cpp

示例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);
        }
    }
开发者ID:Purplenigma,项目名称:oovaide,代码行数:58,代码来源:Coverage.cpp

示例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);
    }
开发者ID:8l,项目名称:oovcde,代码行数:19,代码来源:oovCMaker.cpp

示例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;
    }
开发者ID:animatedb,项目名称:oovaide,代码行数:42,代码来源:ClassDiagram.cpp

示例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;
    }
开发者ID:animatedb,项目名称:oovaide,代码行数:42,代码来源:Highlighter.cpp

示例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;
    }
开发者ID:animatedb,项目名称:oovaide,代码行数:54,代码来源:Project.cpp

示例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;
    }
开发者ID:8l,项目名称:oovcde,代码行数:11,代码来源:oovCMaker.cpp

示例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);
    }
开发者ID:animatedb,项目名称:oovaide,代码行数:21,代码来源:NameValueFile.cpp

示例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]));
             }
         }
     }
开发者ID:8l,项目名称:oovcde,代码行数:13,代码来源:ZoneDiagramView.cpp

示例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;
    }
开发者ID:animatedb,项目名称:oovaide,代码行数:13,代码来源:EditOptions.cpp

示例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);
    }
开发者ID:8l,项目名称:oovcde,代码行数:22,代码来源:PackagesDialogs.cpp


注:本文中的OovString::length方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。