IDL functions and attributes should be JSBuiltin by default if interface is marked...
[WebKit-https.git] / Source / WebCore / bindings / scripts / test / GObject / WebKitDOMTestJSBuiltinConstructor.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 "WebKitDOMTestJSBuiltinConstructor.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 "WebKitDOMTestJSBuiltinConstructorPrivate.h"
32 #include "gobject/ConvertToUTF8String.h"
33 #include <wtf/GetPtr.h>
34 #include <wtf/RefPtr.h>
35
36 #define WEBKIT_DOM_TEST_JS_BUILTIN_CONSTRUCTOR_GET_PRIVATE(obj) G_TYPE_INSTANCE_GET_PRIVATE(obj, WEBKIT_DOM_TYPE_TEST_JS_BUILTIN_CONSTRUCTOR, WebKitDOMTestJSBuiltinConstructorPrivate)
37
38 typedef struct _WebKitDOMTestJSBuiltinConstructorPrivate {
39     RefPtr<WebCore::TestJSBuiltinConstructor> coreObject;
40 } WebKitDOMTestJSBuiltinConstructorPrivate;
41
42 namespace WebKit {
43
44 WebKitDOMTestJSBuiltinConstructor* kit(WebCore::TestJSBuiltinConstructor* obj)
45 {
46     if (!obj)
47         return 0;
48
49     if (gpointer ret = DOMObjectCache::get(obj))
50         return WEBKIT_DOM_TEST_JS_BUILTIN_CONSTRUCTOR(ret);
51
52     return wrapTestJSBuiltinConstructor(obj);
53 }
54
55 WebCore::TestJSBuiltinConstructor* core(WebKitDOMTestJSBuiltinConstructor* request)
56 {
57     return request ? static_cast<WebCore::TestJSBuiltinConstructor*>(WEBKIT_DOM_OBJECT(request)->coreObject) : 0;
58 }
59
60 WebKitDOMTestJSBuiltinConstructor* wrapTestJSBuiltinConstructor(WebCore::TestJSBuiltinConstructor* coreObject)
61 {
62     ASSERT(coreObject);
63     return WEBKIT_DOM_TEST_JS_BUILTIN_CONSTRUCTOR(g_object_new(WEBKIT_DOM_TYPE_TEST_JS_BUILTIN_CONSTRUCTOR, "core-object", coreObject, nullptr));
64 }
65
66 } // namespace WebKit
67
68 G_DEFINE_TYPE(WebKitDOMTestJSBuiltinConstructor, webkit_dom_test_js_builtin_constructor, WEBKIT_DOM_TYPE_OBJECT)
69
70 enum {
71     PROP_0,
72     PROP_TEST_ATTRIBUTE,
73 };
74
75 static void webkit_dom_test_js_builtin_constructor_finalize(GObject* object)
76 {
77     WebKitDOMTestJSBuiltinConstructorPrivate* priv = WEBKIT_DOM_TEST_JS_BUILTIN_CONSTRUCTOR_GET_PRIVATE(object);
78
79     WebKit::DOMObjectCache::forget(priv->coreObject.get());
80
81     priv->~WebKitDOMTestJSBuiltinConstructorPrivate();
82     G_OBJECT_CLASS(webkit_dom_test_js_builtin_constructor_parent_class)->finalize(object);
83 }
84
85 static void webkit_dom_test_js_builtin_constructor_set_property(GObject* object, guint propertyId, const GValue* value, GParamSpec* pspec)
86 {
87     WebKitDOMTestJSBuiltinConstructor* self = WEBKIT_DOM_TEST_JS_BUILTIN_CONSTRUCTOR(object);
88
89     switch (propertyId) {
90     case PROP_TEST_ATTRIBUTE:
91         webkit_dom_test_js_builtin_constructor_set_test_attribute(self, g_value_get_boolean(value));
92         break;
93     default:
94         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, pspec);
95         break;
96     }
97 }
98
99 static void webkit_dom_test_js_builtin_constructor_get_property(GObject* object, guint propertyId, GValue* value, GParamSpec* pspec)
100 {
101     WebKitDOMTestJSBuiltinConstructor* self = WEBKIT_DOM_TEST_JS_BUILTIN_CONSTRUCTOR(object);
102
103     switch (propertyId) {
104     case PROP_TEST_ATTRIBUTE:
105         g_value_set_boolean(value, webkit_dom_test_js_builtin_constructor_get_test_attribute(self));
106         break;
107     default:
108         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, pspec);
109         break;
110     }
111 }
112
113 static GObject* webkit_dom_test_js_builtin_constructor_constructor(GType type, guint constructPropertiesCount, GObjectConstructParam* constructProperties)
114 {
115     GObject* object = G_OBJECT_CLASS(webkit_dom_test_js_builtin_constructor_parent_class)->constructor(type, constructPropertiesCount, constructProperties);
116
117     WebKitDOMTestJSBuiltinConstructorPrivate* priv = WEBKIT_DOM_TEST_JS_BUILTIN_CONSTRUCTOR_GET_PRIVATE(object);
118     priv->coreObject = static_cast<WebCore::TestJSBuiltinConstructor*>(WEBKIT_DOM_OBJECT(object)->coreObject);
119     WebKit::DOMObjectCache::put(priv->coreObject.get(), object);
120
121     return object;
122 }
123
124 static void webkit_dom_test_js_builtin_constructor_class_init(WebKitDOMTestJSBuiltinConstructorClass* requestClass)
125 {
126     GObjectClass* gobjectClass = G_OBJECT_CLASS(requestClass);
127     g_type_class_add_private(gobjectClass, sizeof(WebKitDOMTestJSBuiltinConstructorPrivate));
128     gobjectClass->constructor = webkit_dom_test_js_builtin_constructor_constructor;
129     gobjectClass->finalize = webkit_dom_test_js_builtin_constructor_finalize;
130     gobjectClass->set_property = webkit_dom_test_js_builtin_constructor_set_property;
131     gobjectClass->get_property = webkit_dom_test_js_builtin_constructor_get_property;
132
133     g_object_class_install_property(
134         gobjectClass,
135         PROP_TEST_ATTRIBUTE,
136         g_param_spec_boolean(
137             "test-attribute",
138             "TestJSBuiltinConstructor:test-attribute",
139             "read-write gboolean TestJSBuiltinConstructor:test-attribute",
140             FALSE,
141             WEBKIT_PARAM_READWRITE));
142
143 }
144
145 static void webkit_dom_test_js_builtin_constructor_init(WebKitDOMTestJSBuiltinConstructor* request)
146 {
147     WebKitDOMTestJSBuiltinConstructorPrivate* priv = WEBKIT_DOM_TEST_JS_BUILTIN_CONSTRUCTOR_GET_PRIVATE(request);
148     new (priv) WebKitDOMTestJSBuiltinConstructorPrivate();
149 }
150
151 void webkit_dom_test_js_builtin_constructor_test_function(WebKitDOMTestJSBuiltinConstructor* self)
152 {
153     WebCore::JSMainThreadNullState state;
154     g_return_if_fail(WEBKIT_DOM_IS_TEST_JS_BUILTIN_CONSTRUCTOR(self));
155     WebCore::TestJSBuiltinConstructor* item = WebKit::core(self);
156     item->testFunction();
157 }
158
159 gboolean webkit_dom_test_js_builtin_constructor_get_test_attribute(WebKitDOMTestJSBuiltinConstructor* self)
160 {
161     WebCore::JSMainThreadNullState state;
162     g_return_val_if_fail(WEBKIT_DOM_IS_TEST_JS_BUILTIN_CONSTRUCTOR(self), FALSE);
163     WebCore::TestJSBuiltinConstructor* item = WebKit::core(self);
164     gboolean result = item->testAttribute();
165     return result;
166 }
167
168 void webkit_dom_test_js_builtin_constructor_set_test_attribute(WebKitDOMTestJSBuiltinConstructor* self, gboolean value)
169 {
170     WebCore::JSMainThreadNullState state;
171     g_return_if_fail(WEBKIT_DOM_IS_TEST_JS_BUILTIN_CONSTRUCTOR(self));
172     WebCore::TestJSBuiltinConstructor* item = WebKit::core(self);
173     item->setTestAttribute(value);
174 }
175