Binding generator should support interfaces with CustomConstructor and NoInterfaceObject
[WebKit-https.git] / Source / WebCore / bindings / scripts / test / GObject / WebKitDOMTestCustomConstructorWithNoInterfaceObject.cpp
1 /*
2  *  This file is part of the WebKit open source project.
3  *  This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4  *
5  *  This library is free software; you can redistribute it and/or
6  *  modify it under the terms of the GNU Library General Public
7  *  License as published by the Free Software Foundation; either
8  *  version 2 of the License, or (at your option) any later version.
9  *
10  *  This library is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  *  Library General Public License for more details.
14  *
15  *  You should have received a copy of the GNU Library General Public License
16  *  along with this library; see the file COPYING.LIB.  If not, write to
17  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  *  Boston, MA 02110-1301, USA.
19  */
20
21 #include "config.h"
22 #include "WebKitDOMTestCustomConstructorWithNoInterfaceObject.h"
23
24 #include "CSSImportRule.h"
25 #include "DOMObjectCache.h"
26 #include "Document.h"
27 #include "ExceptionCode.h"
28 #include "ExceptionCodeDescription.h"
29 #include "JSMainThreadExecState.h"
30 #include "WebKitDOMPrivate.h"
31 #include "WebKitDOMTestCustomConstructorWithNoInterfaceObjectPrivate.h"
32 #include "gobject/ConvertToUTF8String.h"
33 #include <wtf/GetPtr.h>
34 #include <wtf/RefPtr.h>
35
36 #define WEBKIT_DOM_TEST_CUSTOM_CONSTRUCTOR_WITH_NO_INTERFACE_OBJECT_GET_PRIVATE(obj) G_TYPE_INSTANCE_GET_PRIVATE(obj, WEBKIT_DOM_TYPE_TEST_CUSTOM_CONSTRUCTOR_WITH_NO_INTERFACE_OBJECT, WebKitDOMTestCustomConstructorWithNoInterfaceObjectPrivate)
37
38 typedef struct _WebKitDOMTestCustomConstructorWithNoInterfaceObjectPrivate {
39     RefPtr<WebCore::TestCustomConstructorWithNoInterfaceObject> coreObject;
40 } WebKitDOMTestCustomConstructorWithNoInterfaceObjectPrivate;
41
42 namespace WebKit {
43
44 WebKitDOMTestCustomConstructorWithNoInterfaceObject* kit(WebCore::TestCustomConstructorWithNoInterfaceObject* obj)
45 {
46     if (!obj)
47         return 0;
48
49     if (gpointer ret = DOMObjectCache::get(obj))
50         return WEBKIT_DOM_TEST_CUSTOM_CONSTRUCTOR_WITH_NO_INTERFACE_OBJECT(ret);
51
52     return wrapTestCustomConstructorWithNoInterfaceObject(obj);
53 }
54
55 WebCore::TestCustomConstructorWithNoInterfaceObject* core(WebKitDOMTestCustomConstructorWithNoInterfaceObject* request)
56 {
57     return request ? static_cast<WebCore::TestCustomConstructorWithNoInterfaceObject*>(WEBKIT_DOM_OBJECT(request)->coreObject) : 0;
58 }
59
60 WebKitDOMTestCustomConstructorWithNoInterfaceObject* wrapTestCustomConstructorWithNoInterfaceObject(WebCore::TestCustomConstructorWithNoInterfaceObject* coreObject)
61 {
62     ASSERT(coreObject);
63     return WEBKIT_DOM_TEST_CUSTOM_CONSTRUCTOR_WITH_NO_INTERFACE_OBJECT(g_object_new(WEBKIT_DOM_TYPE_TEST_CUSTOM_CONSTRUCTOR_WITH_NO_INTERFACE_OBJECT, "core-object", coreObject, nullptr));
64 }
65
66 } // namespace WebKit
67
68 G_DEFINE_TYPE(WebKitDOMTestCustomConstructorWithNoInterfaceObject, webkit_dom_test_custom_constructor_with_no_interface_object, WEBKIT_DOM_TYPE_OBJECT)
69
70 static void webkit_dom_test_custom_constructor_with_no_interface_object_finalize(GObject* object)
71 {
72     WebKitDOMTestCustomConstructorWithNoInterfaceObjectPrivate* priv = WEBKIT_DOM_TEST_CUSTOM_CONSTRUCTOR_WITH_NO_INTERFACE_OBJECT_GET_PRIVATE(object);
73
74     WebKit::DOMObjectCache::forget(priv->coreObject.get());
75
76     priv->~WebKitDOMTestCustomConstructorWithNoInterfaceObjectPrivate();
77     G_OBJECT_CLASS(webkit_dom_test_custom_constructor_with_no_interface_object_parent_class)->finalize(object);
78 }
79
80 static GObject* webkit_dom_test_custom_constructor_with_no_interface_object_constructor(GType type, guint constructPropertiesCount, GObjectConstructParam* constructProperties)
81 {
82     GObject* object = G_OBJECT_CLASS(webkit_dom_test_custom_constructor_with_no_interface_object_parent_class)->constructor(type, constructPropertiesCount, constructProperties);
83
84     WebKitDOMTestCustomConstructorWithNoInterfaceObjectPrivate* priv = WEBKIT_DOM_TEST_CUSTOM_CONSTRUCTOR_WITH_NO_INTERFACE_OBJECT_GET_PRIVATE(object);
85     priv->coreObject = static_cast<WebCore::TestCustomConstructorWithNoInterfaceObject*>(WEBKIT_DOM_OBJECT(object)->coreObject);
86     WebKit::DOMObjectCache::put(priv->coreObject.get(), object);
87
88     return object;
89 }
90
91 static void webkit_dom_test_custom_constructor_with_no_interface_object_class_init(WebKitDOMTestCustomConstructorWithNoInterfaceObjectClass* requestClass)
92 {
93     GObjectClass* gobjectClass = G_OBJECT_CLASS(requestClass);
94     g_type_class_add_private(gobjectClass, sizeof(WebKitDOMTestCustomConstructorWithNoInterfaceObjectPrivate));
95     gobjectClass->constructor = webkit_dom_test_custom_constructor_with_no_interface_object_constructor;
96     gobjectClass->finalize = webkit_dom_test_custom_constructor_with_no_interface_object_finalize;
97 }
98
99 static void webkit_dom_test_custom_constructor_with_no_interface_object_init(WebKitDOMTestCustomConstructorWithNoInterfaceObject* request)
100 {
101     WebKitDOMTestCustomConstructorWithNoInterfaceObjectPrivate* priv = WEBKIT_DOM_TEST_CUSTOM_CONSTRUCTOR_WITH_NO_INTERFACE_OBJECT_GET_PRIVATE(request);
102     new (priv) WebKitDOMTestCustomConstructorWithNoInterfaceObjectPrivate();
103 }
104