parsing of booleans in glib?



  I was thinking of submitting a couple of trivial functions for
inclusion in GLib:
	gboolean g_boolean_read(const gchar *str);
	const gchar* g_boolean_write(gboolean val);

  g_boolean_read would accept any string like "1" "0" "true" "false"
"yes" "no" "on" "off", and do strcasecmp to obtain a boolean value.

  g_boolean_write would simply return a const string ("True" or
"False"), and can be a simple #define.

  Or is it too trivial to include in GLib?  In such case, I would argue
that 'typedef int gint' is even more trivial! :)

-- 
Gustavo J. A. M. Carneiro
<gjc inescporto pt> <gustavo users sourceforge net>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]