* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
*
* gparam.h: GParamSpec base class implementation
*/
+#ifndef __G_PARAM_H__
+#define __G_PARAM_H__
+
#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
#error "Only <glib-object.h> can be included directly."
#endif
-#ifndef __G_PARAM_H__
-#define __G_PARAM_H__
-
#include <gobject/gvalue.h>
G_BEGIN_DECLS
* Checks whether @pspec "is a" valid #GParamSpec structure of type %G_TYPE_PARAM
* or derived.
*/
-#define G_IS_PARAM_SPEC(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM))
+#define G_IS_PARAM_SPEC(pspec) (G_TYPE_CHECK_INSTANCE_FUNDAMENTAL_TYPE ((pspec), G_TYPE_PARAM))
/**
* G_PARAM_SPEC_CLASS:
* @pclass: a valid #GParamSpecClass
* GParamFlags:
* @G_PARAM_READABLE: the parameter is readable
* @G_PARAM_WRITABLE: the parameter is writable
+ * @G_PARAM_READWRITE: alias for %G_PARAM_READABLE | %G_PARAM_WRITABLE
* @G_PARAM_CONSTRUCT: the parameter will be set upon object construction
* @G_PARAM_CONSTRUCT_ONLY: the parameter will only be set upon object construction
* @G_PARAM_LAX_VALIDATION: upon parameter conversion (see g_param_value_convert())
* @G_PARAM_DEPRECATED: the parameter is deprecated and will be removed
* in a future version. A warning will be generated if it is used
* while running with G_ENABLE_DIAGNOSTIC=1.
- * Since: 2.26
+ * Since 2.26
*
* Through the #GParamFlags flag values, certain aspects of parameters
- * can be configured.
+ * can be configured. See also #G_PARAM_READWRITE and #G_PARAM_STATIC_STRINGS.
*/
typedef enum
{
G_PARAM_READABLE = 1 << 0,
G_PARAM_WRITABLE = 1 << 1,
+ G_PARAM_READWRITE = (G_PARAM_READABLE | G_PARAM_WRITABLE),
G_PARAM_CONSTRUCT = 1 << 2,
G_PARAM_CONSTRUCT_ONLY = 1 << 3,
G_PARAM_LAX_VALIDATION = 1 << 4,
G_PARAM_DEPRECATED = 1 << 31
} GParamFlags;
/**
- * G_PARAM_READWRITE:
- *
- * #GParamFlags value alias for %G_PARAM_READABLE | %G_PARAM_WRITABLE.
- */
-#define G_PARAM_READWRITE (G_PARAM_READABLE | G_PARAM_WRITABLE)
-/**
* G_PARAM_STATIC_STRINGS:
*
* #GParamFlags value alias for %G_PARAM_STATIC_NAME | %G_PARAM_STATIC_NICK | %G_PARAM_STATIC_BLURB.
* @value_type: the #GValue type for this parameter
* @owner_type: #GType type that uses (introduces) this parameter
*
- * All other fields of the <structname>GParamSpec</structname> struct are private and
+ * All other fields of the GParamSpec struct are private and
* should not be used directly.
*/
struct _GParamSpec
* @values_cmp: Compares @value1 with @value2 according to this type
* (recommended, the default is memcmp()), see g_param_values_cmp().
*
- * The class structure for the <structname>GParamSpec</structname> type.
- * Normally, <structname>GParamSpec</structname> classes are filled by
+ * The class structure for the GParamSpec type.
+ * Normally, GParamSpec classes are filled by
* g_param_type_register_static().
*/
struct _GParamSpecClass
* @name: the parameter name
* @value: the parameter value
*
- * The <structname>GParameter</structname> struct is an auxiliary structure used
+ * The GParameter struct is an auxiliary structure used
* to hand parameter name/value pairs to g_object_newv().
*/
struct _GParameter /* auxiliary structure for _setv() variants */
/* --- prototypes --- */
+GLIB_AVAILABLE_IN_ALL
GParamSpec* g_param_spec_ref (GParamSpec *pspec);
+GLIB_AVAILABLE_IN_ALL
void g_param_spec_unref (GParamSpec *pspec);
+GLIB_AVAILABLE_IN_ALL
void g_param_spec_sink (GParamSpec *pspec);
+GLIB_AVAILABLE_IN_ALL
GParamSpec* g_param_spec_ref_sink (GParamSpec *pspec);
+GLIB_AVAILABLE_IN_ALL
gpointer g_param_spec_get_qdata (GParamSpec *pspec,
GQuark quark);
+GLIB_AVAILABLE_IN_ALL
void g_param_spec_set_qdata (GParamSpec *pspec,
GQuark quark,
gpointer data);
+GLIB_AVAILABLE_IN_ALL
void g_param_spec_set_qdata_full (GParamSpec *pspec,
GQuark quark,
gpointer data,
GDestroyNotify destroy);
+GLIB_AVAILABLE_IN_ALL
gpointer g_param_spec_steal_qdata (GParamSpec *pspec,
GQuark quark);
+GLIB_AVAILABLE_IN_ALL
GParamSpec* g_param_spec_get_redirect_target (GParamSpec *pspec);
+GLIB_AVAILABLE_IN_ALL
void g_param_value_set_default (GParamSpec *pspec,
GValue *value);
+GLIB_AVAILABLE_IN_ALL
gboolean g_param_value_defaults (GParamSpec *pspec,
GValue *value);
+GLIB_AVAILABLE_IN_ALL
gboolean g_param_value_validate (GParamSpec *pspec,
GValue *value);
+GLIB_AVAILABLE_IN_ALL
gboolean g_param_value_convert (GParamSpec *pspec,
const GValue *src_value,
GValue *dest_value,
gboolean strict_validation);
+GLIB_AVAILABLE_IN_ALL
gint g_param_values_cmp (GParamSpec *pspec,
const GValue *value1,
const GValue *value2);
+GLIB_AVAILABLE_IN_ALL
const gchar * g_param_spec_get_name (GParamSpec *pspec);
+GLIB_AVAILABLE_IN_ALL
const gchar * g_param_spec_get_nick (GParamSpec *pspec);
+GLIB_AVAILABLE_IN_ALL
const gchar * g_param_spec_get_blurb (GParamSpec *pspec);
+GLIB_AVAILABLE_IN_ALL
void g_value_set_param (GValue *value,
GParamSpec *param);
+GLIB_AVAILABLE_IN_ALL
GParamSpec* g_value_get_param (const GValue *value);
+GLIB_AVAILABLE_IN_ALL
GParamSpec* g_value_dup_param (const GValue *value);
+GLIB_AVAILABLE_IN_ALL
void g_value_take_param (GValue *value,
GParamSpec *param);
-#ifndef G_DISABLE_DEPRECATED
+GLIB_DEPRECATED_FOR(g_value_take_param)
void g_value_set_param_take_ownership (GValue *value,
- GParamSpec *param) G_GNUC_DEPRECATED_FOR(g_value_take_param);
-#endif
+ GParamSpec *param);
+GLIB_AVAILABLE_IN_2_36
+const GValue * g_param_spec_get_default_value (GParamSpec *param);
/* --- convenience functions --- */
typedef struct _GParamSpecTypeInfo GParamSpecTypeInfo;
/**
* GParamSpecTypeInfo:
* @instance_size: Size of the instance (object) structure.
- * @n_preallocs: Prior to GLib 2.10, it specified the number of pre-allocated (cached) instances to reserve memory for (0 indicates no caching). Since GLib 2.10, it is ignored, since instances are allocated with the <link linkend="glib-Memory-Slices">slice allocator</link> now.
+ * @n_preallocs: Prior to GLib 2.10, it specified the number of pre-allocated (cached) instances to reserve memory for (0 indicates no caching). Since GLib 2.10, it is ignored, since instances are allocated with the [slice allocator][glib-Memory-Slices] now.
* @instance_init: Location of the instance initialization function (optional).
* @value_type: The #GType of values conforming to this #GParamSpec
* @finalize: The instance finalization function (optional).
const GValue *value1,
const GValue *value2);
};
+GLIB_AVAILABLE_IN_ALL
GType g_param_type_register_static (const gchar *name,
const GParamSpecTypeInfo *pspec_info);
/* --- protected --- */
+GLIB_AVAILABLE_IN_ALL
gpointer g_param_spec_internal (GType param_type,
const gchar *name,
const gchar *nick,
const gchar *blurb,
GParamFlags flags);
+GLIB_AVAILABLE_IN_ALL
GParamSpecPool* g_param_spec_pool_new (gboolean type_prefixing);
+GLIB_AVAILABLE_IN_ALL
void g_param_spec_pool_insert (GParamSpecPool *pool,
GParamSpec *pspec,
GType owner_type);
+GLIB_AVAILABLE_IN_ALL
void g_param_spec_pool_remove (GParamSpecPool *pool,
GParamSpec *pspec);
+GLIB_AVAILABLE_IN_ALL
GParamSpec* g_param_spec_pool_lookup (GParamSpecPool *pool,
const gchar *param_name,
GType owner_type,
gboolean walk_ancestors);
+GLIB_AVAILABLE_IN_ALL
GList* g_param_spec_pool_list_owned (GParamSpecPool *pool,
GType owner_type);
+GLIB_AVAILABLE_IN_ALL
GParamSpec** g_param_spec_pool_list (GParamSpecPool *pool,
GType owner_type,
guint *n_pspecs_p);
-
/* contracts:
*
* gboolean value_validate (GParamSpec *pspec,