WebKitDOMTestInterface.cpp [plain text]
#include "config.h"
#include "WebKitDOMTestInterface.h"
#include "DOMObjectCache.h"
#include "ExceptionCode.h"
#include "JSMainThreadExecState.h"
#include "Node.h"
#include "TestInterface.h"
#include "TestObj.h"
#include "TestSupplemental.h"
#include "WebKitDOMBinding.h"
#include "gobject/ConvertToUTF8String.h"
#include "webkit/WebKitDOMNode.h"
#include "webkit/WebKitDOMNodePrivate.h"
#include "webkit/WebKitDOMTestInterfacePrivate.h"
#include "webkit/WebKitDOMTestObj.h"
#include "webkit/WebKitDOMTestObjPrivate.h"
#include "webkitdefines.h"
#include "webkitglobalsprivate.h"
#include "webkitmarshal.h"
#include <glib-object.h>
#include <wtf/GetPtr.h>
#include <wtf/RefPtr.h>
#if ENABLE(Condition1) || ENABLE(Condition2)
namespace WebKit {
WebKitDOMTestInterface* kit(WebCore::TestInterface* obj)
{
g_return_val_if_fail(obj, 0);
if (gpointer ret = DOMObjectCache::get(obj))
return static_cast<WebKitDOMTestInterface*>(ret);
return static_cast<WebKitDOMTestInterface*>(DOMObjectCache::put(obj, WebKit::wrapTestInterface(obj)));
}
WebCore::TestInterface* core(WebKitDOMTestInterface* request)
{
g_return_val_if_fail(request, 0);
WebCore::TestInterface* coreObject = static_cast<WebCore::TestInterface*>(WEBKIT_DOM_OBJECT(request)->coreObject);
g_return_val_if_fail(coreObject, 0);
return coreObject;
}
WebKitDOMTestInterface* wrapTestInterface(WebCore::TestInterface* coreObject)
{
g_return_val_if_fail(coreObject, 0);
coreObject->ref();
return WEBKIT_DOM_TEST_INTERFACE(g_object_new(WEBKIT_TYPE_DOM_TEST_INTERFACE, "core-object", coreObject, NULL));
}
}
#endif // ENABLE(Condition1) || ENABLE(Condition2)
G_DEFINE_TYPE(WebKitDOMTestInterface, webkit_dom_test_interface, WEBKIT_TYPE_DOM_OBJECT)
enum {
PROP_0,
PROP_SUPPLEMENTAL_STR1,
PROP_SUPPLEMENTAL_STR2,
PROP_SUPPLEMENTAL_NODE,
};
static void webkit_dom_test_interface_finalize(GObject* object)
{
#if ENABLE(Condition1) || ENABLE(Condition2)
WebKitDOMObject* domObject = WEBKIT_DOM_OBJECT(object);
if (domObject->coreObject) {
WebCore::TestInterface* coreObject = static_cast<WebCore::TestInterface*>(domObject->coreObject);
WebKit::DOMObjectCache::forget(coreObject);
coreObject->deref();
domObject->coreObject = 0;
}
#endif // ENABLE(Condition1) || ENABLE(Condition2)
G_OBJECT_CLASS(webkit_dom_test_interface_parent_class)->finalize(object);
}
static void webkit_dom_test_interface_set_property(GObject* object, guint propertyId, const GValue* value, GParamSpec* pspec)
{
WebCore::JSMainThreadNullState state;
WebKitDOMTestInterface* self = WEBKIT_DOM_TEST_INTERFACE(object);
WebCore::TestInterface* coreSelf = WebKit::core(self);
switch (propertyId) {
case PROP_SUPPLEMENTAL_STR2: {
#if ENABLE(Condition1) || ENABLE(Condition2)
#if ENABLE(Condition11) || ENABLE(Condition12)
WebCore::TestSupplemental::setSupplementalStr2(coreSelf, WTF::String::fromUTF8(g_value_get_string(value)));
#else
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition11")
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition12")
#endif
#else
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1")
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2")
#endif
break;
}
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, pspec);
break;
}
}
static void webkit_dom_test_interface_get_property(GObject* object, guint propertyId, GValue* value, GParamSpec* pspec)
{
WebCore::JSMainThreadNullState state;
WebKitDOMTestInterface* self = WEBKIT_DOM_TEST_INTERFACE(object);
WebCore::TestInterface* coreSelf = WebKit::core(self);
switch (propertyId) {
case PROP_SUPPLEMENTAL_STR1: {
#if ENABLE(Condition1) || ENABLE(Condition2)
#if ENABLE(Condition11) || ENABLE(Condition12)
g_value_take_string(value, convertToUTF8String(WebCore::TestSupplemental::supplementalStr1(coreSelf)));
#else
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition11")
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition12")
#endif
#else
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1")
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2")
#endif
break;
}
case PROP_SUPPLEMENTAL_STR2: {
#if ENABLE(Condition1) || ENABLE(Condition2)
#if ENABLE(Condition11) || ENABLE(Condition12)
g_value_take_string(value, convertToUTF8String(WebCore::TestSupplemental::supplementalStr2(coreSelf)));
#else
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition11")
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition12")
#endif
#else
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1")
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2")
#endif
break;
}
case PROP_SUPPLEMENTAL_NODE: {
#if ENABLE(Condition1) || ENABLE(Condition2)
#if ENABLE(Condition11) || ENABLE(Condition12)
RefPtr<WebCore::Node> ptr = WebCore::TestSupplemental::supplementalNode(coreSelf);
g_value_set_object(value, WebKit::kit(ptr.get()));
#else
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition11")
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition12")
#endif
#else
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1")
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2")
#endif
break;
}
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, pspec);
break;
}
}
static void webkit_dom_test_interface_constructed(GObject* object)
{
if (G_OBJECT_CLASS(webkit_dom_test_interface_parent_class)->constructed)
G_OBJECT_CLASS(webkit_dom_test_interface_parent_class)->constructed(object);
}
static void webkit_dom_test_interface_class_init(WebKitDOMTestInterfaceClass* requestClass)
{
GObjectClass* gobjectClass = G_OBJECT_CLASS(requestClass);
gobjectClass->finalize = webkit_dom_test_interface_finalize;
gobjectClass->set_property = webkit_dom_test_interface_set_property;
gobjectClass->get_property = webkit_dom_test_interface_get_property;
gobjectClass->constructed = webkit_dom_test_interface_constructed;
g_object_class_install_property(gobjectClass,
PROP_SUPPLEMENTAL_STR1,
g_param_spec_string("supplemental-str1",
"test_interface_supplemental-str1",
"read-only gchar* TestInterface.supplemental-str1",
"",
WEBKIT_PARAM_READABLE));
g_object_class_install_property(gobjectClass,
PROP_SUPPLEMENTAL_STR2,
g_param_spec_string("supplemental-str2",
"test_interface_supplemental-str2",
"read-write gchar* TestInterface.supplemental-str2",
"",
WEBKIT_PARAM_READWRITE));
g_object_class_install_property(gobjectClass,
PROP_SUPPLEMENTAL_NODE,
g_param_spec_object("supplemental-node",
"test_interface_supplemental-node",
"read-write WebKitDOMNode* TestInterface.supplemental-node",
WEBKIT_TYPE_DOM_NODE,
WEBKIT_PARAM_READWRITE));
}
static void webkit_dom_test_interface_init(WebKitDOMTestInterface* request)
{
}
void
webkit_dom_test_interface_supplemental_method1(WebKitDOMTestInterface* self)
{
#if ENABLE(Condition1) || ENABLE(Condition2)
#if ENABLE(Condition11) || ENABLE(Condition12)
g_return_if_fail(self);
WebCore::JSMainThreadNullState state;
WebCore::TestInterface* item = WebKit::core(self);
WebCore::TestSupplemental::supplementalMethod1(item);
#else
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition11")
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition12")
#endif
#else
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1")
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2")
#endif
}
WebKitDOMTestObj*
webkit_dom_test_interface_supplemental_method2(WebKitDOMTestInterface* self, const gchar* strArg, WebKitDOMTestObj* objArg, GError** error)
{
#if ENABLE(Condition1) || ENABLE(Condition2)
#if ENABLE(Condition11) || ENABLE(Condition12)
g_return_val_if_fail(self, 0);
WebCore::JSMainThreadNullState state;
WebCore::TestInterface* item = WebKit::core(self);
g_return_val_if_fail(strArg, 0);
g_return_val_if_fail(objArg, 0);
WTF::String convertedStrArg = WTF::String::fromUTF8(strArg);
WebCore::TestObj* convertedObjArg = 0;
if (objArg) {
convertedObjArg = WebKit::core(objArg);
g_return_val_if_fail(convertedObjArg, 0);
}
WebCore::ExceptionCode ec = 0;
RefPtr<WebCore::TestObj> gobjectResult = WTF::getPtr(WebCore::TestSupplemental::supplementalMethod2(item, convertedStrArg, convertedObjArg, ec));
if (ec) {
WebCore::ExceptionCodeDescription ecdesc(ec);
g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name);
}
WebKitDOMTestObj* result = WebKit::kit(gobjectResult.get());
return result;
#else
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition11")
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition12")
return 0;
#endif
#else
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1")
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2")
return 0;
#endif
}
void
webkit_dom_test_interface_supplemental_method4(WebKitDOMTestInterface* self)
{
#if ENABLE(Condition1) || ENABLE(Condition2)
#if ENABLE(Condition11) || ENABLE(Condition12)
g_return_if_fail(self);
WebCore::JSMainThreadNullState state;
WebCore::TestInterface* item = WebKit::core(self);
WebCore::TestSupplemental::supplementalMethod4(item);
#else
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition11")
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition12")
#endif
#else
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1")
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2")
#endif
}
gchar*
webkit_dom_test_interface_get_supplemental_str1(WebKitDOMTestInterface* self)
{
#if ENABLE(Condition1) || ENABLE(Condition2)
#if ENABLE(Condition11) || ENABLE(Condition12)
g_return_val_if_fail(self, 0);
WebCore::JSMainThreadNullState state;
WebCore::TestInterface* item = WebKit::core(self);
gchar* result = convertToUTF8String(WebCore::TestSupplemental::supplementalStr1(item));
return result;
#else
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition11")
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition12")
return 0;
#endif
#else
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1")
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2")
return 0;
#endif
}
gchar*
webkit_dom_test_interface_get_supplemental_str2(WebKitDOMTestInterface* self)
{
#if ENABLE(Condition1) || ENABLE(Condition2)
#if ENABLE(Condition11) || ENABLE(Condition12)
g_return_val_if_fail(self, 0);
WebCore::JSMainThreadNullState state;
WebCore::TestInterface* item = WebKit::core(self);
gchar* result = convertToUTF8String(WebCore::TestSupplemental::supplementalStr2(item));
return result;
#else
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition11")
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition12")
return 0;
#endif
#else
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1")
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2")
return 0;
#endif
}
void
webkit_dom_test_interface_set_supplemental_str2(WebKitDOMTestInterface* self, const gchar* value)
{
#if ENABLE(Condition1) || ENABLE(Condition2)
#if ENABLE(Condition11) || ENABLE(Condition12)
g_return_if_fail(self);
WebCore::JSMainThreadNullState state;
WebCore::TestInterface* item = WebKit::core(self);
g_return_if_fail(value);
WTF::String convertedValue = WTF::String::fromUTF8(value);
WebCore::TestSupplemental::setSupplementalStr2(item, convertedValue);
#else
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition11")
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition12")
#endif
#else
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1")
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2")
#endif
}
WebKitDOMNode*
webkit_dom_test_interface_get_supplemental_node(WebKitDOMTestInterface* self)
{
#if ENABLE(Condition1) || ENABLE(Condition2)
#if ENABLE(Condition11) || ENABLE(Condition12)
g_return_val_if_fail(self, 0);
WebCore::JSMainThreadNullState state;
WebCore::TestInterface* item = WebKit::core(self);
RefPtr<WebCore::Node> gobjectResult = WTF::getPtr(WebCore::TestSupplemental::supplementalNode(item));
WebKitDOMNode* result = WebKit::kit(gobjectResult.get());
return result;
#else
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition11")
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition12")
return 0;
#endif
#else
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1")
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2")
return 0;
#endif
}
void
webkit_dom_test_interface_set_supplemental_node(WebKitDOMTestInterface* self, WebKitDOMNode* value)
{
#if ENABLE(Condition1) || ENABLE(Condition2)
#if ENABLE(Condition11) || ENABLE(Condition12)
g_return_if_fail(self);
WebCore::JSMainThreadNullState state;
WebCore::TestInterface* item = WebKit::core(self);
g_return_if_fail(value);
WebCore::Node* convertedValue = 0;
if (value) {
convertedValue = WebKit::core(value);
g_return_if_fail(convertedValue);
}
WebCore::TestSupplemental::setSupplementalNode(item, convertedValue);
#else
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition11")
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition12")
#endif
#else
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1")
WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2")
#endif
}