Fixed Has method as per Doug's request.

This commit is contained in:
warren%netscape.com 2000-01-06 23:02:32 +00:00
Родитель 73f81425cc
Коммит 91ee8e32c4
3 изменённых файлов: 10 добавлений и 16 удалений

Просмотреть файл

@ -55,10 +55,9 @@ interface nsIProperties : nsISupports
void set(in string prop, in nsISupports value);
/**
* Returns true if the property with the given name exists with
* the given value.
* Returns true if the property with the given name exists.
*/
boolean has(in string prop, in nsIIDRef uuid, in nsISupports value);
boolean has(in string prop);
};
%{C++

Просмотреть файл

@ -341,8 +341,7 @@ nsPersistentProperties::Set(const char* prop, nsISupports* value)
}
NS_IMETHODIMP
nsPersistentProperties::Has(const char* prop, const nsIID & uuid,
nsISupports* expectedValue, PRBool *result)
nsPersistentProperties::Has(const char* prop, PRBool *result)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -136,18 +136,14 @@ nsProperties::Set(const char* prop, nsISupports* value)
}
NS_IMETHODIMP
nsProperties::Has(const char* prop, const nsIID & uuid,
nsISupports* expectedValue, PRBool *result)
nsProperties::Has(const char* prop, PRBool *result)
{
nsCOMPtr<nsISupports> value;
nsresult rv = Get(prop, uuid, getter_AddRefs(value));
if (NS_SUCCEEDED(rv)) {
if (value.get() == expectedValue) {
*result = PR_TRUE;
return NS_OK;
}
}
*result = PR_FALSE;
nsStringKey key(prop);
nsISupports* value = (nsISupports*)nsHashtable::Get(&key);
// XXX this is bogus because it doesn't distinguish between properties
// defined with a value NULL, and undefined properties, but we'll fix
// it later if it becomes a problem
*result = value != nsnull;
return NS_OK;
}