This source file includes following definitions.
- create
- create
- createNull
- assign
- reset
- isValid
- keyPathType
- array
- string
#include "config.h"
#include "public/platform/WebIDBKeyPath.h"
#include "public/platform/WebString.h"
#include "public/platform/WebVector.h"
#include "wtf/Vector.h"
#include "modules/indexeddb/IDBKeyPath.h"
using namespace WebCore;
namespace blink {
WebIDBKeyPath WebIDBKeyPath::create(const WebString& keyPath)
{
return WebIDBKeyPath(IDBKeyPath(keyPath));
}
WebIDBKeyPath WebIDBKeyPath::create(const WebVector<WebString>& keyPath)
{
Vector<String> strings;
for (size_t i = 0; i < keyPath.size(); ++i)
strings.append(keyPath[i]);
return WebIDBKeyPath(IDBKeyPath(strings));
}
WebIDBKeyPath WebIDBKeyPath::createNull()
{
return WebIDBKeyPath(IDBKeyPath());
}
void WebIDBKeyPath::assign(const WebIDBKeyPath& keyPath)
{
ASSERT(keyPath.m_private.get());
m_private.reset(new IDBKeyPath(keyPath));
}
void WebIDBKeyPath::reset()
{
m_private.reset(0);
}
bool WebIDBKeyPath::isValid() const
{
ASSERT(m_private.get());
return m_private->isValid();
}
WebIDBKeyPathType WebIDBKeyPath::keyPathType() const
{
ASSERT(m_private.get());
return static_cast<WebIDBKeyPathType>(m_private->type());
}
WebVector<WebString> WebIDBKeyPath::array() const
{
ASSERT(m_private.get());
ASSERT(m_private->type() == IDBKeyPath::ArrayType);
return m_private->array();
}
WebString WebIDBKeyPath::string() const
{
ASSERT(m_private.get());
ASSERT(m_private->type() == IDBKeyPath::StringType);
return m_private->string();
}
WebIDBKeyPath::WebIDBKeyPath(const WebCore::IDBKeyPath& value)
: m_private(new IDBKeyPath(value))
{
ASSERT(m_private.get());
}
WebIDBKeyPath& WebIDBKeyPath::operator=(const WebCore::IDBKeyPath& value)
{
ASSERT(m_private.get());
m_private.reset(new IDBKeyPath(value));
return *this;
}
WebIDBKeyPath::operator const WebCore::IDBKeyPath&() const
{
ASSERT(m_private.get());
return *(m_private.get());
}
}