mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-07 02:59:39 +02:00
Dealing with GParamSpec is tedious and less efficient than necessary; property definitions should be able to either directly access a struct field or specify the accessors pair that control a property. On top of that, most of the property and accessor definition can be autogenerated from simple pre-processor directives. So, here's to you GProperty. GProperty is a GParamSpec sub-class that encapsulates all the types inside a single, opaque structure (to avoid leaking out implementation details); a GProperty can access the structure member holding the value of the property, or invoke the accessor functions passed to its constructor. Type safety is maintained through the GType system and without having to use GValue. Along with GProperty, this patch introduces a series of macros for automating the declaration and definition of property accessor functions, and for automating the collection and lcopy of values without going through GValue. GObject will recognize whether a GParamSpec used to set or get a property is really a GProperty, and thus will shortcircuit most of the GValue-based marshalled code, preferring the direct C function and direct argument collection instead of boxing/unboxing of GValues. https://bugzilla.gnome.org/show_bug.cgi?id=648526
44 lines
1.5 KiB
C
44 lines
1.5 KiB
C
/* GObject - GLib Type, Object, Parameter and Signal Library
|
|
* Copyright (C) 1998, 1999, 2000 Tim Janik and Red Hat, Inc.
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* 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.
|
|
*/
|
|
#ifndef __GLIB_GOBJECT_H__
|
|
#define __GLIB_GOBJECT_H__
|
|
|
|
#define __GLIB_GOBJECT_H_INSIDE__
|
|
|
|
/* topmost include file for GObject header files */
|
|
#include <gobject/gbinding.h>
|
|
#include <gobject/gboxed.h>
|
|
#include <gobject/genums.h>
|
|
#include <gobject/gobject.h>
|
|
#include <gobject/gparam.h>
|
|
#include <gobject/gparamspecs.h>
|
|
#include <gobject/gproperty.h>
|
|
#include <gobject/gsignal.h>
|
|
#include <gobject/gsourceclosure.h>
|
|
#include <gobject/gtype.h>
|
|
#include <gobject/gtypemodule.h>
|
|
#include <gobject/gtypeplugin.h>
|
|
#include <gobject/gvalue.h>
|
|
#include <gobject/gvaluearray.h>
|
|
#include <gobject/gvaluetypes.h>
|
|
|
|
#undef __GLIB_GOBJECT_H_INSIDE__
|
|
|
|
#endif /* __GLIB_GOBJECT_H__ */
|