/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsISupports.idl"

interface nsIIDBRequest;

/**
 * IDBCursor interface.  See
 * http://dev.w3.org/2006/webapi/WebSimpleDB/#idl-def-IDBCursor for more
 * information.
 */
[scriptable, builtinclass, uuid(01136b3a-d84c-487c-b929-f5d012346c44)]
interface nsIIDBCursor : nsISupports
{
  // "next", "nextunique", "prev" or "prevunique"
  readonly attribute DOMString direction;

  readonly attribute nsISupports source;

  [implicit_jscontext]
  readonly attribute jsval key;

  [implicit_jscontext]
  readonly attribute jsval primaryKey;

  // Calling continue means that the same onsuccess function will be called
  // again with the new key/value (or null if no more matches).
  [implicit_jscontext]
  void continue([optional /* undefined */] in jsval key);

  // Success fires IDBTransactionEvent, result == key
  [implicit_jscontext]
  nsIIDBRequest update(in jsval value);

  // Success fires IDBTransactionEvent, result == null
  [implicit_jscontext]
  nsIIDBRequest delete();

  void
  advance(in long count);
};
