本文整理汇总了C++中FindInReadable函数的典型用法代码示例。如果您正苦于以下问题:C++ FindInReadable函数的具体用法?C++ FindInReadable怎么用?C++ FindInReadable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FindInReadable函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: nsAccessKeyInfo
void
nsTextBoxFrame::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,代码来源:nsTextBoxFrame.cpp
示例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,代码来源:VideoUtils.cpp
示例3: start
// static
Modifiers
UIEvent::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,代码来源:UIEvent.cpp
示例4:
nsresult
nsAboutCache::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,代码来源:nsAboutCache.cpp
示例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,代码来源:Fetch.cpp
示例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,代码来源:Fetch.cpp
示例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,代码来源:nsExceptionHandler.cpp
示例8: FindCharInReadable
nsresult
nsAboutCacheEntry::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,代码来源:nsAboutCacheEntry.cpp
示例9: AttrHasSubstring
static bool
AttrHasSubstring(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,代码来源:ServoBindings.cpp
示例10: FindInReadable
// the following block is to append the accesskey to mTitle if there is an accesskey
// but the mTitle doesn't have the character
void
nsTextBoxFrame::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,代码来源:nsTextBoxFrame.cpp
示例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,代码来源:nsMailboxService.cpp
示例12: NS_NAMED_LITERAL_CSTRING
NS_IMETHODIMP
nsLocalFile::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,代码来源:nsLocalFileCommon.cpp
示例13: NS_ENSURE_FALSE
nsresult
nsDASHWebMODParser::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,代码来源:nsDASHWebMODParser.cpp
示例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,代码来源:nsExceptionHandler.cpp
示例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 bool
ContainsTopLevelSubstring(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,代码来源:nsFeedSniffer.cpp
示例16:
bool
nsPicoService::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,代码来源:nsPicoService.cpp
示例17: NS_NAMED_LITERAL_CSTRING
PRBool
nsCoreUtils::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,代码来源:nsCoreUtils.cpp
示例18: InitGlobals
/* static */ eMATHVARIANT
nsMathMLOperators::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,代码来源:nsMathMLOperators.cpp
示例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,代码来源:MediaEncoder.cpp
示例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,代码来源:Fetch.cpp
注:本文中的FindInReadable函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论