Bug 316732 - Allow for hashing on nsIFile by introducing a new nsIHashable interface and implementing it for the file types r=darin

This commit is contained in:
bsmedberg@covad.net
2005-11-18 14:18:49 +00:00
parent e393344be3
commit ecab683408
9 changed files with 191 additions and 3 deletions

View File

@@ -1750,6 +1750,28 @@ nsLocalFile::GetTarget(nsAString &_retval)
{
GET_UCS(GetNativeTarget, _retval);
}
// nsIHashable
NS_IMETHODIMP
nsLocalFile::Equals(nsIHashable* aOther, PRBool *aResult)
{
nsCOMPtr<nsIFile> otherFile(do_QueryInterface(aOther));
if (!otherFile) {
*aResult = PR_FALSE;
return NS_OK;
}
return Equals(otherFile, aResult);
}
NS_IMETHODIMP
nsLocalFile::GetHashCode(PRUint32 *aResult)
{
*aResult = nsCRT::HashCode(mPath.get());
return NS_OK;
}
nsresult
NS_NewLocalFile(const nsAString &path, PRBool followLinks, nsILocalFile* *result)
{