#pragma once
#if ENABLE(INDEXED_DATABASE)
#include "ScriptWrappable.h"
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
namespace JSC {
class ExecState;
class JSValue;
}
namespace WebCore {
class IDBKey;
class ScriptExecutionContext;
typedef int ExceptionCode;
class IDBKeyRange : public ScriptWrappable, public RefCounted<IDBKeyRange> {
public:
static Ref<IDBKeyRange> create(RefPtr<IDBKey>&& lower, RefPtr<IDBKey>&& upper, bool isLowerOpen, bool isUpperOpen);
static Ref<IDBKeyRange> create(RefPtr<IDBKey>&&);
~IDBKeyRange();
IDBKey* lower() const { return m_lower.get(); }
IDBKey* upper() const { return m_upper.get(); }
bool lowerOpen() const { return m_isLowerOpen; }
bool upperOpen() const { return m_isUpperOpen; }
static RefPtr<IDBKeyRange> only(RefPtr<IDBKey>&& value, ExceptionCode&);
static RefPtr<IDBKeyRange> only(JSC::ExecState&, JSC::JSValue key, ExceptionCode&);
static RefPtr<IDBKeyRange> lowerBound(JSC::ExecState&, JSC::JSValue bound, bool open, ExceptionCode&);
static RefPtr<IDBKeyRange> upperBound(JSC::ExecState&, JSC::JSValue bound, bool open, ExceptionCode&);
static RefPtr<IDBKeyRange> bound(JSC::ExecState&, JSC::JSValue lower, JSC::JSValue upper, bool lowerOpen, bool upperOpen, ExceptionCode&);
static RefPtr<IDBKeyRange> only(ScriptExecutionContext&, JSC::JSValue key, ExceptionCode&);
WEBCORE_EXPORT bool isOnlyKey() const;
private:
IDBKeyRange(RefPtr<IDBKey>&& lower, RefPtr<IDBKey>&& upper, bool isLowerOpen, bool isUpperOpen);
RefPtr<IDBKey> m_lower;
RefPtr<IDBKey> m_upper;
bool m_isLowerOpen;
bool m_isUpperOpen;
};
}
#endif