1.1 --- a/epoc32/include/stdapis/glib-2.0/gobject/gparam.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/stdapis/glib-2.0/gobject/gparam.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,236 @@
1.4 -gparam.h
1.5 +/* GObject - GLib Type, Object, Parameter and Signal Library
1.6 + * Copyright (C) 1997-1999, 2000-2001 Tim Janik and Red Hat, Inc.
1.7 + * Portions copyright (c) 2006 Nokia Corporation. All rights reserved.
1.8 + *
1.9 + * This library is free software; you can redistribute it and/or
1.10 + * modify it under the terms of the GNU Lesser General Public
1.11 + * License as published by the Free Software Foundation; either
1.12 + * version 2 of the License, or (at your option) any later version.
1.13 + *
1.14 + * This library is distributed in the hope that it will be useful,
1.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1.17 + * Lesser General Public License for more details.
1.18 + *
1.19 + * You should have received a copy of the GNU Lesser General
1.20 + * Public License along with this library; if not, write to the
1.21 + * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
1.22 + * Boston, MA 02111-1307, USA.
1.23 + *
1.24 + * gparam.h: GParamSpec base class implementation
1.25 + */
1.26 +#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
1.27 +#error "Only <glib-object.h> can be included directly."
1.28 +#endif
1.29 +
1.30 +#ifndef __G_PARAM_H__
1.31 +#define __G_PARAM_H__
1.32 +
1.33 +#include <_ansi.h>
1.34 +#include <gobject/gvalue.h>
1.35 +
1.36 +G_BEGIN_DECLS
1.37 +
1.38 +/* --- standard type macros --- */
1.39 +#define G_TYPE_IS_PARAM(type) (G_TYPE_FUNDAMENTAL (type) == G_TYPE_PARAM)
1.40 +#define G_PARAM_SPEC(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM, GParamSpec))
1.41 +#define G_IS_PARAM_SPEC(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM))
1.42 +#define G_PARAM_SPEC_CLASS(pclass) (G_TYPE_CHECK_CLASS_CAST ((pclass), G_TYPE_PARAM, GParamSpecClass))
1.43 +#define G_IS_PARAM_SPEC_CLASS(pclass) (G_TYPE_CHECK_CLASS_TYPE ((pclass), G_TYPE_PARAM))
1.44 +#define G_PARAM_SPEC_GET_CLASS(pspec) (G_TYPE_INSTANCE_GET_CLASS ((pspec), G_TYPE_PARAM, GParamSpecClass))
1.45 +
1.46 +
1.47 +/* --- convenience macros --- */
1.48 +#define G_PARAM_SPEC_TYPE(pspec) (G_TYPE_FROM_INSTANCE (pspec))
1.49 +#define G_PARAM_SPEC_TYPE_NAME(pspec) (g_type_name (G_PARAM_SPEC_TYPE (pspec)))
1.50 +#define G_PARAM_SPEC_VALUE_TYPE(pspec) (G_PARAM_SPEC (pspec)->value_type)
1.51 +#define G_VALUE_HOLDS_PARAM(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_PARAM))
1.52 +
1.53 +
1.54 +/* --- flags --- */
1.55 +typedef enum
1.56 +{
1.57 + G_PARAM_READABLE = 1 << 0,
1.58 + G_PARAM_WRITABLE = 1 << 1,
1.59 + G_PARAM_CONSTRUCT = 1 << 2,
1.60 + G_PARAM_CONSTRUCT_ONLY = 1 << 3,
1.61 + G_PARAM_LAX_VALIDATION = 1 << 4,
1.62 + G_PARAM_STATIC_NAME = 1 << 5,
1.63 +#ifndef G_DISABLE_DEPRECATED
1.64 + G_PARAM_PRIVATE = G_PARAM_STATIC_NAME,
1.65 +#endif
1.66 + G_PARAM_STATIC_NICK = 1 << 6,
1.67 + G_PARAM_STATIC_BLURB = 1 << 7
1.68 +} GParamFlags;
1.69 +#define G_PARAM_READWRITE (G_PARAM_READABLE | G_PARAM_WRITABLE)
1.70 +#define G_PARAM_MASK (0x000000ff)
1.71 +/* bits in the range 0xffffff00 are reserved for 3rd party usage */
1.72 +#define G_PARAM_USER_SHIFT (8)
1.73 +
1.74 +
1.75 +/* --- typedefs & structures --- */
1.76 +typedef struct _GParamSpec GParamSpec;
1.77 +typedef struct _GParamSpecClass GParamSpecClass;
1.78 +typedef struct _GParameter GParameter;
1.79 +typedef struct _GParamSpecPool GParamSpecPool;
1.80 +struct _GParamSpec
1.81 +{
1.82 + GTypeInstance g_type_instance;
1.83 +
1.84 + gchar *name;
1.85 + GParamFlags flags;
1.86 + GType value_type;
1.87 + GType owner_type; /* class or interface using this property */
1.88 +
1.89 + /*< private >*/
1.90 + gchar *_nick;
1.91 + gchar *_blurb;
1.92 + GData *qdata;
1.93 + guint ref_count;
1.94 + guint param_id; /* sort-criteria */
1.95 +};
1.96 +struct _GParamSpecClass
1.97 +{
1.98 + GTypeClass g_type_class;
1.99 +
1.100 + GType value_type;
1.101 +
1.102 + void (*finalize) (GParamSpec *pspec);
1.103 +
1.104 + /* GParam methods */
1.105 + void (*value_set_default) (GParamSpec *pspec,
1.106 + GValue *value);
1.107 + gboolean (*value_validate) (GParamSpec *pspec,
1.108 + GValue *value);
1.109 + gint (*values_cmp) (GParamSpec *pspec,
1.110 + const GValue *value1,
1.111 + const GValue *value2);
1.112 + /*< private >*/
1.113 + gpointer dummy[4];
1.114 +};
1.115 +struct _GParameter /* auxillary structure for _setv() variants */
1.116 +{
1.117 + const gchar *name;
1.118 + GValue value;
1.119 +};
1.120 +
1.121 +
1.122 +/* --- prototypes --- */
1.123 +IMPORT_C GParamSpec* g_param_spec_ref (GParamSpec *pspec);
1.124 +IMPORT_C void g_param_spec_unref (GParamSpec *pspec);
1.125 +IMPORT_C void g_param_spec_sink (GParamSpec *pspec);
1.126 +IMPORT_C GParamSpec* g_param_spec_ref_sink (GParamSpec *pspec);
1.127 +IMPORT_C gpointer g_param_spec_get_qdata (GParamSpec *pspec,
1.128 + GQuark quark);
1.129 +IMPORT_C void g_param_spec_set_qdata (GParamSpec *pspec,
1.130 + GQuark quark,
1.131 + gpointer data);
1.132 +IMPORT_C void g_param_spec_set_qdata_full (GParamSpec *pspec,
1.133 + GQuark quark,
1.134 + gpointer data,
1.135 + GDestroyNotify destroy);
1.136 +IMPORT_C gpointer g_param_spec_steal_qdata (GParamSpec *pspec,
1.137 + GQuark quark);
1.138 +IMPORT_C GParamSpec* g_param_spec_get_redirect_target (GParamSpec *pspec);
1.139 +
1.140 +IMPORT_C void g_param_value_set_default (GParamSpec *pspec,
1.141 + GValue *value);
1.142 +IMPORT_C gboolean g_param_value_defaults (GParamSpec *pspec,
1.143 + GValue *value);
1.144 +IMPORT_C gboolean g_param_value_validate (GParamSpec *pspec,
1.145 + GValue *value);
1.146 +IMPORT_C gboolean g_param_value_convert (GParamSpec *pspec,
1.147 + const GValue *src_value,
1.148 + GValue *dest_value,
1.149 + gboolean strict_validation);
1.150 +IMPORT_C gint g_param_values_cmp (GParamSpec *pspec,
1.151 + const GValue *value1,
1.152 + const GValue *value2);
1.153 +IMPORT_C G_CONST_RETURN gchar* g_param_spec_get_name (GParamSpec *pspec);
1.154 +IMPORT_C G_CONST_RETURN gchar* g_param_spec_get_nick (GParamSpec *pspec);
1.155 +IMPORT_C G_CONST_RETURN gchar* g_param_spec_get_blurb (GParamSpec *pspec);
1.156 +IMPORT_C void g_value_set_param (GValue *value,
1.157 + GParamSpec *param);
1.158 +IMPORT_C GParamSpec* g_value_get_param (const GValue *value);
1.159 +IMPORT_C GParamSpec* g_value_dup_param (const GValue *value);
1.160 +
1.161 +
1.162 +IMPORT_C void g_value_take_param (GValue *value,
1.163 + GParamSpec *param);
1.164 +#ifndef G_DISABLE_DEPRECATED
1.165 +IMPORT_C void g_value_set_param_take_ownership (GValue *value,
1.166 + GParamSpec *param);
1.167 +#endif
1.168 +
1.169 +/* --- convenience functions --- */
1.170 +typedef struct _GParamSpecTypeInfo GParamSpecTypeInfo;
1.171 +struct _GParamSpecTypeInfo
1.172 +{
1.173 + /* type system portion */
1.174 + guint16 instance_size; /* obligatory */
1.175 + guint16 n_preallocs; /* optional */
1.176 + void (*instance_init) (GParamSpec *pspec); /* optional */
1.177 +
1.178 + /* class portion */
1.179 + GType value_type; /* obligatory */
1.180 + void (*finalize) (GParamSpec *pspec); /* optional */
1.181 + void (*value_set_default) (GParamSpec *pspec, /* recommended */
1.182 + GValue *value);
1.183 + gboolean (*value_validate) (GParamSpec *pspec, /* optional */
1.184 + GValue *value);
1.185 + gint (*values_cmp) (GParamSpec *pspec, /* recommended */
1.186 + const GValue *value1,
1.187 + const GValue *value2);
1.188 +};
1.189 +IMPORT_C GType g_param_type_register_static (const gchar *name,
1.190 + const GParamSpecTypeInfo *pspec_info);
1.191 +
1.192 +/* For registering builting types */
1.193 +GType _g_param_type_register_static_constant (const gchar *name,
1.194 + const GParamSpecTypeInfo *pspec_info,
1.195 + GType opt_type);
1.196 +
1.197 +
1.198 +/* --- protected --- */
1.199 +IMPORT_C gpointer g_param_spec_internal (GType param_type,
1.200 + const gchar *name,
1.201 + const gchar *nick,
1.202 + const gchar *blurb,
1.203 + GParamFlags flags);
1.204 +IMPORT_C GParamSpecPool* g_param_spec_pool_new (gboolean type_prefixing);
1.205 +IMPORT_C void g_param_spec_pool_insert (GParamSpecPool *pool,
1.206 + GParamSpec *pspec,
1.207 + GType owner_type);
1.208 +IMPORT_C void g_param_spec_pool_remove (GParamSpecPool *pool,
1.209 + GParamSpec *pspec);
1.210 +IMPORT_C GParamSpec* g_param_spec_pool_lookup (GParamSpecPool *pool,
1.211 + const gchar *param_name,
1.212 + GType owner_type,
1.213 + gboolean walk_ancestors);
1.214 +IMPORT_C GList* g_param_spec_pool_list_owned (GParamSpecPool *pool,
1.215 + GType owner_type);
1.216 +IMPORT_C GParamSpec** g_param_spec_pool_list (GParamSpecPool *pool,
1.217 + GType owner_type,
1.218 + guint *n_pspecs_p);
1.219 +
1.220 +
1.221 +
1.222 +/* contracts:
1.223 + *
1.224 + * gboolean value_validate (GParamSpec *pspec,
1.225 + * GValue *value):
1.226 + * modify value contents in the least destructive way, so
1.227 + * that it complies with pspec's requirements (i.e.
1.228 + * according to minimum/maximum ranges etc...). return
1.229 + * whether modification was necessary.
1.230 + *
1.231 + * gint values_cmp (GParamSpec *pspec,
1.232 + * const GValue *value1,
1.233 + * const GValue *value2):
1.234 + * return value1 - value2, i.e. (-1) if value1 < value2,
1.235 + * (+1) if value1 > value2, and (0) otherwise (equality)
1.236 + */
1.237 +
1.238 +G_END_DECLS
1.239 +
1.240 +#endif /* __G_PARAM_H__ */