本文整理汇总了C++中nsACString::Equals方法的典型用法代码示例。如果您正苦于以下问题:C++ nsACString::Equals方法的具体用法?C++ nsACString::Equals怎么用?C++ nsACString::Equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsACString
的用法示例。
在下文中一共展示了nsACString::Equals方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetSubstitution
nsresult
nsResProtocolHandler::SetSubstitution(const nsACString& aRoot, nsIURI* aBaseURI)
{
MOZ_ASSERT(!aRoot.Equals(""));
MOZ_ASSERT(!aRoot.Equals(kAPP));
MOZ_ASSERT(!aRoot.Equals(kGRE));
return SubstitutingProtocolHandler::SetSubstitution(aRoot, aBaseURI);
}
示例2: AssembleCacheKey
nsresult _OldStorage::AssembleCacheKey(nsIURI *aURI,
nsACString const & aIdExtension,
nsACString & aCacheKey,
nsACString & aScheme)
{
// Copied from nsHttpChannel::AssembleCacheKey
aCacheKey.Truncate();
nsresult rv;
rv = aURI->GetScheme(aScheme);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoCString uriSpec;
if (aScheme.Equals(NS_LITERAL_CSTRING("http")) ||
aScheme.Equals(NS_LITERAL_CSTRING("https"))) {
if (mLoadInfo->IsAnonymous()) {
aCacheKey.AssignLiteral("anon&");
}
if (!aIdExtension.IsEmpty()) {
aCacheKey.AppendPrintf("id=%s&", aIdExtension.BeginReading());
}
nsCOMPtr<nsIURI> noRefURI;
rv = aURI->CloneIgnoringRef(getter_AddRefs(noRefURI));
NS_ENSURE_SUCCESS(rv, rv);
rv = noRefURI->GetAsciiSpec(uriSpec);
NS_ENSURE_SUCCESS(rv, rv);
if (!aCacheKey.IsEmpty()) {
aCacheKey.AppendLiteral("uri=");
}
}
else if (aScheme.Equals(NS_LITERAL_CSTRING("wyciwyg"))) {
rv = aURI->GetSpec(uriSpec);
NS_ENSURE_SUCCESS(rv, rv);
}
else {
rv = aURI->GetAsciiSpec(uriSpec);
NS_ENSURE_SUCCESS(rv, rv);
}
aCacheKey.Append(uriSpec);
return NS_OK;
}
示例3: SetScheme
NS_IMETHODIMP nsLDAPURL::SetScheme(const nsACString &aScheme)
{
if (!mBaseURL)
return NS_ERROR_NOT_INITIALIZED;
if (aScheme.Equals(LDAP_SCHEME, nsCaseInsensitiveCStringComparator()))
mOptions &= !OPT_SECURE;
else if (aScheme.Equals(LDAP_SSL_SCHEME,
nsCaseInsensitiveCStringComparator()))
mOptions |= OPT_SECURE;
else
return NS_ERROR_MALFORMED_URI;
return mBaseURL->SetScheme(aScheme);
}
示例4: if
bool
nsResProtocolHandler::ResolveSpecialCases(const nsACString& aHost,
const nsACString& aPath,
nsACString& aResult)
{
if (aHost.Equals("") || aHost.Equals(kAPP)) {
aResult.Assign(mAppURI);
} else if (aHost.Equals(kGRE)) {
aResult.Assign(mGREURI);
} else {
return false;
}
aResult.Append(aPath);
return true;
}
示例5: GetPreferredInternal
//--------------------------------------------------------------
// static
nsresult
nsCharsetAlias::Equals(const nsACString& aCharset1,
const nsACString& aCharset2, bool* oResult)
{
nsresult res = NS_OK;
if(aCharset1.Equals(aCharset2, nsCaseInsensitiveCStringComparator())) {
*oResult = true;
return res;
}
if(aCharset1.IsEmpty() || aCharset2.IsEmpty()) {
*oResult = false;
return res;
}
*oResult = false;
nsCAutoString name1;
res = GetPreferredInternal(aCharset1, name1);
if (NS_FAILED(res))
return res;
nsCAutoString name2;
res = GetPreferredInternal(aCharset2, name2);
if (NS_FAILED(res))
return res;
*oResult = name1.Equals(name2);
return NS_OK;
}
示例6:
//--------------------------------------------------------------
NS_IMETHODIMP
nsCharsetAlias2::Equals(const nsACString& aCharset1,
const nsACString& aCharset2, PRBool* oResult)
{
nsresult res = NS_OK;
if(aCharset1.Equals(aCharset2, nsCaseInsensitiveCStringComparator())) {
*oResult = PR_TRUE;
return res;
}
if(aCharset1.IsEmpty() || aCharset2.IsEmpty()) {
*oResult = PR_FALSE;
return res;
}
*oResult = PR_FALSE;
nsCAutoString name1;
nsCAutoString name2;
res = this->GetPreferred(aCharset1, name1);
if(NS_SUCCEEDED(res)) {
res = this->GetPreferred(aCharset2, name2);
if(NS_SUCCEEDED(res)) {
*oResult = name1.Equals(name2, nsCaseInsensitiveCStringComparator());
}
}
return res;
}
示例7:
NS_IMETHODIMP
calIcalComponent::GetNextProperty(const nsACString &kind, calIIcalProperty **prop)
{
NS_ENSURE_ARG_POINTER(prop);
icalproperty_kind propkind =
icalproperty_string_to_kind(PromiseFlatCString(kind).get());
if (propkind == ICAL_NO_PROPERTY)
return NS_ERROR_INVALID_ARG;
icalproperty *icalprop = nullptr;
if (propkind == ICAL_X_PROPERTY) {
for (icalprop =
icalcomponent_get_next_property(mComponent, ICAL_X_PROPERTY);
icalprop;
icalprop = icalcomponent_get_next_property(mComponent,
ICAL_X_PROPERTY)) {
if (kind.Equals(icalproperty_get_x_name(icalprop)))
break;
}
} else {
icalprop = icalcomponent_get_next_property(mComponent, propkind);
}
if (!icalprop) {
*prop = nullptr;
return NS_OK;
}
*prop = new calIcalProperty(icalprop, this);
CAL_ENSURE_MEMORY(*prop);
NS_ADDREF(*prop);
return NS_OK;
}
示例8: if
nsresult
SpdyInformation::GetNPNVersionIndex(const nsACString &npnString,
uint8_t *result)
{
if (npnString.IsEmpty())
return NS_ERROR_FAILURE;
if (npnString.Equals(VersionString[0]))
*result = Version[0];
else if (npnString.Equals(VersionString[1]))
*result = Version[1];
else
return NS_ERROR_FAILURE;
return NS_OK;
}
示例9:
// Synchronously consume the given input stream and validate the resulting data
// against the given string of expected values.
void
ConsumeAndValidateStream(nsIInputStream* aStream,
const nsACString& aExpectedData)
{
nsAutoCString outputData;
nsresult rv = NS_ConsumeStream(aStream, UINT32_MAX, outputData);
ASSERT_TRUE(NS_SUCCEEDED(rv));
ASSERT_EQ(aExpectedData.Length(), outputData.Length());
ASSERT_TRUE(aExpectedData.Equals(outputData));
}
示例10:
// searches against the short queue name
PRInt32
tmTransactionService::GetQueueID(const nsACString & aDomainName) {
PRUint32 size = mQueueMaps.Size();
tm_queue_mapping *qmap = nsnull;
for (PRUint32 index = 0; index < size; index++) {
qmap = (tm_queue_mapping*) mQueueMaps[index];
if (qmap && aDomainName.Equals(qmap->domainName))
return qmap->queueID;
}
return TM_NO_ID;
}
示例11: nsCaseInsensitiveCStringComparator
NS_IMETHODIMP
nsViewSourceChannel::GetResponseHeader(const nsACString & aHeader,
nsACString & aValue)
{
aValue.Truncate();
if (!mHttpChannel)
return NS_ERROR_NULL_POINTER;
if (!aHeader.Equals(NS_LITERAL_CSTRING("Content-Type"),
nsCaseInsensitiveCStringComparator()) &&
!aHeader.Equals(NS_LITERAL_CSTRING("Content-Security-Policy"),
nsCaseInsensitiveCStringComparator()) &&
!aHeader.Equals(NS_LITERAL_CSTRING("Content-Security-Policy-Report-Only"),
nsCaseInsensitiveCStringComparator()) &&
!aHeader.Equals(NS_LITERAL_CSTRING("X-Frame-Options"),
nsCaseInsensitiveCStringComparator())) {
return NS_OK;
}
return mHttpChannel->GetResponseHeader(aHeader, aValue);
}
示例12:
bool
nsGSettingsCollection::KeyExists(const nsACString& aKey)
{
if (!mKeys)
mKeys = g_settings_list_keys(mSettings);
for (PRUint32 i = 0; mKeys[i] != NULL; i++) {
if (aKey.Equals(mKeys[i]))
return true;
}
return false;
}
示例13:
nsresult
SpdyInformation::GetNPNVersionIndex(const nsACString &npnString,
uint8_t *result)
{
if (npnString.IsEmpty())
return NS_ERROR_FAILURE;
for (uint32_t index = 0; index < kCount; ++index) {
if (npnString.Equals(VersionString[index])) {
*result = Version[index];
return NS_OK;
}
}
return NS_ERROR_FAILURE;
}
示例14: DefaultPort
nsHttpConnectionInfo::nsHttpConnectionInfo(const nsACString &originHost,
int32_t originPort,
const nsACString &npnToken,
const nsACString &username,
nsProxyInfo *proxyInfo,
const NeckoOriginAttributes &originAttributes,
const nsACString &routedHost,
int32_t routedPort)
{
mEndToEndSSL = true; // so DefaultPort() works
mRoutedPort = routedPort == -1 ? DefaultPort() : routedPort;
if (!originHost.Equals(routedHost) || (originPort != routedPort)) {
mRoutedHost = routedHost;
}
Init(originHost, originPort, npnToken, username, proxyInfo, originAttributes, true);
}
示例15: nsGSettingsCollection
NS_IMETHODIMP
nsGSettingsService::GetCollectionForSchema(const nsACString& schema,
nsIGSettingsCollection** collection)
{
NS_ENSURE_ARG_POINTER(collection);
const char * const *schemas = g_settings_list_schemas();
for (PRUint32 i = 0; schemas[i] != NULL; i++) {
if (schema.Equals(schemas[i])) {
GSettings *settings = g_settings_new(PromiseFlatCString(schema).get());
nsGSettingsCollection *mozGSettings = new nsGSettingsCollection(settings);
NS_ADDREF(*collection = mozGSettings);
return NS_OK;
}
}
return NS_ERROR_FAILURE;
}