本文整理汇总了C++中nsString::Equals方法的典型用法代码示例。如果您正苦于以下问题:C++ nsString::Equals方法的具体用法?C++ nsString::Equals怎么用?C++ nsString::Equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsString
的用法示例。
在下文中一共展示了nsString::Equals方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
NS_IMETHODIMP
TestObserver::Observe(nsISupports *aSubject,
const char *aTopic,
const char16_t *someData ) {
mObservations++;
sTotalObservations++;
if (!mExpectedData.IsEmpty()) {
EXPECT_TRUE(mExpectedData.Equals(someData));
}
return NS_OK;
}
示例2: ToUpperCase
mozEnglishWordUtils::myspCapitalization
mozEnglishWordUtils::captype(const nsString &word)
{
char16_t* lword=ToNewUnicode(word);
ToUpperCase(lword,lword,word.Length());
if(word.Equals(lword)){
free(lword);
return AllCap;
}
ToLowerCase(lword,lword,word.Length());
if(word.Equals(lword)){
free(lword);
return NoCap;
}
int32_t length=word.Length();
if(Substring(word,1,length-1).Equals(lword+1)){
free(lword);
return InitCap;
}
free(lword);
return HuhCap;
}
示例3: data
// nsIObserver
NS_IMETHODIMP
GMPRemoveTest::Observe(nsISupports* aSubject, const char* aTopic,
const char16_t* aData)
{
EXPECT_TRUE(!strcmp(GMP_DELETED_TOPIC, aTopic));
nsString data(aData);
if (mTmpPath.Equals(data)) {
mTestMonitor.SetFinished();
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
obs->RemoveObserver(this, GMP_DELETED_TOPIC);
}
return NS_OK;
}
示例4:
mozEnglishWordUtils::myspCapitalization
mozEnglishWordUtils::captype(const nsString &word)
{
if(!mCaseConv) return HuhCap; //punt
PRUnichar* lword=ToNewUnicode(word);
mCaseConv->ToUpper(lword,lword,word.Length());
if(word.Equals(lword)){
nsMemory::Free(lword);
return AllCap;
}
mCaseConv->ToLower(lword,lword,word.Length());
if(word.Equals(lword)){
nsMemory::Free(lword);
return NoCap;
}
PRInt32 length=word.Length();
if(Substring(word,1,length-1).Equals(lword+1)){
nsMemory::Free(lword);
return InitCap;
}
nsMemory::Free(lword);
return HuhCap;
}
示例5: VerifyUserName
PRBool nsMapiHook::VerifyUserName(const nsString& aUsername, nsCString& aIdKey)
{
nsresult rv;
if (aUsername.IsEmpty())
return PR_FALSE;
nsCOMPtr<nsIMsgAccountManager> accountManager(do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv));
if (NS_FAILED(rv)) return PR_FALSE;
nsCOMPtr<nsISupportsArray> identities;
rv = accountManager->GetAllIdentities(getter_AddRefs(identities));
if (NS_FAILED(rv)) return PR_FALSE;
PRUint32 numIndentities;
identities->Count(&numIndentities);
for (PRUint32 i = 0; i < numIndentities; i++)
{
// convert supports->Identity
nsCOMPtr<nsISupports> thisSupports;
rv = identities->GetElementAt(i, getter_AddRefs(thisSupports));
if (NS_FAILED(rv)) continue;
nsCOMPtr<nsIMsgIdentity> thisIdentity(do_QueryInterface(thisSupports, &rv));
if (NS_SUCCEEDED(rv) && thisIdentity)
{
nsCString email;
rv = thisIdentity->GetEmail(email);
if (NS_FAILED(rv)) continue;
// get the username from the email and compare with the username
PRInt32 index = email.FindChar('@');
if (index != -1)
email.SetLength(index);
if (aUsername.Equals(NS_ConvertASCIItoUTF16(email)))
return NS_SUCCEEDED(thisIdentity->GetKey(aIdKey));
}
}
return PR_FALSE;
}
示例6: defined
int32_t
GfxInfoBase::FindBlocklistedDeviceInList(const nsTArray<GfxDriverInfo>& info,
nsAString& aSuggestedVersion,
int32_t aFeature,
nsACString& aFailureId,
OperatingSystem os)
{
int32_t status = nsIGfxInfo::FEATURE_STATUS_UNKNOWN;
uint32_t i = 0;
for (; i < info.Length(); i++) {
// Do the operating system check first, no point in getting the driver
// info if we won't need to use it. If the OS of the system we are running
// on is unknown, we still let DRIVER_OS_ALL catch and disable it;
// if the OS of the downloadable entry is unknown, we skip the entry
// as invalid.
if (info[i].mOperatingSystem == DRIVER_OS_UNKNOWN ||
(info[i].mOperatingSystem != DRIVER_OS_ALL &&
info[i].mOperatingSystem != os))
{
continue;
}
if (info[i].mOperatingSystemVersion && info[i].mOperatingSystemVersion != OperatingSystemVersion()) {
continue;
}
// XXX: it would be better not to do this everytime round the loop
nsAutoString adapterVendorID;
nsAutoString adapterDeviceID;
nsAutoString adapterDriverVersionString;
if (info[i].mGpu2) {
if (NS_FAILED(GetAdapterVendorID2(adapterVendorID)) ||
NS_FAILED(GetAdapterDeviceID2(adapterDeviceID)) ||
NS_FAILED(GetAdapterDriverVersion2(adapterDriverVersionString)))
{
return 0;
}
} else {
if (NS_FAILED(GetAdapterVendorID(adapterVendorID)) ||
NS_FAILED(GetAdapterDeviceID(adapterDeviceID)) ||
NS_FAILED(GetAdapterDriverVersion(adapterDriverVersionString)))
{
return 0;
}
}
#if defined(XP_WIN) || defined(ANDROID)
uint64_t driverVersion;
ParseDriverVersion(adapterDriverVersionString, &driverVersion);
#endif
if (!info[i].mAdapterVendor.Equals(GfxDriverInfo::GetDeviceVendor(VendorAll), nsCaseInsensitiveStringComparator()) &&
!info[i].mAdapterVendor.Equals(adapterVendorID, nsCaseInsensitiveStringComparator())) {
continue;
}
if (info[i].mDevices != GfxDriverInfo::allDevices && info[i].mDevices->Length()) {
bool deviceMatches = false;
for (uint32_t j = 0; j < info[i].mDevices->Length(); j++) {
if ((*info[i].mDevices)[j].Equals(adapterDeviceID, nsCaseInsensitiveStringComparator())) {
deviceMatches = true;
break;
}
}
if (!deviceMatches) {
continue;
}
}
bool match = false;
if (!info[i].mHardware.IsEmpty() && !info[i].mHardware.Equals(Hardware())) {
continue;
}
if (!info[i].mModel.IsEmpty() && !info[i].mModel.Equals(Model())) {
continue;
}
if (!info[i].mProduct.IsEmpty() && !info[i].mProduct.Equals(Product())) {
continue;
}
if (!info[i].mManufacturer.IsEmpty() && !info[i].mManufacturer.Equals(Manufacturer())) {
continue;
}
#if defined(XP_WIN) || defined(ANDROID)
switch (info[i].mComparisonOp) {
case DRIVER_LESS_THAN:
match = driverVersion < info[i].mDriverVersion;
break;
case DRIVER_LESS_THAN_OR_EQUAL:
match = driverVersion <= info[i].mDriverVersion;
break;
case DRIVER_GREATER_THAN:
match = driverVersion > info[i].mDriverVersion;
break;
case DRIVER_GREATER_THAN_OR_EQUAL:
match = driverVersion >= info[i].mDriverVersion;
break;
//.........这里部分代码省略.........
示例7: return
bool operator== (const Scene_SceneEntry& entry) {
return (bool) id.Equals(entry.id);
}
示例8: Equals
PRBool FontAliasKey::Equals(const nsHashKey *aKey) const
{
return mString.Equals(((FontAliasKey*)aKey)->mString, nsCaseInsensitiveStringComparator());
}