/* * Copyright (C) 2012 - Juan Ferrer Toribio * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef GVN_PARAM_SPEC_H #define GVN_PARAM_SPEC_H #include #define GVN_PARAM_SPEC_LOG_DOMAIN (g_quark_from_string ("GvnParamSpec")) /** * GVN_TYPE_PARAM_SPEC: * * The #GType for a boxed type holding a #GvnParamSpec. **/ #define GVN_TYPE_PARAM_SPEC (gvn_param_spec_get_type ()) typedef struct _GvnParamSpec GvnParamSpec; /** * GvnParamSpec: * @gtype: Type of the param * @editable: %TRUE if value is editable * @null: %TRUE if value can be of type %GVN_TYPE_NULL * @def: Default value **/ struct _GvnParamSpec { GType gtype; gboolean editable; gboolean null; GValue * def; }; /** * GvnParamError: * @GVN_PARAM_SPEC_ERROR_NOT_EDITABLE: The value can not be edited * @GVN_PARAM_SPEC_ERROR_NOT_NULL: The value can not be NULL * @GVN_PARAM_SPEC_ERROR_WRONG_TYPE: The value have a wrong type **/ typedef enum { GVN_PARAM_SPEC_ERROR_NOT_EDITABLE = 1 ,GVN_PARAM_SPEC_ERROR_NOT_NULL ,GVN_PARAM_SPEC_ERROR_WRONG_TYPE } GvnParamError; GType gvn_param_spec_get_type (); GvnParamSpec * gvn_param_spec_new (); GvnParamSpec * gvn_param_spec_new_with_attrs (GType gtype, gboolean editable, gboolean null, const GValue * def); GType gvn_param_spec_get_gtype (const GvnParamSpec * obj); void gvn_param_spec_set_gtype (GvnParamSpec * obj, GType gtype); gboolean gvn_param_spec_get_editable (const GvnParamSpec * obj); void gvn_param_spec_set_editable (GvnParamSpec * obj, gboolean editable); gboolean gvn_param_spec_get_null (const GvnParamSpec * obj); void gvn_param_spec_set_null (GvnParamSpec * obj, gboolean null); const GValue * gvn_param_spec_get_default (const GvnParamSpec * obj); void gvn_param_spec_set_default (GvnParamSpec * obj, const GValue * def); void gvn_param_spec_merge (GvnParamSpec * obj, const GvnParamSpec * merge); gboolean gvn_param_spec_ccopy_value (const GvnParamSpec * obj, const GValue * src, GValue * dst); gboolean gvn_param_spec_validate (const GvnParamSpec * obj, const GValue * value, GError ** err); void gvn_param_spec_unset (GvnParamSpec * obj); GvnParamSpec * gvn_param_spec_copy (const GvnParamSpec * obj); void gvn_param_spec_free (GvnParamSpec * obj); #endif