Improve code generator scripts to support converting ScriptString.
[WebKit-https.git] / WebCore / bindings / scripts / test / GObject / WebKitDOMTestObj.cpp
index e264da6..8c1bae2 100644 (file)
@@ -27,6 +27,8 @@
 #include "TestObj.h"
 #include "WebKitDOMBinding.h"
 #include "gobject/ConvertToUTF8String.h"
+#include "webkit/WebKitDOMSerializedScriptValue.h"
+#include "webkit/WebKitDOMSerializedScriptValuePrivate.h"
 #include "webkit/WebKitDOMTestObj.h"
 #include "webkit/WebKitDOMTestObjPrivate.h"
 #include "webkitmarshal.h"
@@ -122,6 +124,18 @@ webkit_dom_test_obj_obj_method_with_args (WebKitDOMTestObj *self, glong int_arg,
 }
 
 void
+webkit_dom_test_obj_serialized_value (WebKitDOMTestObj *self, WebKitDOMSerializedScriptValue*  serialized_arg)
+{
+    g_return_if_fail (self);
+    WebCore::TestObj * item = WebKit::core(self);
+    g_return_if_fail (serialized_arg);
+    WebCore::SerializedScriptValue * _g_serialized_arg = WebKit::core(serialized_arg);
+    g_return_if_fail (_g_serialized_arg);
+    item->serializedValue(_g_serialized_arg);
+
+}
+
+void
 webkit_dom_test_obj_method_with_exception (WebKitDOMTestObj *self, GError **error)
 {
     g_return_if_fail (self);
@@ -136,6 +150,109 @@ webkit_dom_test_obj_method_with_exception (WebKitDOMTestObj *self, GError **erro
 
 }
 
+
+/* TODO: event function webkit_dom_test_obj_add_event_listener */
+
+
+/* TODO: event function webkit_dom_test_obj_remove_event_listener */
+
+void
+webkit_dom_test_obj_with_dynamic_frame (WebKitDOMTestObj *self)
+{
+    g_return_if_fail (self);
+    WebCore::TestObj * item = WebKit::core(self);
+    item->withDynamicFrame();
+
+}
+
+void
+webkit_dom_test_obj_with_dynamic_frame_and_arg (WebKitDOMTestObj *self, glong int_arg)
+{
+    g_return_if_fail (self);
+    WebCore::TestObj * item = WebKit::core(self);
+    item->withDynamicFrameAndArg(int_arg);
+
+}
+
+void
+webkit_dom_test_obj_with_dynamic_frame_and_optional_arg (WebKitDOMTestObj *self, glong int_arg, glong optional_arg)
+{
+    g_return_if_fail (self);
+    WebCore::TestObj * item = WebKit::core(self);
+    item->withDynamicFrameAndOptionalArg(int_arg, optional_arg);
+
+}
+
+void
+webkit_dom_test_obj_with_dynamic_frame_and_user_gesture (WebKitDOMTestObj *self, glong int_arg)
+{
+    g_return_if_fail (self);
+    WebCore::TestObj * item = WebKit::core(self);
+    item->withDynamicFrameAndUserGesture(int_arg);
+
+}
+
+void
+webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad (WebKitDOMTestObj *self, glong int_arg, glong optional_arg)
+{
+    g_return_if_fail (self);
+    WebCore::TestObj * item = WebKit::core(self);
+    item->withDynamicFrameAndUserGestureASAD(int_arg, optional_arg);
+
+}
+
+void
+webkit_dom_test_obj_with_script_state_void (WebKitDOMTestObj *self)
+{
+    g_return_if_fail (self);
+    WebCore::TestObj * item = WebKit::core(self);
+    item->withScriptStateVoid();
+
+}
+
+WebKitDOMTestObj* 
+webkit_dom_test_obj_with_script_state_obj (WebKitDOMTestObj *self)
+{
+    g_return_val_if_fail (self, 0);
+    WebCore::TestObj * item = WebKit::core(self);
+    PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->withScriptStateObj());
+    WebKitDOMTestObj*  res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get()));
+    return res;
+
+}
+
+void
+webkit_dom_test_obj_with_script_state_void_exception (WebKitDOMTestObj *self, GError **error)
+{
+    g_return_if_fail (self);
+    WebCore::TestObj * item = WebKit::core(self);
+    WebCore::ExceptionCode ec = 0;
+    item->withScriptStateVoidException(ec);
+    if (ec) {
+        WebCore::ExceptionCodeDescription ecdesc;
+        WebCore::getExceptionCodeDescription(ec, ecdesc);
+        g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name);
+    }
+
+}
+
+WebKitDOMTestObj* 
+webkit_dom_test_obj_with_script_state_obj_exception (WebKitDOMTestObj *self, GError **error)
+{
+    g_return_val_if_fail (self, 0);
+    WebCore::TestObj * item = WebKit::core(self);
+    WebCore::ExceptionCode ec = 0;
+    PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->withScriptStateObjException(ec));
+    if (ec) {
+        WebCore::ExceptionCodeDescription ecdesc;
+        WebCore::getExceptionCodeDescription(ec, ecdesc);
+        g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name);
+    }
+    WebKitDOMTestObj*  res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get()));
+    return res;
+
+}
+
 void
 webkit_dom_test_obj_method_with_optional_arg (WebKitDOMTestObj *self, glong opt)
 {
@@ -213,6 +330,44 @@ webkit_dom_test_obj_set_int_attr (WebKitDOMTestObj *self, glong value)
 
 }
 
