本文整理汇总了C++中nsACString::CharAt方法的典型用法代码示例。如果您正苦于以下问题:C++ nsACString::CharAt方法的具体用法?C++ nsACString::CharAt怎么用?C++ nsACString::CharAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsACString
的用法示例。
在下文中一共展示了nsACString::CharAt方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
NS_IMETHODIMP
nsNNTPNewsgroupList::ProcessHEADLine(const nsACString &line)
{
int32_t colon = line.FindChar(':');
nsCString header = PromiseFlatCString(line), value;
if (colon != -1)
{
value = Substring(line, colon+1);
header.SetLength((uint32_t)colon);
}
else if (line.CharAt(0) == ' ' || line.CharAt(0) == '\t') // We are continuing the header
{
m_thisLine += header; // Preserve whitespace (should we?)
return NS_OK;
}
else
{
return NS_OK; // We are malformed. Just ignore and hope for the best...
}
nsresult rv;
if (!m_lastHeader.IsEmpty())
{
rv = AddHeader(m_lastHeader.get(), m_thisLine.get());
NS_ENSURE_SUCCESS(rv,rv);
}
value.Trim(" ");
ToLowerCase(header, m_lastHeader);
m_thisLine.Assign(value);
return NS_OK;
}
示例2: switch
void
nsCertOverride::convertStringToBits(const nsACString& str,
/*out*/ OverrideBits& ob)
{
ob = OverrideBits::None;
for (uint32_t i = 0; i < str.Length(); i++) {
switch (str.CharAt(i)) {
case 'm':
case 'M':
ob |= OverrideBits::Mismatch;
break;
case 'u':
case 'U':
ob |= OverrideBits::Untrusted;
break;
case 't':
case 'T':
ob |= OverrideBits::Time;
break;
default:
break;
}
}
}
示例3:
NS_IMETHODIMP
FontTableURIProtocolHandler::NewURI(const nsACString& aSpec,
const char* aCharset, nsIURI* aBaseURI,
nsIURI** aResult) {
nsresult rv;
nsCOMPtr<nsIURI> uri;
// Either you got here via a ref or a fonttable: uri
if (aSpec.Length() && aSpec.CharAt(0) == '#') {
rv = NS_MutateURI(aBaseURI).SetRef(aSpec).Finalize(uri);
NS_ENSURE_SUCCESS(rv, rv);
} else {
// Relative URIs (other than #ref) are not meaningful within the
// fonttable: scheme.
// If aSpec is a relative URI -other- than a bare #ref,
// this will leave uri empty, and we'll return a failure code below.
rv = NS_MutateURI(new mozilla::net::nsSimpleURI::Mutator())
.SetSpec(aSpec)
.Finalize(uri);
NS_ENSURE_SUCCESS(rv, rv);
}
bool schemeIs;
if (NS_FAILED(uri->SchemeIs(FONTTABLEURI_SCHEME, &schemeIs)) || !schemeIs) {
NS_WARNING("Non-fonttable spec in FontTableURIProtocolHandler");
return NS_ERROR_NOT_AVAILABLE;
}
uri.forget(aResult);
return NS_OK;
}
示例4: nsSimpleURI
NS_IMETHODIMP
nsFontTableProtocolHandler::NewURI(const nsACString& aSpec,
const char *aCharset,
nsIURI *aBaseURI,
nsIURI **aResult)
{
nsRefPtr<nsIURI> uri;
// Either you got here via a ref or a fonttable: uri
if (aSpec.Length() && aSpec.CharAt(0) == '#') {
nsresult rv = aBaseURI->CloneIgnoringRef(getter_AddRefs(uri));
NS_ENSURE_SUCCESS(rv, rv);
uri->SetRef(aSpec);
} else {
// Relative URIs (other than #ref) are not meaningful within the
// fonttable: scheme.
// If aSpec is a relative URI -other- than a bare #ref,
// this will leave uri empty, and we'll return a failure code below.
uri = new nsSimpleURI();
uri->SetSpec(aSpec);
}
bool schemeIs;
if (NS_FAILED(uri->SchemeIs(FONTTABLEURI_SCHEME, &schemeIs)) || !schemeIs) {
NS_WARNING("Non-fonttable spec in nsFontTableProtocolHander");
return NS_ERROR_NOT_AVAILABLE;
}
uri.forget(aResult);
return NS_OK;
}
示例5: flags
static nsMsgSearchOpValue
ConvertSearchFlagsToOperator(const nsACString &aFlags)
{
nsCString flags(aFlags);
int32_t lastTabPosition = flags.RFindChar('\t');
if ((lastTabPosition == -1) ||
((int32_t)aFlags.Length() == lastTabPosition - 1)) {
return -1;
}
switch (aFlags.CharAt(0)) {
case 'X':
return nsMsgSearchOp::DoesntContain;
case 'O':
if (aFlags.FindChar('T', lastTabPosition + 1) >= 0)
return nsMsgSearchOp::BeginsWith;
return nsMsgSearchOp::Contains;
default:
return -1;
}
}