您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ FindInReadable函数代码示例

51自学网 2021-06-01 20:46:46
  C++
这篇教程C++ FindInReadable函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中FindInReadable函数的典型用法代码示例。如果您正苦于以下问题:C++ FindInReadable函数的具体用法?C++ FindInReadable怎么用?C++ FindInReadable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

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

示例1: nsAccessKeyInfo

voidnsTextBoxFrame::UpdateAccessIndex(){    PRInt32 menuAccessKey;    nsMenuBarListener::GetMenuAccessKey(&menuAccessKey);    if (menuAccessKey) {        if (mAccessKey.IsEmpty()) {            if (mAccessKeyInfo) {                delete mAccessKeyInfo;                mAccessKeyInfo = nsnull;            }        } else {            if (!mAccessKeyInfo) {                mAccessKeyInfo = new nsAccessKeyInfo();                if (!mAccessKeyInfo)                    return;            }            nsAString::const_iterator start, end;                            mCroppedTitle.BeginReading(start);            mCroppedTitle.EndReading(end);                        // remember the beginning of the string            nsAString::const_iterator originalStart = start;            PRBool found;            if (!AlwaysAppendAccessKey()) {                // not appending access key - do case-sensitive search                // first                found = FindInReadable(mAccessKey, start, end);                if (!found) {                    // didn't find it - perform a case-insensitive search                    start = originalStart;                    found = FindInReadable(mAccessKey, start, end,                                           nsCaseInsensitiveStringComparator());                }            } else {                found = RFindInReadable(mAccessKey, start, end,                                        nsCaseInsensitiveStringComparator());            }                        if (found)                mAccessKeyInfo->mAccesskeyIndex = Distance(originalStart, start);            else                mAccessKeyInfo->mAccesskeyIndex = kNotFound;        }    }}
开发者ID:lofter2011,项目名称:Icefox,代码行数:49,


示例2: IsVideoContentType

bool IsVideoContentType(const nsCString& aContentType) {  NS_NAMED_LITERAL_CSTRING(video, "video");  if (FindInReadable(video, aContentType)) {    return true;  }  return false;}
开发者ID:jld,项目名称:gecko-dev,代码行数:7,


示例3: start

// staticModifiersUIEvent::ComputeModifierState(const nsAString& aModifiersList){  if (aModifiersList.IsEmpty()) {    return 0;  }  // Be careful about the performance.  If aModifiersList is too long,  // parsing it needs too long time.  // XXX Should we abort if aModifiersList is too long?  Modifiers modifiers = 0;  nsAString::const_iterator listStart, listEnd;  aModifiersList.BeginReading(listStart);  aModifiersList.EndReading(listEnd);  for (uint32_t i = 0; i < ArrayLength(kPairs); i++) {    nsAString::const_iterator start(listStart), end(listEnd);    if (!FindInReadable(NS_ConvertASCIItoUTF16(kPairs[i].name), start, end)) {      continue;    }    if ((start != listStart && !NS_IsAsciiWhitespace(*(--start))) ||        (end != listEnd && !NS_IsAsciiWhitespace(*(end)))) {      continue;    }    modifiers |= kPairs[i].modifier;  }  return modifiers;}
开发者ID:MoonchildProductions,项目名称:Pale-Moon,代码行数:33,


示例4:

nsresultnsAboutCache::ParseURI(nsIURI * uri, nsCString &deviceID){    //    // about:cache[?device=string]    //    nsresult rv;    deviceID.Truncate();    nsCAutoString path;    rv = uri->GetPath(path);    if (NS_FAILED(rv)) return rv;    nsACString::const_iterator start, valueStart, end;    path.BeginReading(start);    path.EndReading(end);    valueStart = end;    if (!FindInReadable(NS_LITERAL_CSTRING("?device="), start, valueStart))        return NS_OK;    deviceID.Assign(Substring(valueStart, end));    return NS_OK;}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:25,


示例5: PushOverBoundary

  // Reads over a boundary and sets start to the position after the end of the  // boundary. Returns false if no boundary is found immediately.  bool  PushOverBoundary(const nsACString& aBoundaryString,                   nsACString::const_iterator& aStart,                   nsACString::const_iterator& aEnd)  {    // We copy the end iterator to keep the original pointing to the real end    // of the string.    nsACString::const_iterator end(aEnd);    const char* beginning = aStart.get();    if (FindInReadable(aBoundaryString, aStart, end)) {      // We either should find the body immediately, or after 2 chars with the      // 2 chars being '-', everything else is failure.      if ((aStart.get() - beginning) == 0) {        aStart.advance(aBoundaryString.Length());        return true;      }      if ((aStart.get() - beginning) == 2) {        if (*(--aStart) == '-' && *(--aStart) == '-') {          aStart.advance(aBoundaryString.Length() + 2);          return true;        }      }    }    return false;  }
开发者ID:Jinwoo-Song,项目名称:gecko-dev,代码行数:29,


示例6: FindCRLF

 bool FindCRLF(nsACString::const_iterator& aStart,          nsACString::const_iterator& aEnd) {   nsACString::const_iterator end(aEnd);   return FindInReadable(NS_LITERAL_CSTRING("/r/n"), aStart, end); }
开发者ID:Jinwoo-Song,项目名称:gecko-dev,代码行数:7,


示例7: DoFindInReadable

static PRBool DoFindInReadable(const nsACString& str, const nsACString& value){  nsACString::const_iterator start, end;  str.BeginReading(start);  str.EndReading(end);  return FindInReadable(value, start, end);}
开发者ID:fortunto2,项目名称:celtx,代码行数:8,


示例8: FindCharInReadable

nsresultnsAboutCacheEntry::ParseURI(nsIURI *uri, nsCString &clientID,                            bool &streamBased, nsCString &key){    //    // about:cache-entry?client=[string]&sb=[boolean]&key=[string]    //    nsresult rv;    nsAutoCString path;    rv = uri->GetPath(path);    if (NS_FAILED(rv)) return rv;    nsACString::const_iterator i1, i2, i3, end;    path.BeginReading(i1);    path.EndReading(end);    i2 = end;    if (!FindInReadable(NS_LITERAL_CSTRING("?client="), i1, i2))        return NS_ERROR_FAILURE;    // i2 points to the start of clientID    i1 = i2;    i3 = end;    if (!FindInReadable(NS_LITERAL_CSTRING("&sb="), i1, i3))        return NS_ERROR_FAILURE;    // i1 points to the end of clientID    // i3 points to the start of isStreamBased    clientID.Assign(Substring(i2, i1));    i1 = i3;    i2 = end;    if (!FindInReadable(NS_LITERAL_CSTRING("&key="), i1, i2))        return NS_ERROR_FAILURE;    // i1 points to the end of isStreamBased    // i2 points to the start of key    streamBased = FindCharInReadable('1', i3, i1);    key.Assign(Substring(i2, end));    return NS_OK;}
开发者ID:mikeaich,项目名称:releases-mozilla-central,代码行数:43,


示例9: AttrHasSubstring

static boolAttrHasSubstring(Implementor* aElement, nsIAtom* aNS, nsIAtom* aName,                 nsIAtom* aStr_){  FakeRef<nsIAtom> aStr(aStr_);  auto match = [aStr](const nsAttrValue* aValue) {    nsAutoString str;    aValue->ToString(str);    return FindInReadable(str, nsDependentAtomString(aStr));  };  return DoMatch(aElement, aNS, aName, match);}
开发者ID:cliqz-oss,项目名称:browser-f,代码行数:12,


示例10: FindInReadable

// the following block is to append the accesskey to mTitle if there is an accesskey// but the mTitle doesn't have the charactervoidnsTextBoxFrame::UpdateAccessTitle(){    /*     * Note that if you change appending access key label spec,     * you need to maintain same logic in following methods. See bug 324159.     * toolkit/content/commonDialog.js (setLabelForNode)     * toolkit/content/widgets/text.xml (formatAccessKey)     */    PRInt32 menuAccessKey;    nsMenuBarListener::GetMenuAccessKey(&menuAccessKey);    if (!menuAccessKey || mAccessKey.IsEmpty())        return;    if (!AlwaysAppendAccessKey() &&        FindInReadable(mAccessKey, mTitle, nsCaseInsensitiveStringComparator()))        return;    nsAutoString accessKeyLabel;    accessKeyLabel += '(';    accessKeyLabel += mAccessKey;    ToUpperCase(accessKeyLabel);    accessKeyLabel += ')';    if (mTitle.IsEmpty()) {        mTitle = accessKeyLabel;        return;    }    const nsDependentString& kEllipsis = nsContentUtils::GetLocalizedEllipsis();    PRUint32 offset = mTitle.Length();    if (StringEndsWith(mTitle, kEllipsis)) {        offset -= kEllipsis.Length();    } else if (StringEndsWith(mTitle, OLD_ELLIPSIS)) {        // Try to check with our old ellipsis (for old addons)        offset -= OLD_ELLIPSIS.Length();    } else {        // Try to check with        // our default ellipsis (for non-localized addons) or ':'        const PRUnichar kLastChar = mTitle.Last();        if (kLastChar == PRUnichar(0x2026) || kLastChar == PRUnichar(':'))            offset--;    }    if (InsertSeparatorBeforeAccessKey() &&        offset > 0 && !NS_IS_SPACE(mTitle[offset - 1])) {        mTitle.Insert(' ', offset);        offset++;    }    mTitle.Insert(accessKeyLabel, offset);}
开发者ID:lofter2011,项目名称:Icefox,代码行数:54,


示例11: FindInReadable

NS_IMETHODIMP nsMailboxService::NewURI(const nsACString &aSpec,                                       const char *aOriginCharset,                                       nsIURI *aBaseURI,                                       nsIURI **_retval){    nsresult rv = NS_OK;    nsACString::const_iterator b, e;    if (FindInReadable(NS_LITERAL_CSTRING("?uidl="), aSpec.BeginReading(b), aSpec.EndReading(e)) ||        FindInReadable(NS_LITERAL_CSTRING("&uidl="), aSpec.BeginReading(b), aSpec.EndReading(e)))  {    nsCOMPtr<nsIProtocolHandler> handler =              do_GetService(kCPop3ServiceCID, &rv);    if (NS_SUCCEEDED(rv))        rv = handler->NewURI(aSpec, aOriginCharset, aBaseURI, _retval);  }  else  {    nsCOMPtr<nsIURI> aMsgUri = do_CreateInstance(kCMailboxUrl, &rv);            if (NS_SUCCEEDED(rv))    {      if (aBaseURI)       {        nsCAutoString newSpec;        rv = aBaseURI->Resolve(aSpec, newSpec);        if (NS_FAILED(rv))          return rv;        aMsgUri->SetSpec(newSpec);      }       else       {        aMsgUri->SetSpec(aSpec);      }      NS_ADDREF(*_retval = aMsgUri);    }  }  return rv;}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:39,


示例12: NS_NAMED_LITERAL_CSTRING

NS_IMETHODIMPnsLocalFile::SetRelativeDescriptor(nsIFile* aFromFile,                                   const nsACString& aRelativeDesc){  NS_NAMED_LITERAL_CSTRING(kParentDirStr, "../");  nsCOMPtr<nsIFile> targetFile;  nsresult rv = aFromFile->Clone(getter_AddRefs(targetFile));  if (NS_FAILED(rv)) {    return rv;  }  //  // aRelativeDesc is UTF-8 encoded  //  nsCString::const_iterator strBegin, strEnd;  aRelativeDesc.BeginReading(strBegin);  aRelativeDesc.EndReading(strEnd);  nsCString::const_iterator nodeBegin(strBegin), nodeEnd(strEnd);  nsCString::const_iterator pos(strBegin);  nsCOMPtr<nsIFile> parentDir;  while (FindInReadable(kParentDirStr, nodeBegin, nodeEnd)) {    rv = targetFile->GetParent(getter_AddRefs(parentDir));    if (NS_FAILED(rv)) {      return rv;    }    if (!parentDir) {      return NS_ERROR_FILE_UNRECOGNIZED_PATH;    }    targetFile = parentDir;    nodeBegin = nodeEnd;    pos = nodeEnd;    nodeEnd = strEnd;  }  nodeBegin = nodeEnd = pos;  while (nodeEnd != strEnd) {    FindCharInReadable('/', nodeEnd, strEnd);    targetFile->Append(NS_ConvertUTF8toUTF16(Substring(nodeBegin, nodeEnd)));    if (nodeEnd != strEnd) { // If there's more left in the string, inc over the '/' nodeEnd is on.      ++nodeEnd;    }    nodeBegin = nodeEnd;  }  return InitWithFile(targetFile);}
开发者ID:afabbro,项目名称:gecko-dev,代码行数:51,


示例13: NS_ENSURE_FALSE

nsresultnsDASHWebMODParser::GetTime(nsAString& aTimeStr, double& aTime){  NS_ENSURE_FALSE(aTimeStr.IsEmpty(), NS_ERROR_NOT_INITIALIZED);  // Fail if time string is not of the format "PT<time>S".  NS_NAMED_LITERAL_STRING(prefix, "PT");  NS_NAMED_LITERAL_STRING(suffix, "S");  nsAString::const_iterator start, end, prefixStart, prefixEnd,                            suffixStart, suffixEnd;  // Search for "PT" at the start.  aTimeStr.BeginReading(start);  aTimeStr.EndReading(end);  prefixStart = start;  prefixEnd = end;  NS_ENSURE_TRUE(FindInReadable(prefix, prefixStart, prefixEnd),                 NS_ERROR_ILLEGAL_VALUE);  NS_ENSURE_TRUE(prefixStart == start, NS_ERROR_ILLEGAL_VALUE);  // Search for "S" after "PT".  suffixStart = prefixEnd;  suffixEnd = end;  NS_ENSURE_TRUE(FindInReadable(suffix, suffixStart, suffixEnd),                 NS_ERROR_ILLEGAL_VALUE);  NS_ENSURE_TRUE(suffixStart != prefixEnd, NS_ERROR_ILLEGAL_VALUE);  NS_ENSURE_TRUE(suffixEnd == end, NS_ERROR_ILLEGAL_VALUE);  // Parse inner substring for time.  const nsAutoString timeSubString(Substring(prefixEnd, suffixStart));  LOG("Parsing substring /"%s/" in /"%s/"",      NS_ConvertUTF16toUTF8(timeSubString).get(),      NS_ConvertUTF16toUTF8(aTimeStr).get());  NS_ENSURE_FALSE(timeSubString.IsEmpty(), NS_ERROR_ILLEGAL_VALUE);  nsresult rv;  aTime = timeSubString.ToDouble(&rv);  NS_ENSURE_SUCCESS(rv, rv);  return NS_OK;}
开发者ID:mikeaich,项目名称:releases-mozilla-central,代码行数:38,


示例14: ReplaceChar

static void ReplaceChar(nsCString& str, const nsACString& character,                        const nsACString& replacement){  nsCString::const_iterator start, end;  str.BeginReading(start);  str.EndReading(end);  while (FindInReadable(character, start, end)) {    PRInt32 pos = end.size_backward();    str.Replace(pos - 1, 1, replacement);    str.BeginReading(start);    start.advance(pos + replacement.Length() - 1);    str.EndReading(end);  }}
开发者ID:fortunto2,项目名称:celtx,代码行数:17,


示例15: ContainsTopLevelSubstring

/** * Determines whether or not a string exists as the root element in an XML data * string buffer. * @param   dataString *          The data being sniffed * @param   substring *          The substring being tested for existence and root-ness. * @returns true if the substring exists and is the documentElement, false *          otherwise. */static boolContainsTopLevelSubstring(nsACString& dataString, const char *substring) {  nsACString::const_iterator start, end;  dataString.BeginReading(start);  dataString.EndReading(end);  if (!FindInReadable(nsCString(substring), start, end)){    return false;  }  auto offset = start.get() - dataString.Data();  const char *begin = dataString.BeginReading();  // Only do the validation when we find the substring.  return IsDocumentElement(begin, begin + offset);}
开发者ID:InternalError503,项目名称:cyberfox,代码行数:28,


示例16:

boolnsPicoService::GetVoiceFileLanguage(const nsACString& aFileName, nsAString& aLang){  nsACString::const_iterator start, end;  aFileName.BeginReading(start);  aFileName.EndReading(end);  // The lingware filename syntax is language_(ta/sg).bin,  // we extract the language prefix here.  if (FindInReadable(NS_LITERAL_CSTRING("_"), start, end)) {    end = start;    aFileName.BeginReading(start);    aLang.Assign(NS_ConvertUTF8toUTF16(Substring(start, end)));    return true;  }  return false;}
开发者ID:LordJZ,项目名称:gecko-dev,代码行数:18,


示例17: NS_NAMED_LITERAL_CSTRING

PRBoolnsCoreUtils::IsErrorPage(nsIDocument *aDocument){  nsIURI *uri = aDocument->GetDocumentURI();  PRBool isAboutScheme = PR_FALSE;  uri->SchemeIs("about", &isAboutScheme);  if (!isAboutScheme)    return PR_FALSE;  nsCAutoString path;  uri->GetPath(path);  nsCAutoString::const_iterator start, end;  path.BeginReading(start);  path.EndReading(end);  NS_NAMED_LITERAL_CSTRING(neterror, "neterror");  return FindInReadable(neterror, start, end);}
开发者ID:LittleForker,项目名称:mozilla-central,代码行数:19,


示例18: InitGlobals

/* static */ eMATHVARIANTnsMathMLOperators::LookupInvariantChar(const nsAString& aChar){  if (!gInitialized) {    InitGlobals();  }  if (gInvariantCharArray) {    for (PRInt32 i = gInvariantCharArray->Length()-1; i >= 0; --i) {      const nsString& list = gInvariantCharArray->ElementAt(i);      nsString::const_iterator start, end;      list.BeginReading(start);      list.EndReading(end);      // Style-invariant characters are at offset 3*j + 1.      if (FindInReadable(aChar, start, end) &&          start.size_backward() % 3 == 1) {        return eMATHVARIANT(i);      }    }  }  return eMATHVARIANT_NONE;}
开发者ID:MozillaOnline,项目名称:gecko-dev,代码行数:21,


示例19: NS_LITERAL_STRING

/* static */already_AddRefed<MediaEncoder>MediaEncoder::CreateEncoder(const nsAString& aMIMEType){  nsAutoPtr<ContainerWriter> writer;  nsAutoPtr<AudioTrackEncoder> audioEncoder;  nsAutoPtr<VideoTrackEncoder> videoEncoder;  nsRefPtr<MediaEncoder> encoder;  if (aMIMEType.IsEmpty()) {    // TODO: Should pick out a default container+codec base on the track    //       coming from MediaStreamGraph. For now, just default to Ogg+Opus.    const_cast<nsAString&>(aMIMEType) = NS_LITERAL_STRING("audio/ogg");  }  bool isAudioOnly = FindInReadable(NS_LITERAL_STRING("audio/"), aMIMEType);#ifdef MOZ_OGG  if (IsOggType(aMIMEType)) {    writer = new OggWriter();    if (!isAudioOnly) {      // Initialize the videoEncoder.    }#ifdef MOZ_OPUS    audioEncoder = new OpusTrackEncoder();#endif  }#endif  // If the given mime-type is video but fail to create the video encoder.  if (!isAudioOnly) {    NS_ENSURE_TRUE(videoEncoder, nullptr);  }  // Return null if we fail to create the audio encoder.  NS_ENSURE_TRUE(audioEncoder, nullptr);  encoder = new MediaEncoder(writer.forget(), audioEncoder.forget(),                             videoEncoder.forget(), aMIMEType);  return encoder.forget();}
开发者ID:Nebelhom,项目名称:mozilla-central,代码行数:41,


示例20: ParseBody

  // The end of a body is marked by a CRLF followed by the boundary. So the  // CRLF is part of the boundary and not the body, but any prior CRLFs are  // part of the body. This will position the iterator at the beginning of the  // boundary (after the CRLF).  bool  ParseBody(const nsACString& aBoundaryString,            nsACString::const_iterator& aStart,            nsACString::const_iterator& aEnd)  {    const char* beginning = aStart.get();    // Find the boundary marking the end of the body.    nsACString::const_iterator end(aEnd);    if (!FindInReadable(aBoundaryString, aStart, end)) {      return false;    }    // We found a boundary, strip the just prior CRLF, and consider    // everything else the body section.    if (aStart.get() - beginning < 2) {      // Only the first entry can have a boundary right at the beginning. Even      // an empty body will have a CRLF before the boundary. So this is      // a failure.      return false;    }    // Check that there is a CRLF right before the boundary.    aStart.advance(-2);    // Skip optional hyphens.    if (*aStart == '-' && *(aStart.get()+1) == '-') {      if (aStart.get() - beginning < 2) {        return false;      }      aStart.advance(-2);    }    if (*aStart != nsCRT::CR || *(aStart.get()+1) != nsCRT::LF) {      return false;    }    nsAutoCString body(beginning, aStart.get() - beginning);    // Restore iterator to after the /r/n as we promised.    // We do not need to handle the extra hyphens case since our boundary    // parser in PushOverBoundary()    aStart.advance(2);    if (!mFormData) {      mFormData = new nsFormData();    }    NS_ConvertUTF8toUTF16 name(mName);    if (mFilename.IsVoid()) {      mFormData->Append(name, NS_ConvertUTF8toUTF16(body));    } else {      // Unfortunately we've to copy the data first since all our strings are      // going to free it. We also need fallible alloc, so we can't just use      // ToNewCString().      char* copy = static_cast<char*>(moz_xmalloc(body.Length()));      if (!copy) {        NS_WARNING("Failed to copy File entry body.");        return false;      }      nsCString::const_iterator bodyIter, bodyEnd;      body.BeginReading(bodyIter);      body.EndReading(bodyEnd);      char *p = copy;      while (bodyIter != bodyEnd) {        *p++ = *bodyIter++;      }      p = nullptr;      nsRefPtr<Blob> file =        File::CreateMemoryFile(mParentObject,                               reinterpret_cast<void *>(copy), body.Length(),                               NS_ConvertUTF8toUTF16(mFilename),                               NS_ConvertUTF8toUTF16(mContentType), /* aLastModifiedDate */ 0);      Optional<nsAString> dummy;      mFormData->Append(name, *file, dummy);    }    return true;  }
开发者ID:Jinwoo-Song,项目名称:gecko-dev,代码行数:86,


示例21: return

PRBoolLocalSearchDataSource::doMatch(nsIRDFLiteral *literal,                               const nsAString &matchMethod,                               const nsString &matchText){	PRBool		found = PR_FALSE;	if ((nsnull == literal) ||            matchMethod.IsEmpty() ||            matchText.IsEmpty())		return(found);	const	PRUnichar	*str = nsnull;	literal->GetValueConst( &str );	if (! str)	return(found);	nsAutoString	value(str);        if (matchMethod.EqualsLiteral("contains"))	{            if (FindInReadable(matchText, value,                               nsCaseInsensitiveStringComparator()))                found = PR_TRUE;	}        else if (matchMethod.EqualsLiteral("startswith"))	{            nsAString::const_iterator start, realstart, end;            value.BeginReading(start);            value.EndReading(end);            realstart = start;                        if (FindInReadable(matchText, start, end,                               nsCaseInsensitiveStringComparator()) &&                start == realstart)                                found = PR_TRUE;	}        else if (matchMethod.EqualsLiteral("endswith"))	{            nsAString::const_iterator start, end, realend;            value.BeginReading(start);            value.EndReading(end);            realend = end;            if (RFindInReadable(matchText, start, end,                                nsCaseInsensitiveStringComparator()) &&                end == realend)                                found = PR_TRUE;	}        else if (matchMethod.EqualsLiteral("is"))	{            if (value.Equals(matchText, nsCaseInsensitiveStringComparator()))                found = PR_TRUE;	}        else if (matchMethod.EqualsLiteral("isnot"))	{            if (!value.Equals(matchText, nsCaseInsensitiveStringComparator()))                found = PR_TRUE;	}        else if (matchMethod.EqualsLiteral("doesntcontain"))	{            if (!FindInReadable(matchText, value,                                nsCaseInsensitiveStringComparator()))                found = PR_TRUE;	}        return(found);}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:67,


示例22: switch

//.........这里部分代码省略.........        // String functions        case CONCAT:        {            nsRefPtr<StringResult> strRes;            rv = aContext->recycler()->getStringResult(getter_AddRefs(strRes));            NS_ENSURE_SUCCESS(rv, rv);            PRUint32 i, len = mParams.Length();            for (i = 0; i < len; ++i) {                rv = mParams[i]->evaluateToString(aContext, strRes->mValue);                NS_ENSURE_SUCCESS(rv, rv);            }            NS_ADDREF(*aResult = strRes);            return NS_OK;        }        case CONTAINS:        {            nsAutoString arg2;            rv = mParams[1]->evaluateToString(aContext, arg2);            NS_ENSURE_SUCCESS(rv, rv);            if (arg2.IsEmpty()) {                aContext->recycler()->getBoolResult(PR_TRUE, aResult);            }            else {                nsAutoString arg1;                rv = mParams[0]->evaluateToString(aContext, arg1);                NS_ENSURE_SUCCESS(rv, rv);                aContext->recycler()->getBoolResult(FindInReadable(arg2, arg1),                                                    aResult);            }            return NS_OK;        }        case NORMALIZE_SPACE:        {            nsAutoString resultStr;            if (!mParams.IsEmpty()) {                rv = mParams[0]->evaluateToString(aContext, resultStr);                NS_ENSURE_SUCCESS(rv, rv);            }            else {                txXPathNodeUtils::appendNodeValue(aContext->getContextNode(),                                                  resultStr);            }            nsRefPtr<StringResult> strRes;            rv = aContext->recycler()->getStringResult(getter_AddRefs(strRes));            NS_ENSURE_SUCCESS(rv, rv);            MBool addSpace = MB_FALSE;            MBool first = MB_TRUE;            strRes->mValue.SetCapacity(resultStr.Length());            PRUnichar c;            PRUint32 src;            for (src = 0; src < resultStr.Length(); src++) {                c = resultStr.CharAt(src);                if (XMLUtils::isWhitespace(c)) {                    addSpace = MB_TRUE;                }                else {
开发者ID:Akin-Net,项目名称:mozilla-central,代码行数:67,


示例23: do_QueryInterface

void ImageDocument::UpdateTitleAndCharset(){  nsAutoCString typeStr;  nsCOMPtr<imgIRequest> imageRequest;  nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(mImageContent);  if (imageLoader) {    imageLoader->GetRequest(nsIImageLoadingContent::CURRENT_REQUEST,                            getter_AddRefs(imageRequest));  }      if (imageRequest) {    nsXPIDLCString mimeType;    imageRequest->GetMimeType(getter_Copies(mimeType));    ToUpperCase(mimeType);    nsXPIDLCString::const_iterator start, end;    mimeType.BeginReading(start);    mimeType.EndReading(end);    nsXPIDLCString::const_iterator iter = end;    if (FindInReadable(NS_LITERAL_CSTRING("IMAGE/"), start, iter) &&         iter != end) {      // strip out "X-" if any      if (*iter == 'X') {        ++iter;        if (iter != end && *iter == '-') {          ++iter;          if (iter == end) {            // looks like "IMAGE/X-" is the type??  Bail out of here.            mimeType.BeginReading(iter);          }        } else {          --iter;        }      }      typeStr = Substring(iter, end);    } else {      typeStr = mimeType;    }  }  nsXPIDLString status;  if (mImageIsResized) {    nsAutoString ratioStr;    ratioStr.AppendInt(NSToCoordFloor(GetRatio() * 100));    const char16_t* formatString[1] = { ratioStr.get() };    mStringBundle->FormatStringFromName(MOZ_UTF16("ScaledImage"),                                        formatString, 1,                                        getter_Copies(status));  }  static const char* const formatNames[4] =   {    "ImageTitleWithNeitherDimensionsNorFile",    "ImageTitleWithoutDimensions",    "ImageTitleWithDimensions2",    "ImageTitleWithDimensions2AndFile",  };  MediaDocument::UpdateTitleAndCharset(typeStr, formatNames,                                       mImageWidth, mImageHeight, status);}
开发者ID:Balakrishnan-Vivek,项目名称:gecko-dev,代码行数:62,


示例24: GetThreadDescAtIndex

/* Astring getCellText (in long row, in nsITreeColumn col); */NS_IMETHODIMP nsCertTree::GetCellText(PRInt32 row, nsITreeColumn* col,                         nsAString& _retval){  if (!mTreeArray)    return NS_ERROR_NOT_INITIALIZED;  nsresult rv;  _retval.Truncate();  const PRUnichar* colID;  col->GetIdConst(&colID);  treeArrayEl *el = GetThreadDescAtIndex(row);  if (el != nsnull) {    if (NS_LITERAL_STRING("certcol").Equals(colID))      _retval.Assign(el->orgName);    else      _retval.Truncate();    return NS_OK;  }  PRInt32 absoluteCertOffset;  nsRefPtr<nsCertTreeDispInfo> certdi =     GetDispInfoAtIndex(row, &absoluteCertOffset);  if (!certdi)    return NS_ERROR_FAILURE;  nsCOMPtr<nsIX509Cert> cert = certdi->mCert;  if (!cert && certdi->mAddonInfo) {    cert = certdi->mAddonInfo->mCert;  }  PRInt32 colIndex;  col->GetIndex(&colIndex);  PRUint32 arrayIndex=absoluteCertOffset+colIndex*(mNumRows-mNumOrgs);  PRUint32 arrayLength=0;  if (mCellText) {    mCellText->GetLength(&arrayLength);  }  if (arrayIndex < arrayLength) {    nsCOMPtr<nsISupportsString> myString(do_QueryElementAt(mCellText, arrayIndex));    if (myString) {      myString->GetData(_retval);      return NS_OK;    }  }  if (NS_LITERAL_STRING("certcol").Equals(colID)) {    if (!cert) {      mNSSComponent->GetPIPNSSBundleString("CertNotStored", _retval);    }    else {      rv = cert->GetCommonName(_retval);      if (NS_FAILED(rv) || _retval.IsEmpty()) {        // kaie: I didn't invent the idea to cut off anything before         //       the first colon. :-)        nsAutoString nick;        rv = cert->GetNickname(nick);                nsAString::const_iterator start, end, end2;        nick.BeginReading(start);        nick.EndReading(end);        end2 = end;          if (FindInReadable(NS_LITERAL_STRING(":"), start, end)) {          // found. end points to the first char after the colon,          // that's what we want.          _retval = Substring(end, end2);        }        else {          _retval = nick;        }      }    }  } else if (NS_LITERAL_STRING("tokencol").Equals(colID) && cert) {    rv = cert->GetTokenName(_retval);  } else if (NS_LITERAL_STRING("emailcol").Equals(colID) && cert) {    rv = cert->GetEmailAddress(_retval);  } else if (NS_LITERAL_STRING("purposecol").Equals(colID) && mNSSComponent && cert) {    PRUint32 verified;    nsAutoString theUsages;    rv = cert->GetUsagesString(false, &verified, theUsages); // allow OCSP    if (NS_FAILED(rv)) {      verified = nsIX509Cert::NOT_VERIFIED_UNKNOWN;    }    switch (verified) {      case nsIX509Cert::VERIFIED_OK:        _retval = theUsages;        break;      case nsIX509Cert::CERT_REVOKED:        rv = mNSSComponent->GetPIPNSSBundleString("VerifyRevoked", _retval);        break;      case nsIX509Cert::CERT_EXPIRED:        rv = mNSSComponent->GetPIPNSSBundleString("VerifyExpired", _retval);        break;//.........这里部分代码省略.........
开发者ID:marshall,项目名称:mozilla-central,代码行数:101,


示例25: switch

//.........这里部分代码省略.........            case eLess:            case eGreater:            {                // non-numbers always compare false                nsresult err;                PRInt32 leftint = PromiseFlatString(aLeftString).ToInteger(&err);                if (NS_SUCCEEDED(err)) {                    PRInt32 rightint = PromiseFlatString(aRightString).ToInteger(&err);                    if (NS_SUCCEEDED(err)) {                        match = (mRelation == eLess) ? (leftint < rightint) :                                                       (leftint > rightint);                    }                }                break;            }            case eBefore:            {                nsICollation* collation = nsXULContentUtils::GetCollation();                if (collation) {                    PRInt32 sortOrder;                    collation->CompareString((mIgnoreCase ?                                              static_cast<PRInt32>(nsICollation::kCollationCaseInSensitive) :                                              static_cast<PRInt32>(nsICollation::kCollationCaseSensitive)),                                              aLeftString,                                              aRightString,                                              &sortOrder);                    match = (sortOrder < 0);                }                else if (mIgnoreCase) {                    match = (Compare(aLeftString, aRightString,                                     nsCaseInsensitiveStringComparator()) < 0);                }                else {                    match = (Compare(aLeftString, aRightString) < 0);                }                break;            }            case eAfter:            {                nsICollation* collation = nsXULContentUtils::GetCollation();                if (collation) {                    PRInt32 sortOrder;                    collation->CompareString((mIgnoreCase ?                                              static_cast<PRInt32>(nsICollation::kCollationCaseInSensitive) :                                              static_cast<PRInt32>(nsICollation::kCollationCaseSensitive)),                                              aLeftString,                                              aRightString,                                              &sortOrder);                    match = (sortOrder > 0);                }                else if (mIgnoreCase) {                    match = (Compare(aLeftString, aRightString,                                     nsCaseInsensitiveStringComparator()) > 0);                }                else {                    match = (Compare(aLeftString, aRightString) > 0);                }                break;            }            case eStartswith:                if (mIgnoreCase)                    match = (StringBeginsWith(aLeftString, aRightString,                                              nsCaseInsensitiveStringComparator()));                else                    match = (StringBeginsWith(aLeftString, aRightString));                break;            case eEndswith:                if (mIgnoreCase)                    match = (StringEndsWith(aLeftString, aRightString,                                            nsCaseInsensitiveStringComparator()));                else                    match = (StringEndsWith(aLeftString, aRightString));                break;            case eContains:            {                nsAString::const_iterator start, end;                aLeftString.BeginReading(start);                aLeftString.EndReading(end);                if (mIgnoreCase)                    match = CaseInsensitiveFindInReadable(aRightString, start, end);                else                    match = FindInReadable(aRightString, start, end);                break;            }            default:                break;        }    }    if (mNegate) match = !match;    return match;}
开发者ID:FunkyVerb,项目名称:devtools-window,代码行数:101,


示例26: MakeScopeExit

Maybe<bool>Compatibility::OnUIAMessage(WPARAM aWParam, LPARAM aLParam){  auto clearUiaRemotePid = MakeScopeExit([]() {    sUiaRemotePid = Nothing();  });  Telemetry::AutoTimer<Telemetry::A11Y_UIA_DETECTION_TIMING_MS> timer;  // UIA creates a section containing the substring "HOOK_SHMEM_"  NS_NAMED_LITERAL_STRING(kStrHookShmem, "HOOK_SHMEM_");  // The section name always ends with this suffix, which is derived from the  // current thread id and the UIA message's WPARAM and LPARAM.  nsAutoString partialSectionSuffix;  partialSectionSuffix.AppendPrintf("_%08x_%08x_%08x", ::GetCurrentThreadId(),                                    static_cast<DWORD>(aLParam), aWParam);  // Find any named Section that matches the naming convention of the UIA shared  // memory.  nsAutoHandle section;  auto comparator = [&](const nsDependentSubstring& aName,                        const nsDependentSubstring& aType) -> bool {    if (aType.Equals(NS_LITERAL_STRING("Section")) &&        FindInReadable(kStrHookShmem, aName) &&        StringEndsWith(aName, partialSectionSuffix)) {      section.own(::OpenFileMapping(GENERIC_READ, FALSE,                                    PromiseFlatString(aName).get()));      return false;    }    return true;  };  if (!FindNamedObject(comparator) || !section) {    return Nothing();  }  NTSTATUS ntStatus;  // First we must query for a list of all the open handles in the system.  UniquePtr<char[]> handleInfoBuf;  ULONG handleInfoBufLen = sizeof(SYSTEM_HANDLE_INFORMATION_EX) +                           1024 * sizeof(SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX);  // We must query for handle information in a loop, since we are effectively  // asking the kernel to take a snapshot of all the handles on the system;  // the size of the required buffer may fluctuate between successive calls.  while (true) {    // These allocations can be hundreds of megabytes on some computers, so    // we should use fallible new here.    handleInfoBuf = MakeUniqueFallible<char[]>(handleInfoBufLen);    if (!handleInfoBuf) {      return Nothing();    }    ntStatus = ::NtQuerySystemInformation(                 (SYSTEM_INFORMATION_CLASS) SystemExtendedHandleInformation,                 handleInfoBuf.get(), handleInfoBufLen, &handleInfoBufLen);    if (ntStatus == STATUS_INFO_LENGTH_MISMATCH) {      continue;    }    if (!NT_SUCCESS(ntStatus)) {      return Nothing();    }    break;  }  const DWORD ourPid = ::GetCurrentProcessId();  Maybe<PVOID> kernelObject;  static Maybe<USHORT> sectionObjTypeIndex;  nsTHashtable<nsUint32HashKey> nonSectionObjTypes;  nsDataHashtable<nsVoidPtrHashKey, DWORD> objMap;  auto handleInfo = reinterpret_cast<SYSTEM_HANDLE_INFORMATION_EX*>(handleInfoBuf.get());  for (ULONG index = 0; index < handleInfo->mHandleCount; ++index) {    SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX& curHandle = handleInfo->mHandles[index];    HANDLE handle = reinterpret_cast<HANDLE>(curHandle.mHandle);    // The mapping of the curHandle.mObjectTypeIndex field depends on the    // underlying OS kernel. As we scan through the handle list, we record the    // type indices such that we may use those values to skip over handles that    // refer to non-section objects.    if (sectionObjTypeIndex) {      // If we know the type index for Sections, that's the fastest check...      if (sectionObjTypeIndex.value() != curHandle.mObjectTypeIndex) {        // Not a section        continue;      }    } else if (nonSectionObjTypes.Contains(static_cast<uint32_t>(                                             curHandle.mObjectTypeIndex))) {      // Otherwise we check whether or not the object type is definitely _not_      // a Section...      continue;    } else if (ourPid == curHandle.mPid) {      // Otherwise we need to issue some system calls to find out the object//.........这里部分代码省略.........
开发者ID:nils-ohlmeier,项目名称:gecko-dev,代码行数:101,


示例27: channel

//.........这里部分代码省略.........  if (scheme.EqualsLiteral("view-source")) {    sniffedType.Truncate();    return NS_OK;  }  // Check the Content-Type to see if it is set correctly. If it is set to   // something specific that we think is a reliable indication of a feed, don't  // bother sniffing since we assume the site maintainer knows what they're   // doing.   nsAutoCString contentType;  channel->GetContentType(contentType);  bool noSniff = contentType.EqualsLiteral(TYPE_RSS) ||                   contentType.EqualsLiteral(TYPE_ATOM);  // Check to see if this was a feed request from the location bar or from  // the feed: protocol. This is also a reliable indication.  // The value of the header doesn't matter.    if (!noSniff) {    nsAutoCString sniffHeader;    nsresult foundHeader =      channel->GetRequestHeader(NS_LITERAL_CSTRING("X-Moz-Is-Feed"),                                sniffHeader);    noSniff = NS_SUCCEEDED(foundHeader);  }  if (noSniff) {    // check for an attachment after we have a likely feed.    if(HasAttachmentDisposition(channel)) {      sniffedType.Truncate();      return NS_OK;    }    // set the feed header as a response header, since we have good metadata    // telling us that the feed is supposed to be RSS or Atom    channel->SetResponseHeader(NS_LITERAL_CSTRING("X-Moz-Is-Feed"),                               NS_LITERAL_CSTRING("1"), false);    sniffedType.AssignLiteral(TYPE_MAYBE_FEED);    return NS_OK;  }  // Don't sniff arbitrary types.  Limit sniffing to situations that  // we think can reasonably arise.  if (!contentType.EqualsLiteral(TEXT_HTML) &&      !contentType.EqualsLiteral(APPLICATION_OCTET_STREAM) &&      // Same criterion as XMLHttpRequest.  Should we be checking for "+xml"      // and check for text/xml and application/xml by hand instead?      contentType.Find("xml") == -1) {    sniffedType.Truncate();    return NS_OK;  }  // Now we need to potentially decompress data served with   // Content-Encoding: gzip  nsresult rv = ConvertEncodedData(request, data, length);  if (NS_FAILED(rv))    return rv;  // We cap the number of bytes to scan at MAX_BYTES to prevent picking up   // false positives by accidentally reading document content, e.g. a "how to  // make a feed" page.  const char* testData;  if (mDecodedData.IsEmpty()) {    testData = (const char*)data;    length = std::min(length, MAX_BYTES);  } else {    testData = mDecodedData.get();    length = std::min(mDecodedData.Length(), MAX_BYTES);  }  // The strategy here is based on that described in:  // http://blogs.msdn.com/rssteam/articles/PublishersGuide.aspx  // for interoperarbility purposes.  // Thus begins the actual sniffing.  nsDependentCSubstring dataString((const char*)testData, length);  bool isFeed = false;  // RSS 0.91/0.92/2.0  isFeed = ContainsTopLevelSubstring(dataString, "<rss");  // Atom 1.0  if (!isFeed)    isFeed = ContainsTopLevelSubstring(dataString, "<feed");  // RSS 1.0  if (!isFeed) {    bool foundNS_RDF = FindInReadable(NS_LITERAL_CSTRING(NS_RDF), dataString);    bool foundNS_RSS = FindInReadable(NS_LITERAL_CSTRING(NS_RSS), dataString);    isFeed = ContainsTopLevelSubstring(dataString, "<rdf:RDF") &&      foundNS_RDF && foundNS_RSS;  }  // If we sniffed a feed, coerce our internal type  if (isFeed && !HasAttachmentDisposition(channel))    sniffedType.AssignLiteral(TYPE_MAYBE_FEED);  else    sniffedType.Truncate();  return NS_OK;}
开发者ID:InternalError503,项目名称:cyberfox,代码行数:101,



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


C++ FindIndex函数代码示例
C++ FindFunction函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。