1 /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  *  Copyright (C) 2014  Kouhei Sutou <kou@clear-code.com>
4  *
5  *  This library is free software: you can redistribute it and/or modify
6  *  it under the terms of the GNU Lesser General Public License as published by
7  *  the Free Software Foundation, either version 3 of the License, or
8  *  (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
13  *  GNU Lesser General Public License for more details.
14  *
15  *  You should have received a copy of the GNU Lesser General Public License
16  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  *
18  */
19 
20 #ifdef HAVE_CONFIG_H
21 #  include <config.h>
22 #endif /* HAVE_CONFIG_H */
23 
24 #include <glib.h>
25 #include <glib/gi18n-lib.h>
26 #include <gmodule.h>
27 
28 #include <cutter/cut-module-impl.h>
29 #include <cutter/cut-module-factory.h>
30 #include <cutter/cut-loader-customizer.h>
31 
32 #define CUT_TYPE_CPP_INTEGRATION_LOADER_CUSTOMIZER_FACTORY    \
33     cut_type_cpp_integration_loader_customizer_factory
34 #define CUT_CPP_INTEGRATION_LOADER_CUSTOMIZER_FACTORY(obj)              \
35     (G_TYPE_CHECK_INSTANCE_CAST((obj),                                  \
36                                 CUT_TYPE_CPP_INTEGRATION_LOADER_CUSTOMIZER_FACTORY, \
37                                 CutCppIntegrationLoaderCustomizerFactory))
38 #define CUT_CPP_INTEGRATION_LOADER_CUSTOMIZER_FACTORY_CLASS(klass)      \
39     (G_TYPE_CHECK_CLASS_CAST((klass),                                   \
40                              CUT_TYPE_CPP_INTEGRATION_LOADER_CUSTOMIZER_FACTORY, \
41                              CutCppIntegrationLoaderCustomizerFactoryClass))
42 #define CUT_IS_CPP_INTEGRATION_LOADER_CUSTOMIZER_FACTORY(obj)           \
43     (G_TYPE_CHECK_INSTANCE_TYPE((obj),                                  \
44                                 CUT_TYPE_CPP_INTEGRATION_LOADER_CUSTOMIZER_FACTORY))
45 #define CUT_IS_CPP_INTEGRATION_LOADER_CUSTOMIZER_FACTORY_CLASS(klass)   \
46     (G_TYPE_CHECK_CLASS_TYPE((klass),                                   \
47                              CUT_TYPE_CPP_INTEGRATION_LOADER_CUSTOMIZER_FACTORY))
48 #define CUT_CPP_INTEGRATION_LOADER_CUSTOMIZER_FACTORY_GET_CLASS(obj)    \
49     (G_TYPE_INSTANCE_GET_CLASS((obj),                                   \
50                              CUT_TYPE_CPP_INTEGRATION_LOADER_CUSTOMIZER_FACTORY, \
51                              CutCppIntegrationLoaderCustomizerFactoryClass))
52 
53 typedef struct _CutCppIntegrationLoaderCustomizerFactory CutCppIntegrationLoaderCustomizerFactory;
54 typedef struct _CutCppIntegrationLoaderCustomizerFactoryClass CutCppIntegrationLoaderCustomizerFactoryClass;
55 
56 struct _CutCppIntegrationLoaderCustomizerFactory
57 {
58     CutModuleFactory     object;
59 };
60 
61 struct _CutCppIntegrationLoaderCustomizerFactoryClass
62 {
63     CutModuleFactoryClass parent_class;
64 };
65 
66 static GType cut_type_cpp_integration_loader_customizer_factory = 0;
67 static CutModuleFactoryClass *parent_class;
68 
69 static GObject   *create           (CutModuleFactory    *factory);
70 
71 static void
class_init(CutModuleFactoryClass * klass)72 class_init (CutModuleFactoryClass *klass)
73 {
74     CutModuleFactoryClass *factory_class;
75 
76     parent_class = g_type_class_peek_parent(klass);
77 
78     factory_class = CUT_MODULE_FACTORY_CLASS(klass);
79 
80     factory_class->create = create;
81 }
82 
83 static void
init(CutCppIntegrationLoaderCustomizerFactory * console)84 init (CutCppIntegrationLoaderCustomizerFactory *console)
85 {
86 }
87 
88 static void
register_type(GTypeModule * type_module)89 register_type (GTypeModule *type_module)
90 {
91     static const GTypeInfo info = {
92         sizeof(CutCppIntegrationLoaderCustomizerFactoryClass),
93         (GBaseInitFunc)NULL,
94         (GBaseFinalizeFunc)NULL,
95         (GClassInitFunc)class_init,
96         NULL,           /* class_finalize */
97         NULL,           /* class_data */
98         sizeof(CutCppIntegrationLoaderCustomizerFactory),
99         0,
100         (GInstanceInitFunc)init,
101     };
102 
103     cut_type_cpp_integration_loader_customizer_factory =
104         g_type_module_register_type(type_module,
105                                     CUT_TYPE_MODULE_FACTORY,
106                                     "CutCppIntegrationLoaderCustomizerFactory",
107                                     &info, 0);
108 }
109 
110 G_MODULE_EXPORT GList *
CUT_MODULE_IMPL_INIT(GTypeModule * type_module)111 CUT_MODULE_IMPL_INIT (GTypeModule *type_module)
112 {
113     GList *registered_types = NULL;
114 
115     register_type(type_module);
116     if (cut_type_cpp_integration_loader_customizer_factory) {
117         registered_types =
118             g_list_prepend(registered_types,
119                            (gchar *)g_type_name(cut_type_cpp_integration_loader_customizer_factory));
120     }
121 
122     return registered_types;
123 }
124 
125 G_MODULE_EXPORT void
CUT_MODULE_IMPL_EXIT(void)126 CUT_MODULE_IMPL_EXIT (void)
127 {
128 }
129 
130 G_MODULE_EXPORT GObject *
CUT_MODULE_IMPL_INSTANTIATE(const gchar * first_property,va_list var_args)131 CUT_MODULE_IMPL_INSTANTIATE (const gchar *first_property, va_list var_args)
132 {
133     return g_object_new_valist(CUT_TYPE_CPP_INTEGRATION_LOADER_CUSTOMIZER_FACTORY, first_property, var_args);
134 }
135 
136 GObject *
create(CutModuleFactory * factory)137 create (CutModuleFactory *factory)
138 {
139     return G_OBJECT(cut_loader_customizer_new("cpp-integration",
140                                               NULL));
141 }
142 
143 /*
144 vi:ts=4:nowrap:ai:expandtab:sw=4
145 */
146