+gint64
+webkit_dom_test_obj_get_long_long_attr (WebKitDOMTestObj *self)
+{
+    g_return_val_if_fail (self, 0);
+    WebCore::TestObj * item = WebKit::core(self);
+    gint64 res = item->longLongAttr();
+    return res;
+
+}
+
+void
+webkit_dom_test_obj_set_long_long_attr (WebKitDOMTestObj *self, gint64 value)
+{
+    g_return_if_fail (self);
+    WebCore::TestObj * item = WebKit::core(self);
+    item->setLongLongAttr(value);
+
+}
+
+guint64
+webkit_dom_test_obj_get_unsigned_long_long_attr (WebKitDOMTestObj *self)
+{
+    g_return_val_if_fail (self, 0);
+    WebCore::TestObj * item = WebKit::core(self);
+    guint64 res = item->unsignedLongLongAttr();
+    return res;
+
+}
+
+void
+webkit_dom_test_obj_set_unsigned_long_long_attr (WebKitDOMTestObj *self, guint64 value)
+{
+    g_return_if_fail (self);
+    WebCore::TestObj * item = WebKit::core(self);
+    item->setUnsignedLongLongAttr(value);
+
+}
+
 gchar* 
 webkit_dom_test_obj_get_string_attr (WebKitDOMTestObj *self)
 {
@@ -314,6 +469,16 @@ webkit_dom_test_obj_set_attr_with_getter_exception (WebKitDOMTestObj *self, glon
 
 }
 
+gchar* 
+webkit_dom_test_obj_get_script_string_attr (WebKitDOMTestObj *self)
+{
+    g_return_val_if_fail (self, 0);
+    WebCore::TestObj * item = WebKit::core(self);
+    gchar*  res = convertToUTF8String(item->scriptStringAttr());
+    return res;
+
+}
+
 
 G_DEFINE_TYPE(WebKitDOMTestObj, webkit_dom_test_obj, WEBKIT_TYPE_DOM_OBJECT)
 
@@ -354,12 +519,15 @@ enum {
     PROP_READ_ONLY_STRING_ATTR,
     PROP_READ_ONLY_TEST_OBJ_ATTR,
     PROP_INT_ATTR,
+    PROP_LONG_LONG_ATTR,
+    PROP_UNSIGNED_LONG_LONG_ATTR,
     PROP_STRING_ATTR,
     PROP_TEST_OBJ_ATTR,
     PROP_ATTR_WITH_EXCEPTION,
     PROP_ATTR_WITH_SETTER_EXCEPTION,
     PROP_ATTR_WITH_GETTER_EXCEPTION,
     PROP_CUSTOM_ATTR,
+    PROP_SCRIPT_STRING_ATTR,
 };
 
 
@@ -381,15 +549,19 @@ static void webkit_dom_test_obj_finalize(GObject* object)
 
 static void webkit_dom_test_obj_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec)
 {
-    WebKitDOMTestObj *self = WEBKIT_DOM_TEST_OBJ(object);
+     WebKitDOMTestObj *self = WEBKIT_DOM_TEST_OBJ(object);
     WebCore::TestObj* coreSelf = WebKit::core(self);
-
-    switch (prop_id) {
+     switch (prop_id) {
     case PROP_INT_ATTR:
     {
          coreSelf->setIntAttr((g_value_get_long(value)) );
          break;
     }
+    case PROP_UNSIGNED_LONG_LONG_ATTR:
+    {
+         coreSelf->setUnsignedLongLongAttr((g_value_get_uint64(value)) );
+         break;
+    }
     case PROP_STRING_ATTR:
     {
          coreSelf->setStringAttr(WebCore::String::fromUTF8(g_value_get_string(value)) );
@@ -410,11 +582,6 @@ static void webkit_dom_test_obj_set_property(GObject* object, guint prop_id, con
          coreSelf->setAttrWithGetterException((g_value_get_long(value)) );
          break;
     }
-    case PROP_CUSTOM_ATTR:
-    {
-         coreSelf->setCustomAttr((g_value_get_long(value)) );
-         break;
-    }
      default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
         break;
@@ -424,10 +591,9 @@ static void webkit_dom_test_obj_set_property(GObject* object, guint prop_id, con
 
 static void webkit_dom_test_obj_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec)
 {
-    WebKitDOMTestObj* self = WEBKIT_DOM_TEST_OBJ(object);
+     WebKitDOMTestObj* self = WEBKIT_DOM_TEST_OBJ(object);
     WebCore::TestObj* coreSelf = WebKit::core(self);
-
-    switch (prop_id) {
+     switch (prop_id) {
     case PROP_READ_ONLY_INT_ATTR:
     {
          g_value_set_long(value, coreSelf->readOnlyIntAttr());
@@ -449,6 +615,16 @@ static void webkit_dom_test_obj_get_property(GObject* object, guint prop_id, GVa
          g_value_set_long(value, coreSelf->intAttr());
          break;
     }
+    case PROP_LONG_LONG_ATTR:
+    {
+         g_value_set_int64(value, coreSelf->longLongAttr());
+         break;
+    }
+    case PROP_UNSIGNED_LONG_LONG_ATTR:
+    {
+         g_value_set_uint64(value, coreSelf->unsignedLongLongAttr());
+         break;
+    }
     case PROP_STRING_ATTR:
     {
          g_value_take_string(value, convertToUTF8String(coreSelf->stringAttr()));
@@ -475,9 +651,9 @@ static void webkit_dom_test_obj_get_property(GObject* object, guint prop_id, GVa
          g_value_set_long(value, coreSelf->attrWithGetterException());
          break;
     }
-    case PROP_CUSTOM_ATTR:
+    case PROP_SCRIPT_STRING_ATTR:
     {
-         g_value_set_long(value, coreSelf->customAttr());
+         g_value_take_string(value, convertToUTF8String(coreSelf->scriptStringAttr()));
          break;
     }
      default:
@@ -527,6 +703,24 @@ G_MAXLONG, /* max */
 0, /* default */
                                                            WEBKIT_PARAM_READWRITE));
      g_object_class_install_property(gobjectClass,
+                                    PROP_LONG_LONG_ATTR,
+                                    g_param_spec_int64("long-long-attr", /* name */
+                                                           "test_obj_long-long-attr", /* short description */
+                                                           "read-write  gint64 TestObj.long-long-attr", /* longer - could do with some extra doc stuff here */
+                                                           G_MININT64, /* min */
+G_MAXINT64, /* max */
+0, /* default */
+                                                           WEBKIT_PARAM_READWRITE));
+     g_object_class_install_property(gobjectClass,
+                                    PROP_UNSIGNED_LONG_LONG_ATTR,
+                                    g_param_spec_uint64("unsigned-long-long-attr", /* name */
+                                                           "test_obj_unsigned-long-long-attr", /* short description */
+                                                           "read-write  guint64 TestObj.unsigned-long-long-attr", /* longer - could do with some extra doc stuff here */
+                                                           0, /* min */
+G_MAXUINT64, /* min */
+0, /* default */
+                                                           WEBKIT_PARAM_READWRITE));
+     g_object_class_install_property(gobjectClass,
                                     PROP_STRING_ATTR,
                                     g_param_spec_string("string-attr", /* name */
                                                            "test_obj_string-attr", /* short description */
@@ -568,14 +762,12 @@ G_MAXLONG, /* max */
 0, /* default */
                                                            WEBKIT_PARAM_READWRITE));
      g_object_class_install_property(gobjectClass,
-                                    PROP_CUSTOM_ATTR,
-                                    g_param_spec_long("custom-attr", /* name */
-                                                           "test_obj_custom-attr", /* short description */
-                                                           "read-write  glong TestObj.custom-attr", /* longer - could do with some extra doc stuff here */
-                                                           G_MINLONG, /* min */
-G_MAXLONG, /* max */
-0, /* default */
-                                                           WEBKIT_PARAM_READWRITE));
+                                    PROP_SCRIPT_STRING_ATTR,
+                                    g_param_spec_string("script-string-attr", /* name */
+                                                           "test_obj_script-string-attr", /* short description */
+                                                           "read-only  gchar*  TestObj.script-string-attr", /* longer - could do with some extra doc stuff here */
+                                                           "", /* default */
+                                                           WEBKIT_PARAM_READABLE));