WebDOMTestException.cpp [plain text]
#include "config.h"
#include "WebDOMTestException.h"
#include "KURL.h"
#include "TestException.h"
#include "WebDOMString.h"
#include "WebExceptionHandler.h"
#include "wtf/text/AtomicString.h"
#include <wtf/GetPtr.h>
#include <wtf/RefPtr.h>
struct WebDOMTestException::WebDOMTestExceptionPrivate {
WebDOMTestExceptionPrivate(WebCore::TestException* object = 0)
: impl(object)
{
}
RefPtr<WebCore::TestException> impl;
};
WebDOMTestException::WebDOMTestException()
: WebDOMObject()
, m_impl(0)
{
}
WebDOMTestException::WebDOMTestException(WebCore::TestException* impl)
: WebDOMObject()
, m_impl(new WebDOMTestExceptionPrivate(impl))
{
}
WebDOMTestException::WebDOMTestException(const WebDOMTestException& copy)
: WebDOMObject()
{
m_impl = copy.impl() ? new WebDOMTestExceptionPrivate(copy.impl()) : 0;
}
WebDOMTestException& WebDOMTestException::operator=(const WebDOMTestException& copy)
{
delete m_impl;
m_impl = copy.impl() ? new WebDOMTestExceptionPrivate(copy.impl()) : 0;
return *this;
}
WebCore::TestException* WebDOMTestException::impl() const
{
return m_impl ? WTF::getPtr(m_impl->impl) : 0;
}
WebDOMTestException::~WebDOMTestException()
{
delete m_impl;
m_impl = 0;
}
WebDOMString WebDOMTestException::name() const
{
if (!impl())
return WebDOMString();
return static_cast<const WTF::String&>(impl()->name());
}
WebCore::TestException* toWebCore(const WebDOMTestException& wrapper)
{
return wrapper.impl();
}
WebDOMTestException toWebKit(WebCore::TestException* value)
{
return WebDOMTestException(value);
}