#ifndef WebIDBKey_h
#define WebIDBKey_h
#include "WebCommon.h"
#include "WebPrivatePtr.h"
#include "WebString.h"
namespace WebCore { class IDBKey; }
namespace WebKit {
class WebIDBKeyPath;
class WebSerializedScriptValue;
class WebIDBKey {
public:
WebIDBKey() { }
~WebIDBKey() { reset(); }
WEBKIT_API static WebIDBKey createNull();
WEBKIT_API static WebIDBKey createString(const WebString&);
WEBKIT_API static WebIDBKey createDate(double);
WEBKIT_API static WebIDBKey createNumber(double);
WEBKIT_API static WebIDBKey createInvalid();
WEBKIT_API static WebIDBKey createFromValueAndKeyPath(const WebSerializedScriptValue&, const WebIDBKeyPath&);
WEBKIT_API static WebSerializedScriptValue injectIDBKeyIntoSerializedValue(const WebIDBKey&, const WebSerializedScriptValue&, const WebIDBKeyPath&);
WebIDBKey(const WebIDBKey& e) { assign(e); }
WebIDBKey& operator=(const WebIDBKey& e)
{
assign(e);
return *this;
}
WEBKIT_API void assign(const WebIDBKey&);
WEBKIT_API void assignNull();
WEBKIT_API void assignString(const WebString&);
WEBKIT_API void assignDate(double);
WEBKIT_API void assignNumber(double);
WEBKIT_API void assignInvalid();
WEBKIT_API void reset();
enum Type {
NullType = 0,
StringType,
DateType,
NumberType,
InvalidType
};
WEBKIT_API Type type() const;
WEBKIT_API WebString string() const; WEBKIT_API double date() const; WEBKIT_API double number() const;
#if WEBKIT_IMPLEMENTATION
WebIDBKey(const WTF::PassRefPtr<WebCore::IDBKey>&);
WebIDBKey& operator=(const WTF::PassRefPtr<WebCore::IDBKey>&);
operator WTF::PassRefPtr<WebCore::IDBKey>() const;
#endif
private:
WebPrivatePtr<WebCore::IDBKey> m_private;
};
}
#endif // WebIDBKey_h