#pragma once
#if ENABLE(INDEXED_DATABASE)
#include "ExceptionOr.h"
#include "ScriptWrappable.h"
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
namespace JSC {
class ExecState;
class JSValue;
}
namespace WebCore {
class IDBKey;
class ScriptExecutionContext;
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 ExceptionOr<Ref<IDBKeyRange>> only(RefPtr<IDBKey>&& value);
static ExceptionOr<Ref<IDBKeyRange>> only(JSC::ExecState&, JSC::JSValue key);
static ExceptionOr<Ref<IDBKeyRange>> lowerBound(JSC::ExecState&, JSC::JSValue bound, bool open);
static ExceptionOr<Ref<IDBKeyRange>> upperBound(JSC::ExecState&, JSC::JSValue bound, bool open);
static ExceptionOr<Ref<IDBKeyRange>> bound(JSC::ExecState&, JSC::JSValue lower, JSC::JSValue upper, bool lowerOpen, bool upperOpen);
ExceptionOr<bool> includes(JSC::ExecState&, JSC::JSValue key);
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