alternative to assert
[gtkD.git] / src / glib / Messages.d
blob8208c1da7f8322685eb6a565ed12a8313b7a6a40
1 /*
2 * This file is part of duit.
4 * duit is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * duit is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with duit; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = glib-Warnings-and-Assertions.html
26 * outPack = glib
27 * outFile = Messages
28 * strct =
29 * realStrct=
30 * ctorStrct=
31 * clss = Messages
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - g_
40 * omit structs:
41 * omit prefixes:
42 * omit code:
43 * imports:
44 * - glib.Str
45 * structWrap:
46 * local aliases:
49 module glib.Messages;
51 private import glib.glibtypes;
53 private import lib.glib;
55 private import glib.Str;
57 /**
58 * Description
59 * These functions provide support for outputting messages.
61 public class Messages
64 /**
67 /**
68 * Outputs a formatted message via the print handler.
69 * The default print handler simply outputs the message to stdout.
70 * g_print() should not be used from within libraries for debugging messages,
71 * since it may be redirected by applications to special purpose message
72 * windows or even files.
73 * Instead, libraries should use g_log(), or the convenience functions
74 * g_message(), g_warning() and g_error().
75 * format:
76 * the message format. See the printf()
77 * documentation.
78 * ...:
79 * the parameters to insert into the format string.
81 public static void print(char[] format, ... )
83 // void g_print (const gchar *format, ...);
84 g_print(Str.toStringz(format));
87 /**
88 * Sets the print handler.
89 * Any messages passed to g_print() will be output via the new handler.
90 * The default handler simply outputs the message to stdout.
91 * By providing your own handler you can redirect the output, to a GTK+
92 * widget or a log file for example.
93 * func:
94 * the new print handler.
95 * Returns:
96 * the old print handler.
98 public static GPrintFunc setPrintHandler(GPrintFunc func)
100 // GPrintFunc g_set_print_handler (GPrintFunc func);
101 return g_set_print_handler(func);
106 * Outputs a formatted message via the error message handler.
107 * The default handler simply outputs the message to stderr.
108 * g_printerr() should not be used from within libraries. Instead g_log() should
109 * be used, or the convenience functions g_message(), g_warning() and g_error().
110 * format:
111 * the message format. See the printf()
112 * documentation.
113 * ...:
114 * the parameters to insert into the format string.
116 public static void printerr(char[] format, ... )
118 // void g_printerr (const gchar *format, ...);
119 g_printerr(Str.toStringz(format));
123 * Sets the handler for printing error messages.
124 * Any messages passed to g_printerr() will be output via the new handler.
125 * The default handler simply outputs the message to stderr.
126 * By providing your own handler you can redirect the output, to a GTK+
127 * widget or a log file for example.
128 * func:
129 * the new error message handler.
130 * Returns:
131 * the old error message handler.
133 public static GPrintFunc setPrinterrHandler(GPrintFunc func)
135 // GPrintFunc g_set_printerr_handler (GPrintFunc func);
136 return g_set_printerr_handler(func);
146 * Prompts the user with [E]xit, [H]alt, show [S]tack trace or [P]roceed.
147 * This function is intended to be used for debugging use only. The following
148 * example shows how it can be used together with the g_log() functions.
149 * #include <glib.h>
150 * static void
151 * log_handler (const gchar *log_domain,
152 * GLogLevelFlags log_level,
153 * const gchar *message,
154 * gpointer user_data)
156 * g_log_default_handler (log_domain, log_level, message, user_data);
157 * g_on_error_query (MY_PROGRAM_NAME);
159 * int main (int argc, char *argv[])
161 * g_log_set_handler (MY_LOG_DOMAIN,
162 * G_LOG_LEVEL_WARNING |
163 * G_LOG_LEVEL_ERROR |
164 * G_LOG_LEVEL_CRITICAL,
165 * log_handler,
166 * NULL);
167 * /+* ... +/
168 * If [E]xit is selected, the application terminates with a call to
169 * _exit(0).
170 * If [H]alt is selected, the application enters an infinite loop.
171 * The infinite loop can only be stopped by killing the application,
172 * or by setting glib_on_error_halt to FALSE (possibly via a debugger).
173 * If [S]tack trace is selected, g_on_error_stack_trace() is called. This
174 * invokes gdb, which attaches to the current process and shows a stack trace.
175 * The prompt is then shown again.
176 * If [P]roceed is selected, the function returns.
177 * This function may cause different actions on non-UNIX platforms.
178 * prg_name:
179 * the program name, needed by gdb for the [S]tack trace option.
180 * If prg_name is NULL, g_get_prgname() is called to get the program name
181 * (which will work correctly if gdk_init() or gtk_init() has been called).
183 public static void onErrorQuery(char[] prgName)
185 // void g_on_error_query (const gchar *prg_name);
186 g_on_error_query(Str.toStringz(prgName));
190 * Invokes gdb, which attaches to the current process and shows a stack trace.
191 * Called by g_on_error_query() when the [S]tack trace option is selected.
192 * This function may cause different actions on non-UNIX platforms.
193 * prg_name:
194 * the program name, needed by gdb for the [S]tack trace option.
195 * If prg_name is NULL, g_get_prgname() is called to get the program name
196 * (which will work correctly if gdk_init() or gtk_init() has been called).
198 public static void onErrorStackTrace(char[] prgName)
200 // void g_on_error_stack_trace (const gchar *prg_name);
201 g_on_error_stack_trace(Str.toStringz(prgName));