1 /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 /* 3 * Copyright (C) 2008-2010 Kouhei Sutou <kou@clear-code.com> 4 * 5 * This library is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU Lesser General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * This library 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 Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * 18 */ 19 20 #ifndef __GCUT_INSPECT_H__ 21 #define __GCUT_INSPECT_H__ 22 23 #include <glib-object.h> 24 25 G_BEGIN_DECLS 26 27 /** 28 * SECTION: gcut-inspect 29 * @title: Object inspection functions 30 * @short_description: Functions to inspect an object for 31 * debugging. 32 * 33 * In test result, we need to know detail of inspected 34 * objects for debugging. Functions of this section help us 35 * to inspect interested objects. 36 * 37 * Since: 1.0.6 38 */ 39 40 41 /** 42 * gcut_inspect_direct: 43 * @string: the output string. 44 * @data: the interested target. 45 * @user_data: the data passed by user. (ignored) 46 * 47 * Shows @data as unsigned integer. 48 * 49 * e.g.: 50 * |[ 51 * gcut_inspect_direct(string, GUINT_TO_POINTER(100), NULL) -> "100" 52 * ]| 53 * 54 * Since: 1.0.6 55 */ 56 void gcut_inspect_direct (GString *string, 57 gconstpointer data, 58 gpointer user_data); 59 60 /** 61 * gcut_inspect_int: 62 * @string: the output string. 63 * @data: the interested target. 64 * @user_data: the data passed by user. (ignored) 65 * 66 * Shows @data as integer. 67 * 68 * e.g.: 69 * |[ 70 * gint int_value = 100; 71 * gcut_inspect_int(string, &int_value, NULL) -> "100" 72 * ]| 73 * 74 * Since: 1.0.6 75 */ 76 void gcut_inspect_int (GString *string, 77 gconstpointer data, 78 gpointer user_data); 79 80 /** 81 * gcut_inspect_uint: 82 * @string: the output string. 83 * @data: the interested target. 84 * @user_data: the data passed by user. (ignored) 85 * 86 * Shows @data as unsigned integer. 87 * 88 * e.g.: 89 * |[ 90 * guint uint_value = 100; 91 * gcut_inspect_uint(string, &uint_value, NULL) -> "100" 92 * ]| 93 * 94 * Since: 1.0.6 95 */ 96 void gcut_inspect_uint (GString *string, 97 gconstpointer data, 98 gpointer user_data); 99 100 /** 101 * gcut_inspect_int64: 102 * @string: the output string. 103 * @data: the interested target. 104 * @user_data: the data passed by user. (ignored) 105 * 106 * Shows @data as 64-bit integer. 107 * 108 * e.g.: 109 * |[ 110 * gint64 int64_value = 100; 111 * gcut_inspect_int64(string, &int64_value, NULL) -> "100" 112 * ]| 113 * 114 * Since: 1.1.3 115 */ 116 void gcut_inspect_int64 (GString *string, 117 gconstpointer data, 118 gpointer user_data); 119 120 /** 121 * gcut_inspect_uint64: 122 * @string: the output string. 123 * @data: the interested target. 124 * @user_data: the data passed by user. (ignored) 125 * 126 * Shows @data as 64-bit unsigned integer. 127 * 128 * e.g.: 129 * |[ 130 * guint64 uint64_value = 100; 131 * gcut_inspect_uint64(string, &uint64_value, NULL) -> "100" 132 * ]| 133 * 134 * Since: 1.1.3 135 */ 136 void gcut_inspect_uint64 (GString *string, 137 gconstpointer data, 138 gpointer user_data); 139 140 /** 141 * gcut_inspect_size: 142 * @string: the output string. 143 * @data: the interested target. 144 * @user_data: the data passed by user. (ignored) 145 * 146 * Shows @data as unsigned integer. 147 * 148 * e.g.: 149 * |[ 150 * gsize size_value = 100; 151 * gcut_inspect_size(string, &size_value, NULL) -> "100" 152 * ]| 153 * 154 * Since: 1.1.3 155 */ 156 void gcut_inspect_size (GString *string, 157 gconstpointer data, 158 gpointer user_data); 159 160 /** 161 * gcut_inspect_char: 162 * @string: the output string. 163 * @data: the interested target. 164 * @user_data: the data passed by user. (ignored) 165 * 166 * Shows @data as character. 167 * 168 * e.g.: 169 * |[ 170 * gcut_inspect_char(string, 'C', NULL) -> "'C'" 171 * gcut_inspect_char(string, '\0', NULL) -> "'\0'" 172 * gcut_inspect_char(string, '\n', NULL) -> "'\n'" 173 * ]| 174 * 175 * Since: 1.1.3 176 */ 177 void gcut_inspect_char (GString *string, 178 gconstpointer data, 179 gpointer user_data); 180 /** 181 * gcut_inspect_string: 182 * @string: the output string. 183 * @data: the interested target. 184 * @user_data: the data passed by user. (ignored) 185 * 186 * Shows @data as string. It also accepts %NULL. 187 * 188 * e.g.: 189 * |[ 190 * gcut_inspect_string(string, "string", NULL) -> "\"string\"" 191 * ]| 192 * 193 * Since: 1.0.6 194 */ 195 void gcut_inspect_string (GString *string, 196 gconstpointer data, 197 gpointer user_data); 198 199 /** 200 * gcut_inspect_type: 201 * @string: the output string. 202 * @data: the interested target. 203 * @user_data: the data passed by user. (ignored) 204 * 205 * Shows @data as %GType. 206 * 207 * e.g.: 208 * |[ 209 * gcut_inspect_type(string, GTK_TYPE_WINDOW, NULL) -> "<GtkWindow>" 210 * ]| 211 * 212 * Since: 1.0.6 213 */ 214 void gcut_inspect_type (GString *string, 215 gconstpointer data, 216 gpointer user_data); 217 218 /** 219 * gcut_inspect_flags: 220 * @string: the output string. 221 * @data: the interested target. 222 * @user_data: the pointer of GFlags type. 223 * 224 * Shows @data as value a GFlags type. 225 * 226 * e.g.: 227 * |[ 228 * GType flags_type; 229 * GtkWidgetFlags flags; 230 * 231 * flags_type = GTK_TYPE_WIDGET_FLAGS; 232 * flags = GTK_TOPLEVEL | GTK_VISIBLE; 233 * gcut_inspect_flags(string, &flags, &flags_type); 234 * -> #<GtkWidgetFlags: toplevel|visible (GTK_TOPLEVEL:0x10)|(GTK_VISIBLE:0x100)> 235 * ]| 236 * 237 * Since: 1.0.6 238 */ 239 void gcut_inspect_flags (GString *string, 240 gconstpointer data, 241 gpointer user_data); 242 243 /** 244 * gcut_inspect_enum: 245 * @string: the output string. 246 * @data: the interested target. 247 * @user_data: the pointer of GEnum type. 248 * 249 * Shows @data as value of a GEnum type. 250 * 251 * e.g.: 252 * |[ 253 * GType enum_type; 254 * GtkWidgetHelpType value; 255 * 256 * enum_type = GTK_TYPE_WIDGET_HELP_TYPE; 257 * value = GTK_WIDGET_HELP_TOOLTIP; 258 * gcut_inspect_enum(string, &value, &enum_type); 259 * -> #<GtkWidgetHelpType: tooltip(GTK_WIDGET_HELP_TOOLTIP:0)> 260 * ]| 261 * 262 * Since: 1.0.6 263 */ 264 void gcut_inspect_enum (GString *string, 265 gconstpointer data, 266 gpointer user_data); 267 268 /** 269 * gcut_inspect_pointer 270 * @string: the output string. 271 * @data: the interested target. 272 * @user_data: the data passed by user. (ignored) 273 * 274 * Shows @data as a pointer. 275 * 276 * e.g.: 277 * |[ 278 * memory = malloc(1); 279 * gcut_inspect_pointer(string, memory, NULL) -> "#<0xXXXXXXX>" 280 * ]| 281 * 282 * Since: 1.0.6 283 */ 284 void gcut_inspect_pointer (GString *string, 285 gconstpointer data, 286 gpointer user_data); 287 288 /** 289 * gcut_inspect_boolean: 290 * @string: the output string. 291 * @data: the interested target. 292 * @user_data: the data passed by user. (ignored) 293 * 294 * Shows @data as boolean. 295 * 296 * e.g.: 297 * |[ 298 * gboolean boolean_value; 299 300 * boolean_value = TRUE; 301 * gcut_inspect_boolean(string, &boolean_value, NULL) -> "TRUE" 302 * boolean_value = FALSE; 303 * gcut_inspect_boolean(string, &boolean_value, NULL) -> "FALSE" 304 * ]| 305 * 306 * Since: 1.1.3 307 */ 308 void gcut_inspect_boolean (GString *string, 309 gconstpointer data, 310 gpointer user_data); 311 312 /** 313 * gcut_inspect_double: 314 * @string: the output string. 315 * @data: the interested target. 316 * @user_data: the data passed by user. (ignored) 317 * 318 * Shows @data as double floating point number. 319 * 320 * e.g.: 321 * |[ 322 * gdouble double_value = 2.9; 323 * gcut_inspect_double(string, &double_value, NULL) -> "2.9" 324 * ]| 325 * 326 * Since: 1.1.3 327 */ 328 void gcut_inspect_double (GString *string, 329 gconstpointer data, 330 gpointer user_data); 331 332 G_END_DECLS 333 334 #endif /* __GCUT_INSPECT_H__ */ 335 336 /* 337 vi:nowrap:ai:expandtab:sw=4:ts=4 338 */ 339