1 /* 2 * * Copyright (C) 2006-2011 Anders Brander <anders@brander.dk>, 3 * * Anders Kvist <akv@lnxbx.dk> and Klaus Post <klauspost@gmail.com> 4 * 5 * This program is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU General Public License 7 * as published by the Free Software Foundation; either version 2 8 * of the License, or (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 */ 19 20 #ifndef RS_FILTER_PARAM_H 21 #define RS_FILTER_PARAM_H 22 23 #include <glib-object.h> 24 25 G_BEGIN_DECLS 26 27 #define RS_TYPE_FILTER_PARAM rs_filter_param_get_type() 28 #define RS_FILTER_PARAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RS_TYPE_FILTER_PARAM, RSFilterParam)) 29 #define RS_FILTER_PARAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RS_TYPE_FILTER_PARAM, RSFilterParamClass)) 30 #define RS_IS_FILTER_PARAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RS_TYPE_FILTER_PARAM)) 31 #define RS_IS_FILTER_PARAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RS_TYPE_FILTER_PARAM)) 32 #define RS_FILTER_PARAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RS_TYPE_FILTER_PARAM, RSFilterParamClass)) 33 34 typedef struct { 35 GObject parent; 36 gboolean dispose_has_run; 37 38 GHashTable *properties; 39 } RSFilterParam; 40 41 typedef struct { 42 GObjectClass parent_class; 43 } RSFilterParamClass; 44 45 GType rs_filter_param_get_type(void); 46 47 RSFilterParam *rs_filter_param_new(void); 48 49 void 50 rs_filter_param_clone(RSFilterParam *destination, const RSFilterParam *source); 51 52 /** 53 * Delete a property from a RSFilterParam 54 * @param filter_param A RSFilterParam 55 * @param name The name of the property 56 * @return TRUE if the property was found, FALSE otherwise 57 */ 58 gboolean 59 rs_filter_param_delete(RSFilterParam *filter_param, const gchar *name); 60 61 /** 62 * Set a string property 63 * @param filter_param A RSFilterParam 64 * @param name The name of the property 65 * @param str NULL-terminated string to set (will be copied) 66 */ 67 void rs_filter_param_set_string(RSFilterParam *filter_param, const gchar *name, const gchar *str); 68 69 /** 70 * Get a string property 71 * @param filter_param A RSFilterParam 72 * @param name The name of the property 73 * @param str A pointer to a string pointer where the value of the property can be saved. Should not be freed 74 * @return TRUE if the property was found, FALSE otherwise 75 */ 76 gboolean rs_filter_param_get_string(const RSFilterParam *filter_param, const gchar *name, const gchar ** const str); 77 78 /** 79 * Set a boolean property 80 * @param filter_param A RSFilterParam 81 * @param name The name of the property 82 * @param value A value to store 83 */ 84 void 85 rs_filter_param_set_boolean(RSFilterParam *filter_param, const gchar *name, const gboolean value); 86 87 /** 88 * Get a gboolean property 89 * @param filter_param A RSFilterParam 90 * @param name The name of the property 91 * @param value A pointer to a gboolean where the value will be stored 92 * @return TRUE if the property was found, FALSE otherwise 93 */ 94 gboolean rs_filter_param_get_boolean(const RSFilterParam *filter_param, const gchar *name, gboolean *value); 95 96 /** 97 * Set a integer property 98 * @param filter_param A RSFilterParam 99 * @param name The name of the property 100 * @param value A value to store 101 */ 102 void 103 rs_filter_param_set_integer(RSFilterParam *filter_param, const gchar *name, const gint value); 104 105 /** 106 * Get a integer property 107 * @param filter_param A RSFilterParam 108 * @param name The name of the property 109 * @param value A pointer to a gint where the value will be stored 110 * @return TRUE if the property was found, FALSE otherwise 111 */ 112 gboolean rs_filter_param_get_integer(const RSFilterParam *filter_param, const gchar *name, gint *value); 113 114 /** 115 * Set a float property 116 * @param filter_param A RSFilterParam 117 * @param name The name of the property 118 * @param value A value to store 119 */ 120 void 121 rs_filter_param_set_float(RSFilterParam *filter_param, const gchar *name, const gfloat value); 122 123 /** 124 * Get a float property 125 * @param filter_param A RSFilterParam 126 * @param name The name of the property 127 * @param value A pointer to a gfloat where the value will be stored 128 * @return TRUE if the property was found, FALSE otherwise 129 */ 130 gboolean rs_filter_param_get_float(const RSFilterParam *filter_param, const gchar *name, gfloat *value); 131 132 /** 133 * Set a float[4] property 134 * @param filter_param A RSFilterParam 135 * @param name The name of the property 136 * @param value A value to store 137 */ 138 void 139 rs_filter_param_set_float4(RSFilterParam *filter_param, const gchar *name, const gfloat value[4]); 140 141 /** 142 * Get a float property 143 * @param filter_param A RSFilterParam 144 * @param name The name of the property 145 * @param value A pointer to a gfloat [4] where the values will be stored 146 * @return TRUE if the property was found, FALSE otherwise 147 */ 148 gboolean rs_filter_param_get_float4(const RSFilterParam *filter_param, const gchar *name, gfloat value[4]); 149 150 /** 151 * Set an object property 152 * @param filter_param A RSFilterParam 153 * @param name The name of the property 154 * @param object An object to store. Refcount will be incremented by one 155 */ 156 void rs_filter_param_set_object(RSFilterParam *filter_param, const gchar *name, gpointer object); 157 158 /** 159 * Get an object property 160 * @param filter_param A RSFilterParam 161 * @param name The name of the property 162 * @return The object if found, NULL otherwise 163 */ 164 gpointer rs_filter_param_get_object(const RSFilterParam *filter_param, const gchar *name); 165 166 /** 167 * Get an object property 168 * @param filter_param A RSFilterParam 169 * @param name The name of the property 170 * @param type A desired GType, if the type doesn't match, the result is treated as non-existent 171 * @return The object if found, NULL otherwise 172 */ 173 gpointer rs_filter_param_get_object_with_type(const RSFilterParam *filter_param, const gchar *name, GType type); 174 175 G_END_DECLS 176 177 #endif /* RS_FILTER_PARAM_H */ 178