#include <config.h>
#endif
+#include <stdlib.h>
+
#include <gio/gio.h>
#include <string.h>
return zak_cgi_session_get_value_full (session, "SESSION", name);
}
+/**
+ * zak_cgi_session_set_value_full_int:
+ * @session:
+ * @group:
+ * @name:
+ * @value:
+ *
+ */
+void
+zak_cgi_session_set_value_full_int (ZakCgiSession *session, const gchar *group, const gchar *name, gint value)
+{
+ gchar *str;
+
+ str = g_strdup_printf ("%d", value);
+ zak_cgi_session_set_value_full (session, group, name, str);
+ g_free (str);
+}
+
+/**
+ * zak_cgi_session_set_value_full_double:
+ * @session:
+ * @group:
+ * @name:
+ * @value:
+ *
+ */
+void
+zak_cgi_session_set_value_full_double (ZakCgiSession *session, const gchar *group, const gchar *name, gdouble value)
+{
+ gchar *str;
+
+ str = g_strdup_printf ("%f", value);
+ zak_cgi_session_set_value_full (session, group, name, str);
+ g_free (str);
+}
+
+/**
+ * zak_cgi_session_set_value_full_boolean:
+ * @session:
+ * @group:
+ * @name:
+ * @value:
+ *
+ */
+void
+zak_cgi_session_set_value_full_boolean (ZakCgiSession *session, const gchar *group, const gchar *name, gboolean value)
+{
+ zak_cgi_session_set_value_full_int (session, group, name, (gint)value);
+}
+
+/**
+ * zak_cgi_session_get_value_full_int:
+ * @session:
+ * @group:
+ * @name:
+ *
+ * Returns:
+ */
+gint
+zak_cgi_session_get_value_full_int (ZakCgiSession *session, const gchar *group, const gchar *name)
+{
+ gchar *str;
+ gint ret;
+
+ str = zak_cgi_session_get_value_full (session, group, name);
+ ret = strtol (str, NULL, 10);
+ g_free (str);
+
+ return ret;
+}
+
+/**
+ * zak_cgi_session_get_value_full_double:
+ * @session:
+ * @group:
+ * @name:
+ *
+ * Returns:
+ */
+gdouble
+zak_cgi_session_get_value_full_double (ZakCgiSession *session, const gchar *group, const gchar *name)
+{
+ gchar *str;
+ gdouble ret;
+
+ str = zak_cgi_session_get_value_full (session, group, name);
+ ret = g_strtod (str, NULL);
+ g_free (str);
+
+ return ret;
+}
+
+/**
+ * zak_cgi_session_get_value_full_boolean:
+ * @session:
+ * @group:
+ * @name:
+ *
+ * Returns:
+ */
+gboolean
+zak_cgi_session_get_value_full_boolean (ZakCgiSession *session, const gchar *group, const gchar *name)
+{
+ return (gboolean)zak_cgi_session_get_value_full_int (session, group, name);
+}
+
/**
* zak_cgi_session_close:
* @session:
void zak_cgi_session_set_value (ZakCgiSession *session, const gchar *name, const gchar *value);
gchar *zak_cgi_session_get_value (ZakCgiSession *session, const gchar *name);
+void zak_cgi_session_set_value_full_int (ZakCgiSession *session, const gchar *group, const gchar *name, gint value);
+void zak_cgi_session_set_value_full_double (ZakCgiSession *session, const gchar *group, const gchar *name, gdouble value);
+void zak_cgi_session_set_value_full_boolean (ZakCgiSession *session, const gchar *group, const gchar *name, gboolean value);
+
+gint zak_cgi_session_get_value_full_int (ZakCgiSession *session, const gchar *group, const gchar *name);
+gdouble zak_cgi_session_get_value_full_double (ZakCgiSession *session, const gchar *group, const gchar *name);
+gboolean zak_cgi_session_get_value_full_boolean (ZakCgiSession *session, const gchar *group, const gchar *name);
+
void zak_cgi_session_close (ZakCgiSession *session);
ht_stdin = zak_cgi_main_parse_stdin (env, boundary[1]);
if (g_hash_table_lookup (ht_stdin, "reset") != NULL)
{
- g_warning ("Session: %s", zak_cgi_session_get_value_full (session, "NEW GROUP", "new key"));
+ g_warning ("new key: %s", zak_cgi_session_get_value_full (session, "NEW GROUP", "new key"));
+ g_warning ("new int: %d", zak_cgi_session_get_value_full_int (session, "NEW GROUP", "new int"));
+ g_warning ("new double: %f", zak_cgi_session_get_value_full_double (session, "NEW GROUP", "new double"));
+ g_warning ("new boolean: %d", zak_cgi_session_get_value_full_boolean (session, "NEW GROUP", "new boolean"));
zak_cgi_session_set_value (session, "user_name", NULL);
zak_cgi_session_set_value_full (session, "NEW GROUP", NULL, NULL);
else
{
zak_cgi_session_set_value_full (session, "NEW GROUP", "new key", "new value");
+ zak_cgi_session_set_value_full_int (session, "NEW GROUP", "new int", 55);
+ zak_cgi_session_set_value_full_double (session, "NEW GROUP", "new double", 123.66);
+ zak_cgi_session_set_value_full_boolean (session, "NEW GROUP", "new boolean", TRUE);
g_string_append (str, ", on the second page.<br/><br/>");
g_string_append (str,