#ifndef IDBIndex_h
#define IDBIndex_h
#include "IDBCursor.h"
#include "IDBIndexBackendInterface.h"
#include "IDBKeyRange.h"
#include "IDBRequest.h"
#include "PlatformString.h"
#include <wtf/Forward.h>
#if ENABLE(INDEXED_DATABASE)
namespace WebCore {
class IDBObjectStore;
class IDBIndex : public RefCounted<IDBIndex> {
public:
static PassRefPtr<IDBIndex> create(PassRefPtr<IDBIndexBackendInterface> backend, IDBObjectStore* objectStore, IDBTransaction* transaction)
{
return adoptRef(new IDBIndex(backend, objectStore, transaction));
}
~IDBIndex();
String name() const { return m_backend->name(); }
IDBObjectStore* objectStore() const { return m_objectStore.get(); }
String keyPath() const { return m_backend->keyPath(); }
bool unique() const { return m_backend->unique(); }
PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, ExceptionCode& ec) { return openCursor(context, 0, ec); }
PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> keyRange, ExceptionCode& ec) { return openCursor(context, keyRange, IDBCursor::NEXT, ec); }
PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, PassRefPtr<IDBKeyRange>, unsigned short direction, ExceptionCode&);
PassRefPtr<IDBRequest> openKeyCursor(ScriptExecutionContext* context, ExceptionCode& ec) { return openKeyCursor(context, 0, ec); }
PassRefPtr<IDBRequest> openKeyCursor(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> keyRange, ExceptionCode& ec) { return openKeyCursor(context, keyRange, IDBCursor::NEXT, ec); }
PassRefPtr<IDBRequest> openKeyCursor(ScriptExecutionContext*, PassRefPtr<IDBKeyRange>, unsigned short direction, ExceptionCode&);
PassRefPtr<IDBRequest> get(ScriptExecutionContext*, PassRefPtr<IDBKey>, ExceptionCode&);
PassRefPtr<IDBRequest> getKey(ScriptExecutionContext*, PassRefPtr<IDBKey>, ExceptionCode&);
private:
IDBIndex(PassRefPtr<IDBIndexBackendInterface>, IDBObjectStore*, IDBTransaction*);
RefPtr<IDBIndexBackendInterface> m_backend;
RefPtr<IDBObjectStore> m_objectStore;
RefPtr<IDBTransaction> m_transaction;
};
}
#endif
#endif // IDBIndex_h