#ifndef IDBIndexInfo_h
#define IDBIndexInfo_h
#if ENABLE(INDEXED_DATABASE)
#include "IDBKeyPath.h"
#include <wtf/text/WTFString.h>
namespace WebCore {
class IDBIndexInfo {
public:
WEBCORE_EXPORT IDBIndexInfo();
IDBIndexInfo(uint64_t identifier, uint64_t objectStoreIdentifier, const String& name, const IDBKeyPath&, bool unique, bool multiEntry);
IDBIndexInfo isolatedCopy() const;
uint64_t identifier() const { return m_identifier; }
uint64_t objectStoreIdentifier() const { return m_objectStoreIdentifier; }
const String& name() const { return m_name; }
const IDBKeyPath& keyPath() const { return m_keyPath; }
bool unique() const { return m_unique; }
bool multiEntry() const { return m_multiEntry; }
template<class Encoder> void encode(Encoder&) const;
template<class Decoder> static bool decode(Decoder&, IDBIndexInfo&);
#if !LOG_DISABLED
String loggingString(int indent = 0) const;
#endif
static const int64_t InvalidId = -1;
private:
uint64_t m_identifier { 0 };
uint64_t m_objectStoreIdentifier { 0 };
String m_name;
IDBKeyPath m_keyPath;
bool m_unique { true };
bool m_multiEntry { false };
};
template<class Encoder>
void IDBIndexInfo::encode(Encoder& encoder) const
{
encoder << m_identifier << m_objectStoreIdentifier << m_name << m_keyPath << m_unique << m_multiEntry;
}
template<class Decoder>
bool IDBIndexInfo::decode(Decoder& decoder, IDBIndexInfo& info)
{
if (!decoder.decode(info.m_identifier))
return false;
if (!decoder.decode(info.m_objectStoreIdentifier))
return false;
if (!decoder.decode(info.m_name))
return false;
if (!decoder.decode(info.m_keyPath))
return false;
if (!decoder.decode(info.m_unique))
return false;
if (!decoder.decode(info.m_multiEntry))
return false;
return true;
}
}
#endif // ENABLE(INDEXED_DATABASE)
#endif // IDBIndexInfo_h