rv = ds->GetAllCmds(source, getter_AddRefs(dsCmds)); if (NS_SUCCEEDED(rv)) { PRBool	hasMore = PR_FALSE; while(NS_SUCCEEDED(rv = dsCmds->HasMoreElements(&hasMore)) && (hasMore == PR_TRUE)) { nsCOMPtr<nsISupports>	item; if (NS_SUCCEEDED(rv = dsCmds->GetNext(getter_AddRefs(item)))) {   cmdArray->AppendElement(item); } } if (NS_FAILED(rv))	return(rv); } } nsISimpleEnumerator	*commands = new nsArrayEnumerator(cmdArray); if (! commands) return(NS_ERROR_OUT_OF_MEMORY); NS_ADDREF(commands); *result = commands; return(NS_OK);
rv = mDataSources[i]->GetAllCmds(source, getter_AddRefs(dsCmds)); if (NS_SUCCEEDED(rv)) { PRBool	hasMore = PR_FALSE; while(NS_SUCCEEDED(rv = dsCmds->HasMoreElements(&hasMore)) && (hasMore == PR_TRUE)) { nsCOMPtr<nsISupports>	item; if (NS_SUCCEEDED(rv = dsCmds->GetNext(getter_AddRefs(item)))) {   cmdArray->AppendElement(item); } } if (NS_FAILED(rv)) return(rv); } }  return NS_NewArrayEnumerator(result, cmdArray);
CompositeDataSourceImpl::GetAllCmds(nsIRDFResource* source,                                        nsISimpleEnumerator/*<nsIRDFResource>*/** result){	nsCOMPtr<nsISupportsArray>	cmdArray;	nsresult			rv;	rv = NS_NewISupportsArray(getter_AddRefs(cmdArray));	if (NS_FAILED(rv)) return(rv);	for (PRInt32 i = 0; i < mDataSources.Count(); i++)	{		nsIRDFDataSource		*ds = NS_STATIC_CAST(nsIRDFDataSource*, mDataSources[i]);		nsCOMPtr<nsISimpleEnumerator>	dsCmds;		rv = ds->GetAllCmds(source, getter_AddRefs(dsCmds));		if (NS_SUCCEEDED(rv))		{			PRBool	hasMore = PR_FALSE;			while(NS_SUCCEEDED(rv = dsCmds->HasMoreElements(&hasMore)) && (hasMore == PR_TRUE))			{				nsCOMPtr<nsISupports>	item;				if (NS_SUCCEEDED(rv = dsCmds->GetNext(getter_AddRefs(item))))				{					// rjc: do NOT strip out duplicate commands here					// (due to items such as separators, it is done at a higher level)					cmdArray->AppendElement(item);				}			}			if (NS_FAILED(rv))	return(rv);		}	}	nsISimpleEnumerator	*commands = new nsArrayEnumerator(cmdArray);	if (! commands)		return(NS_ERROR_OUT_OF_MEMORY);	NS_ADDREF(commands);	*result = commands;	return(NS_OK);}