epoc32/include/stdapis/glib-2.0/gobject/genums.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
permissions -rw-r--r--
Final list of Symbian^2 public API header files
     1 /* GObject - GLib Type, Object, Parameter and Signal Library
     2  * Copyright (C) 1998-1999, 2000-2001 Tim Janik and Red Hat, Inc.
     3  * Portions copyright (c) 2006 Nokia Corporation.  All rights reserved.
     4  *
     5  * This library is free software; you can redistribute it and/or
     6  * modify it under the terms of the GNU Lesser 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  * Lesser General Public License for more details.
    14  *
    15  * You should have received a copy of the GNU Lesser General
    16  * Public License along with this library; if not, write to the
    17  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
    18  * Boston, MA 02111-1307, USA.
    19  */
    20 #if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
    21 #error "Only <glib-object.h> can be included directly."
    22 #endif
    23 
    24 #ifndef __G_ENUMS_H__
    25 #define __G_ENUMS_H__
    26 
    27 #include <_ansi.h>
    28 #include <gobject/gtype.h>
    29 
    30 G_BEGIN_DECLS
    31 
    32 /* --- type macros --- */
    33 #define G_TYPE_IS_ENUM(type)	       (G_TYPE_FUNDAMENTAL (type) == G_TYPE_ENUM)
    34 #define G_ENUM_CLASS(class)	       (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_ENUM, GEnumClass))
    35 #define G_IS_ENUM_CLASS(class)	       (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_ENUM))
    36 #define G_ENUM_CLASS_TYPE(class)       (G_TYPE_FROM_CLASS (class))
    37 #define G_ENUM_CLASS_TYPE_NAME(class)  (g_type_name (G_ENUM_CLASS_TYPE (class)))
    38 #define G_TYPE_IS_FLAGS(type)	       (G_TYPE_FUNDAMENTAL (type) == G_TYPE_FLAGS)
    39 #define G_FLAGS_CLASS(class)	       (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_FLAGS, GFlagsClass))
    40 #define G_IS_FLAGS_CLASS(class)        (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_FLAGS))
    41 #define G_FLAGS_CLASS_TYPE(class)      (G_TYPE_FROM_CLASS (class))
    42 #define G_FLAGS_CLASS_TYPE_NAME(class) (g_type_name (G_FLAGS_CLASS_TYPE (class)))
    43 #define G_VALUE_HOLDS_ENUM(value)      (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_ENUM))
    44 #define G_VALUE_HOLDS_FLAGS(value)     (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_FLAGS))
    45 
    46 
    47 /* --- enum/flag values & classes --- */
    48 typedef struct _GEnumClass  GEnumClass;
    49 typedef struct _GFlagsClass GFlagsClass;
    50 typedef struct _GEnumValue  GEnumValue;
    51 typedef struct _GFlagsValue GFlagsValue;
    52 struct	_GEnumClass
    53 {
    54   GTypeClass  g_type_class;
    55 
    56   /*< public >*/  
    57   gint	      minimum;
    58   gint	      maximum;
    59   guint	      n_values;
    60   GEnumValue *values;
    61 };
    62 struct	_GFlagsClass
    63 {
    64   GTypeClass   g_type_class;
    65   
    66   /*< public >*/  
    67   guint	       mask;
    68   guint	       n_values;
    69   GFlagsValue *values;
    70 };
    71 struct _GEnumValue
    72 {
    73   gint	 value;
    74   gchar *value_name;
    75   gchar *value_nick;
    76 };
    77 struct _GFlagsValue
    78 {
    79   guint	 value;
    80   gchar *value_name;
    81   gchar *value_nick;
    82 };
    83 
    84 
    85 /* --- prototypes --- */
    86 IMPORT_C GEnumValue*	g_enum_get_value		(GEnumClass	*enum_class,
    87 						 gint		 value);
    88 IMPORT_C GEnumValue*	g_enum_get_value_by_name	(GEnumClass	*enum_class,
    89 						 const gchar	*name);
    90 IMPORT_C GEnumValue*	g_enum_get_value_by_nick	(GEnumClass	*enum_class,
    91 						 const gchar	*nick);
    92 IMPORT_C GFlagsValue*	g_flags_get_first_value		(GFlagsClass	*flags_class,
    93 						 guint		 value);
    94 IMPORT_C GFlagsValue*	g_flags_get_value_by_name	(GFlagsClass	*flags_class,
    95 						 const gchar	*name);
    96 IMPORT_C GFlagsValue*	g_flags_get_value_by_nick	(GFlagsClass	*flags_class,
    97 						 const gchar	*nick);
    98 IMPORT_C void            g_value_set_enum        	(GValue         *value,
    99 						 gint            v_enum);
   100 IMPORT_C gint            g_value_get_enum        	(const GValue   *value);
   101 IMPORT_C void            g_value_set_flags       	(GValue         *value,
   102 						 guint           v_flags);
   103 IMPORT_C guint           g_value_get_flags       	(const GValue   *value);
   104 
   105 
   106 
   107 /* --- registration functions --- */
   108 /* const_static_values is a NULL terminated array of enum/flags
   109  * values that is taken over!
   110  */
   111 IMPORT_C GType	g_enum_register_static	   (const gchar	      *name,
   112 				    const GEnumValue  *const_static_values);
   113 IMPORT_C GType	g_flags_register_static	   (const gchar	      *name,
   114 				    const GFlagsValue *const_static_values);
   115 /* functions to complete the type information
   116  * for enums/flags implemented by plugins
   117  */
   118 IMPORT_C void	g_enum_complete_type_info  (GType	       g_enum_type,
   119 				    GTypeInfo	      *info,
   120 				    const GEnumValue  *const_values);
   121 IMPORT_C void	g_flags_complete_type_info (GType	       g_flags_type,
   122 				    GTypeInfo	      *info,
   123 				    const GFlagsValue *const_values);
   124 
   125 G_END_DECLS
   126 
   127 #endif /* __G_ENUMS_H__ */