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


C++ String8::find方法代码示例

本文整理汇总了C++中String8::find方法的典型用法代码示例。如果您正苦于以下问题:C++ String8::find方法的具体用法?C++ String8::find怎么用?C++ String8::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在String8的用法示例。


在下文中一共展示了String8::find方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: while

    status_t PropertyMap::Parser::parse() {
        while (!mTokenizer->isEof()) {
#if DEBUG_PARSER
            ALOGD("Parsing %s: '%s'.", mTokenizer->getLocation().string(),
                    mTokenizer->peekRemainderOfLine().string());
#endif

            mTokenizer->skipDelimiters(WHITESPACE);

            if (!mTokenizer->isEol() && mTokenizer->peekChar() != '#') {
                String8 keyToken = mTokenizer->nextToken(WHITESPACE_OR_PROPERTY_DELIMITER);
                if (keyToken.isEmpty()) {
                    ALOGE("%s: Expected non-empty property key.",
                          mTokenizer->getLocation().string());
                    return BAD_VALUE;
                }

                mTokenizer->skipDelimiters(WHITESPACE);

                if (mTokenizer->nextChar() != '=') {
                    ALOGE("%s: Expected '=' between property key and value.",
                          mTokenizer->getLocation().string());
                    return BAD_VALUE;
                }

                mTokenizer->skipDelimiters(WHITESPACE);

                String8 valueToken = mTokenizer->nextToken(WHITESPACE);
                if (valueToken.find("\\", 0) >= 0 || valueToken.find("\"", 0) >= 0) {
                    ALOGE("%s: Found reserved character '\\' or '\"' in property value.",
                          mTokenizer->getLocation().string());
                    return BAD_VALUE;
                }

                mTokenizer->skipDelimiters(WHITESPACE);
                if (!mTokenizer->isEol()) {
                    ALOGE("%s: Expected end of line, got '%s'.",
                          mTokenizer->getLocation().string(),
                          mTokenizer->peekRemainderOfLine().string());
                    return BAD_VALUE;
                }

                if (mMap->hasProperty(keyToken)) {
                    ALOGE("%s: Duplicate property value for key '%s'.",
                          mTokenizer->getLocation().string(), keyToken.string());
                    return BAD_VALUE;
                }

                mMap->addProperty(keyToken, valueToken);
            }

            mTokenizer->nextLine();
        }
        return NO_ERROR;
    }
开发者ID:tranleduy2000,项目名称:aapt_android,代码行数:55,代码来源:PropertyMap.cpp

示例2: if

/******************************************************************************
*   Splits a comma delimited string to a List of int Vector.
*   Example string: "(10000,26623),(10000,30000)"
*******************************************************************************/
bool
ParamsManager::
splitRange(String8 const& s8Input, List< Vector<int> >& rOutput)
{
    rOutput.clear();
    //
    if  ( s8Input.isEmpty() )
    {
        MY_LOGW("empty string");
        return  false;
    }
    //
    int endIndex, fromIndex = 1;
    int endIndex_input = s8Input.length()-1;
    if  ( s8Input[0] != '(' || s8Input[endIndex_input] != ')' )
    {
        MY_LOGW("Invalid range list string=%s", s8Input.string());
        return  false;
    }
    //
    do  {
        endIndex = s8Input.find("),(", fromIndex);
        if (endIndex == -1) endIndex = endIndex_input;
        //
        Vector<int> vOut;
        String8 const s8SubString(s8Input.string()+fromIndex, endIndex-fromIndex);
        if  ( splitInt(s8SubString, vOut) ) {
            rOutput.push_back(vOut);
        }
        //
        fromIndex = endIndex + 3;
    } while (endIndex != endIndex_input);
    //
    return  (rOutput.size() > 0);
}
开发者ID:,项目名称:,代码行数:39,代码来源:

示例3: getComponentName

String8 getComponentName(String8 &pkgName, String8 &componentName) {
    ssize_t idx = componentName.find(".");
    String8 retStr(pkgName);
    if (idx == 0) {
        retStr += componentName;
    } else if (idx < 0) {
        retStr += ".";
        retStr += componentName;
    } else {
        return componentName;
    }
    return retStr;
}
开发者ID:EmilioNegron,项目名称:platform_frameworks_base,代码行数:13,代码来源:Command.cpp

