/* 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;
}
Esempio n. 2
0
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);
}
Esempio n. 4
0
/* 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();
}