/* boolean hasMoreElements (); */ NS_IMETHODIMP nsDocShellEnumerator::HasMoreElements(PRBool *outHasMore) { NS_ENSURE_ARG_POINTER(outHasMore); *outHasMore = PR_FALSE; nsresult rv = EnsureDocShellArray(); if (NS_FAILED(rv)) return rv; *outHasMore = (mCurIndex < mItemArray.Length()); return NS_OK; }
NS_IMETHODIMP nsDocShellEnumerator::HasMoreElements(bool* aResult) { NS_ENSURE_ARG_POINTER(aResult); *aResult = false; nsresult rv = EnsureDocShellArray(); if (NS_FAILED(rv)) { return rv; } *aResult = (mCurIndex < mItemArray.Length()); return NS_OK; }
/* nsISupports getNext (); */ NS_IMETHODIMP nsDocShellEnumerator::GetNext(nsISupports **outCurItem) { NS_ENSURE_ARG_POINTER(outCurItem); *outCurItem = nsnull; nsresult rv = EnsureDocShellArray(); if (NS_FAILED(rv)) return rv; if (mCurIndex >= mItemArray.Length()) { return NS_ERROR_FAILURE; } // post-increment is important here return CallQueryInterface(mItemArray[mCurIndex++], outCurItem); }
/* nsISupports getNext (); */ NS_IMETHODIMP nsDocShellEnumerator::GetNext(nsISupports **outCurItem) { NS_ENSURE_ARG_POINTER(outCurItem); *outCurItem = nullptr; nsresult rv = EnsureDocShellArray(); if (NS_FAILED(rv)) return rv; if (mCurIndex >= mItemArray.Length()) { return NS_ERROR_FAILURE; } // post-increment is important here nsCOMPtr<nsISupports> item = do_QueryReferent(mItemArray[mCurIndex++], &rv); item.forget(outCurItem); return rv; }
nsresult nsDocShellEnumerator::First() { mCurIndex = 0; return EnsureDocShellArray(); }