示例4: printLongString

void ProgramCache::printLongString(const String8& shader) const {
    ssize_t index = 0;
    ssize_t lastIndex = 0;
    const char* str = shader.string();
    while ((index = shader.find("\n", index)) > -1) {
        String8 line(str, index - lastIndex);
        if (line.length() == 0) line.append("\n");
        PROGRAM_LOGD("%s", line.string());
        index++;
        str += (index - lastIndex);
        lastIndex = index;
    }
}
开发者ID:AdrianoMartins,项目名称:platform_frameworks_base,代码行数:13,代码来源:ProgramCache.cpp

示例5: verifyKernelTraceFuncs

// Verify that the comma separated list of functions are being traced by the
// kernel.
static bool verifyKernelTraceFuncs(const char* funcs)
{
    int fd = open(k_ftraceFilterPath, O_RDONLY);
    if (fd == -1) {
        fprintf(stderr, "error opening %s: %s (%d)\n", k_ftraceFilterPath,
            strerror(errno), errno);
        return false;
    }

    char buf[4097];
    ssize_t n = read(fd, buf, 4096);
    close(fd);
    if (n == -1) {
        fprintf(stderr, "error reading %s: %s (%d)\n", k_ftraceFilterPath,
            strerror(errno), errno);
        return false;
    }

    buf[n] = '\0';
    String8 funcList = String8::format("\n%s", buf);

    // Make sure that every function listed in funcs is in the list we just
    // read from the kernel.
    bool ok = true;
    char* myFuncs = strdup(funcs);
    char* func = strtok(myFuncs, ",");
    while (func) {
        String8 fancyFunc = String8::format("\n%s\n", func);
        bool found = funcList.find(fancyFunc.string(), 0) >= 0;
        if (!found || func[0] == '\0') {
            fprintf(stderr, "error: \"%s\" is not a valid kernel function "
                "to trace.\n", func);
            ok = false;
        }
        func = strtok(NULL, ",");
    }
    free(myFuncs);

    return ok;
}
开发者ID:AOSP-JF,项目名称:platform_frameworks_native,代码行数:42,代码来源:atrace.cpp

示例6: onConstructor

// BufferQueueCore part
// -----------------------------------------------------------------------------
void BufferQueueDebug::onConstructor(
        wp<BufferQueueCore> bq, const String8& consumerName) {
    mBq = bq;
    mPid = getpid();
    mConsumerName = consumerName;
    if (sscanf(consumerName.string(), "unnamed-%*d-%d", &mId) != 1) {
        BQ_LOGE("id info cannot be read from '%s'", consumerName.string());
    }

    if (NO_ERROR == getProcessName(mPid, mConsumerProcName)) {
        BQ_LOGI("BufferQueue core=(%d:%s)", mPid, mConsumerProcName.string());
    } else {
        BQ_LOGI("BufferQueue core=(%d:\?\?\?)", mPid);
    }

    mIsInGuiExt = (mConsumerProcName.find("guiext-server") != -1);
    mDump = new BufferQueueDump(mIsInGuiExt ?
            BufferQueueDump::TRACK_PRODUCER : BufferQueueDump::TRACK_CONSUMER, mBq.unsafe_get());

    if (mDump == NULL) {
        BQ_LOGE("new BufferQueueDump() failed in BufferQueue()");
    }
    // update dump name
    mDump->setName(consumerName);

    // check property for drawing debug line
    char value[PROPERTY_VALUE_MAX];
    property_get("debug.bq.line", value, "GOD'S IN HIS HEAVEN, ALL'S RIGHT WITH THE WORLD.");
    mLine = (-1 != consumerName.find(value));
    mLineCnt = 0;

    if (true == mLine) {
        BQ_LOGI("switch on debug line");
    }

    if (!mIsInGuiExt) {
        BufferQueueMonitor::getInstance().monitor(mBq);
    }
}
开发者ID:,项目名称:,代码行数:41,代码来源:


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