(root)/
glib-2.79.0/
gobject/
tests/
deftype.c
       1  /* deftype.c
       2   * Copyright (C) 2006 Behdad Esfahbod
       3   *
       4   * SPDX-License-Identifier: LGPL-2.1-or-later
       5   *
       6   * This library is free software; you can redistribute it and/or
       7   * modify it under the terms of the GNU Lesser General Public
       8   * License as published by the Free Software Foundation; either
       9   * version 2.1 of the License, or (at your option) any later version.
      10   *
      11   * This library is distributed in the hope that it will be useful,
      12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
      13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      14   * Lesser General Public License for more details.
      15   *
      16   * You should have received a copy of the GNU Lesser General
      17   * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
      18   */
      19  #include <glib-object.h>
      20  
      21  /* see http://bugzilla.gnome.org/show_bug.cgi?id=337128 for the purpose of this test */
      22  
      23  #define MY_G_IMPLEMENT_INTERFACE(TYPE_IFACE, iface_init)       { \
      24    const GInterfaceInfo g_implement_interface_info = { \
      25        (GInterfaceInitFunc) iface_init, \
      26        NULL, \
      27        NULL \
      28      }; \
      29    g_type_add_interface_static (g_define_type_id, TYPE_IFACE, &g_implement_interface_info); \
      30  }
      31  
      32  #define MY_DEFINE_TYPE(TN, t_n, T_P) \
      33  	G_DEFINE_TYPE_WITH_CODE (TN, t_n, T_P, \
      34  				 MY_G_IMPLEMENT_INTERFACE (G_TYPE_INTERFACE, NULL))
      35  
      36  typedef struct _TypeName {
      37    GObject parent_instance;
      38    const char *name;
      39  } TypeName;
      40  
      41  typedef struct _TypeNameClass {
      42    GObjectClass parent_parent;
      43  } TypeNameClass;
      44  
      45  GType           type_name_get_type          (void);
      46  
      47  MY_DEFINE_TYPE (TypeName, type_name, G_TYPE_OBJECT)
      48  
      49  static void     type_name_init              (TypeName      *self)
      50  {
      51  }
      52  
      53  static void     type_name_class_init        (TypeNameClass *klass)
      54  {
      55  }
      56  
      57  int
      58  main (void)
      59  {
      60    return 0;
      61  }