Eradicate links and xrefs
[platform/upstream/glib.git] / gobject / gparam.h
index 92cc31b..68793d1 100644 (file)
  * 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
@@ -99,6 +97,14 @@ G_BEGIN_DECLS
  * Retrieves the #GType to initialize a #GValue for this parameter.
  */
 #define        G_PARAM_SPEC_VALUE_TYPE(pspec)  (G_PARAM_SPEC (pspec)->value_type)
+/**
+ * G_VALUE_HOLDS_PARAM:
+ * @value: a valid #GValue structure
+ * 
+ * Checks whether the given #GValue can hold values derived from type %G_TYPE_PARAM.
+ * 
+ * Returns: %TRUE on success.
+ */
 #define G_VALUE_HOLDS_PARAM(value)     (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_PARAM))
        
 
@@ -115,7 +121,7 @@ G_BEGIN_DECLS
  *  parameter is guaranteed to remain valid and
  *  unmodified for the lifetime of the parameter. 
  *  Since 2.8
- * @G_PARAM_PRIVATE:  * @G_PARAM_STATIC_NICK: the string used as nick when constructing the
+ * @G_PARAM_STATIC_NICK: the string used as nick when constructing the
  *  parameter is guaranteed to remain valid and
  *  unmmodified for the lifetime of the parameter.
  *  Since 2.8
@@ -123,9 +129,14 @@ G_BEGIN_DECLS
  *  parameter is guaranteed to remain valid and 
  *  unmodified for the lifetime of the parameter. 
  *  Since 2.8
+ * @G_PARAM_PRIVATE: internal
+ * @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
  * 
  * 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
 {
@@ -139,7 +150,9 @@ typedef enum
   G_PARAM_PRIVATE            = G_PARAM_STATIC_NAME,
 #endif
   G_PARAM_STATIC_NICK        = 1 << 6,
-  G_PARAM_STATIC_BLURB       = 1 << 7
+  G_PARAM_STATIC_BLURB       = 1 << 7,
+  /* User defined flags go up to 30 */
+  G_PARAM_DEPRECATED          = 1 << 31
 } GParamFlags;
 /**
  * G_PARAM_READWRITE:
@@ -166,11 +179,10 @@ typedef enum
  * G_PARAM_USER_SHIFT:
  * 
  * Minimum shift count to be used for user defined flags, to be stored in
- * #GParamSpec.flags.
+ * #GParamSpec.flags. The maximum allowed is 30 + G_PARAM_USER_SHIFT.
  */
 #define        G_PARAM_USER_SHIFT      (8)
 
-
 /* --- typedefs & structures --- */
 typedef struct _GParamSpec      GParamSpec;
 typedef struct _GParamSpecClass GParamSpecClass;
@@ -179,19 +191,19 @@ typedef struct _GParamSpecPool  GParamSpecPool;
 /**
  * GParamSpec:
  * @g_type_instance: private #GTypeInstance portion
- * @name: name of this parameter
+ * @name: name of this parameter: always an interned string
  * @flags: #GParamFlags flags for this parameter
  * @value_type: the #GValue type for this parameter
- * @owner_type: #GType type that uses (introduces) this paremeter
+ * @owner_type: #GType type that uses (introduces) this parameter
  * 
- * All fields of the <structname>GParamSpec</structname> struct are private and
- * should not be used directly, except for the following:
+ * All other fields of the <structname>GParamSpec</structname> struct are private and
+ * should not be used directly.
  */
 struct _GParamSpec
 {
   GTypeInstance  g_type_instance;
 
-  gchar         *name;
+  const gchar   *name;          /* interned string */
   GParamFlags    flags;
   GType                 value_type;
   GType                 owner_type;    /* class or interface using this property */
@@ -214,7 +226,7 @@ struct _GParamSpec
  *  g_param_value_set_default().
  * @value_validate: Ensures that the contents of @value comply with the 
  *  specifications set out by this type (optional), see 
- *  g_param_value_set_validate().
+ *  g_param_value_validate().
  * @values_cmp: Compares @value1 with @value2 according to this type
  *  (recommended, the default is memcmp()), see g_param_values_cmp().
  * 
@@ -241,7 +253,15 @@ struct _GParamSpecClass
   /*< private >*/
   gpointer       dummy[4];
 };
-struct _GParameter /* auxillary structure for _setv() variants */
+/**
+ * GParameter:
+ * @name: the parameter name
+ * @value: the parameter value
+ * 
+ * The <structname>GParameter</structname> struct is an auxiliary structure used
+ * to hand parameter name/value pairs to g_object_newv().
+ */
+struct _GParameter /* auxiliary structure for _setv() variants */
 {
   const gchar *name;
   GValue       value;
@@ -249,51 +269,73 @@ struct _GParameter /* auxillary 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);
-G_CONST_RETURN gchar*  g_param_spec_get_name   (GParamSpec    *pspec);
-G_CONST_RETURN gchar*  g_param_spec_get_nick   (GParamSpec    *pspec);
-G_CONST_RETURN gchar*  g_param_spec_get_blurb  (GParamSpec    *pspec);
+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);
-#endif
+                                                 GParamSpec    *param);
+GLIB_AVAILABLE_IN_2_36
+const GValue *  g_param_spec_get_default_value  (GParamSpec     *param);
 
 /* --- convenience functions --- */
 typedef struct _GParamSpecTypeInfo GParamSpecTypeInfo;
@@ -309,7 +351,7 @@ typedef struct _GParamSpecTypeInfo GParamSpecTypeInfo;
  *  g_param_value_set_default().
  * @value_validate: Ensures that the contents of @value comply with the 
  *  specifications set out by @pspec (optional), see 
- *  g_param_value_set_validate().
+ *  g_param_value_validate().
  * @values_cmp: Compares @value1 with @value2 according to @pspec 
  *  (recommended, the default is memcmp()), see g_param_values_cmp().
  * 
@@ -317,7 +359,7 @@ typedef struct _GParamSpecTypeInfo GParamSpecTypeInfo;
  * required to initialize and destruct (finalize) a parameter's class and
  * instances thereof.
  * The initialized structure is passed to the g_param_type_register_static() 
- * The type system will perform a deep copy of this structure, so it's memory 
+ * The type system will perform a deep copy of this structure, so its memory 
  * does not need to be persistent across invocation of 
  * g_param_type_register_static().
  */
@@ -339,6 +381,7 @@ struct _GParamSpecTypeInfo
                                         const GValue *value1,
                                         const GValue *value2);
 };
+GLIB_AVAILABLE_IN_ALL
 GType  g_param_type_register_static    (const gchar              *name,
                                         const GParamSpecTypeInfo *pspec_info);
 
@@ -349,29 +392,35 @@ GType  _g_param_type_register_static_constant (const gchar              *name,
 
 
 /* --- 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,