]> saetta.ns0.it Git - libzakcgi/commitdiff
Started form implementation.
authorAndrea Zagli <azagli@libero.it>
Sun, 2 Aug 2015 08:00:18 +0000 (10:00 +0200)
committerAndrea Zagli <azagli@libero.it>
Mon, 24 Aug 2015 14:10:16 +0000 (16:10 +0200)
src/Makefile.am
src/form.c [new file with mode: 0644]
src/form.h [new file with mode: 0644]
src/formelement.c [new file with mode: 0644]
src/formelement.h [new file with mode: 0644]
src/libzakcgi.h

index 8dcaea6178c6632cdd00ef46e89a4c5875383c03..3f2c79aaa7d7b10c04e9b0823c4120eaa3ce7843 100644 (file)
@@ -5,14 +5,20 @@ AM_CPPFLAGS = $(ZAKCGI_CFLAGS) \
 
 lib_LTLIBRARIES = libzakcgi.la
 
-libzakcgi_la_SOURCES = main.c \
+libzakcgi_la_SOURCES = \
+                       form.c \
+                       formelement.c \
+                       main.c \
                        session.c \
                        tag.c \
                        url.c
 
 libzakcgi_la_LDFLAGS = -no-undefined
 
-libzakcgi_include_HEADERS = libzakcgi.h \
+libzakcgi_include_HEADERS = \
+                            libzakcgi.h \
+                            form.h \
+                            formelement.h \
                             main.h \
                             session.h \
                             tag.h \
diff --git a/src/form.c b/src/form.c
new file mode 100644 (file)
index 0000000..0efed69
--- /dev/null
@@ -0,0 +1,148 @@
+/*
+ * Copyright (C) 2015 Andrea Zagli <azagli@libero.it>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifdef HAVE_CONFIG_H
+       #include <config.h>
+#endif
+
+#include <syslog.h>
+
+#include "form.h"
+
+static void zak_cgi_form_class_init (ZakCgiFormClass *class);
+static void zak_cgi_form_init (ZakCgiForm *zak_cgi_form);
+
+static void zak_cgi_form_set_property (GObject *object,
+                               guint property_id,
+                               const GValue *value,
+                               GParamSpec *pspec);
+static void zak_cgi_form_get_property (GObject *object,
+                               guint property_id,
+                               GValue *value,
+                               GParamSpec *pspec);
+
+static void zak_cgi_form_dispose (GObject *gobject);
+static void zak_cgi_form_finalize (GObject *gobject);
+
+#define ZAK_CGI_FORM_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ZAK_CGI_TYPE_FORM, ZakCgiFormPrivate))
+
+typedef struct _ZakCgiFormPrivate ZakCgiFormPrivate;
+struct _ZakCgiFormPrivate
+       {
+               ZakCgiMain *zakcgimain;
+       };
+
+G_DEFINE_TYPE (ZakCgiForm, zak_cgi_form, G_TYPE_OBJECT)
+
+static void
+zak_cgi_form_class_init (ZakCgiFormClass *class)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (class);
+
+       object_class->set_property = zak_cgi_form_set_property;
+       object_class->get_property = zak_cgi_form_get_property;
+       object_class->dispose = zak_cgi_form_dispose;
+       object_class->finalize = zak_cgi_form_finalize;
+
+       g_type_class_add_private (object_class, sizeof (ZakCgiFormPrivate));
+}
+
+static void
+zak_cgi_form_init (ZakCgiForm *zak_cgi_form)
+{
+       ZakCgiFormPrivate *priv = ZAK_CGI_FORM_GET_PRIVATE (zak_cgi_form);
+
+       priv->zakcgimain = NULL;
+}
+
+/**
+ * zak_cgi_form_new:
+ * @zakcgimain:
+ *
+ * Returns: the newly created #ZakCgiForm object.
+ */
+ZakCgiForm
+*zak_cgi_form_new (ZakCgiMain *zakcgimain)
+{
+       ZakCgiForm *zak_cgi_form;
+       ZakCgiFormPrivate *priv;
+
+       zak_cgi_form = ZAK_CGI_FORM (g_object_new (zak_cgi_form_get_type (), NULL));
+
+       priv = ZAK_CGI_FORM_GET_PRIVATE (zak_cgi_form);
+       priv->zakcgimain = zakcgimain;
+
+       return zak_cgi_form;
+}
+
+/* PRIVATE */
+static void
+zak_cgi_form_set_property (GObject *object,
+                   guint property_id,
+                   const GValue *value,
+                   GParamSpec *pspec)
+{
+       ZakCgiForm *zak_cgi_form = (ZakCgiForm *)object;
+       ZakCgiFormPrivate *priv = ZAK_CGI_FORM_GET_PRIVATE (zak_cgi_form);
+
+       switch (property_id)
+               {
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+               }
+}
+
+static void
+zak_cgi_form_get_property (GObject *object,
+                   guint property_id,
+                   GValue *value,
+                   GParamSpec *pspec)
+{
+       ZakCgiForm *zak_cgi_form = (ZakCgiForm *)object;
+       ZakCgiFormPrivate *priv = ZAK_CGI_FORM_GET_PRIVATE (zak_cgi_form);
+
+       switch (property_id)
+               {
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+               }
+}
+
+static void
+zak_cgi_form_dispose (GObject *gobject)
+{
+       ZakCgiForm *zak_cgi_form = (ZakCgiForm *)gobject;
+       ZakCgiFormPrivate *priv = ZAK_CGI_FORM_GET_PRIVATE (zak_cgi_form);
+
+
+       GObjectClass *parent_class = g_type_class_peek_parent (G_OBJECT_GET_CLASS (gobject));
+       parent_class->dispose (gobject);
+}
+
+static void
+zak_cgi_form_finalize (GObject *gobject)
+{
+       ZakCgiForm *zak_cgi_form = (ZakCgiForm *)gobject;
+       ZakCgiFormPrivate *priv = ZAK_CGI_FORM_GET_PRIVATE (zak_cgi_form);
+
+
+       GObjectClass *parent_class = g_type_class_peek_parent (G_OBJECT_GET_CLASS (gobject));
+       parent_class->finalize (gobject);
+}
diff --git a/src/form.h b/src/form.h
new file mode 100644 (file)
index 0000000..785ba72
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2015 Andrea Zagli <azagli@libero.it>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef __ZAK_CGI_FORM_H__
+#define __ZAK_CGI_FORM_H__
+
+
+#include <glib-object.h>
+
+#include "main.h"
+
+
+G_BEGIN_DECLS
+
+
+#define ZAK_CGI_TYPE_FORM                 (zak_cgi_form_get_type ())
+#define ZAK_CGI_FORM(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), ZAK_CGI_TYPE_FORM, ZakCgiForm))
+#define ZAK_CGI_FORM_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), ZAK_CGI_TYPE_FORM, ZakCgiFormClass))
+#define ZAK_CGI_IS_FORM(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ZAK_CGI_TYPE_FORM))
+#define ZAK_CGI_IS_FORM_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), ZAK_CGI_TYPE_FORM))
+#define ZAK_CGI_FORM_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), ZAK_CGI_TYPE_FORM, ZakCgiFormClass))
+
+typedef struct _ZakCgiForm ZakCgiForm;
+typedef struct _ZakCgiFormClass ZakCgiFormClass;
+
+struct _ZakCgiForm
+       {
+               GObject parent_instance;
+       };
+
+struct _ZakCgiFormClass
+       {
+               GObjectClass parent_class;
+       };
+
+GType zak_cgi_form_get_type (void);
+
+
+ZakCgiForm *zak_cgi_form_new (ZakCgiMain *zakcgimain);
+
+
+G_END_DECLS
+
+
+#endif /* __ZAK_CGI_FORM_H__ */
diff --git a/src/formelement.c b/src/formelement.c
new file mode 100644 (file)
index 0000000..ebbb431
--- /dev/null
@@ -0,0 +1,146 @@
+/*
+ * Copyright (C) 2015 Andrea Zagli <azagli@libero.it>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifdef HAVE_CONFIG_H
+       #include <config.h>
+#endif
+
+#include <syslog.h>
+
+#include "formelement.h"
+
+static void zak_cgi_form_element_class_init (ZakCgiFormElementClass *class);
+static void zak_cgi_form_element_init (ZakCgiFormElement *zak_cgi_form_element);
+
+static void zak_cgi_form_element_set_property (GObject *object,
+                               guint property_id,
+                               const GValue *value,
+                               GParamSpec *pspec);
+static void zak_cgi_form_element_get_property (GObject *object,
+                               guint property_id,
+                               GValue *value,
+                               GParamSpec *pspec);
+
+static void zak_cgi_form_element_dispose (GObject *gobject);
+static void zak_cgi_form_element_finalize (GObject *gobject);
+
+#define ZAK_CGI_FORM_ELEMENT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ZAK_CGI_TYPE_FORM_ELEMENT, ZakCgiFormElementPrivate))
+
+typedef struct _ZakCgiFormElementPrivate ZakCgiFormElementPrivate;
+struct _ZakCgiFormElementPrivate
+       {
+       };
+
+G_DEFINE_TYPE (ZakCgiFormElement, zak_cgi_form_element, G_TYPE_OBJECT)
+
+static void
+zak_cgi_form_element_class_init (ZakCgiFormElementClass *class)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (class);
+
+       object_class->set_property = zak_cgi_form_element_set_property;
+       object_class->get_property = zak_cgi_form_element_get_property;
+       object_class->dispose = zak_cgi_form_element_dispose;
+       object_class->finalize = zak_cgi_form_element_finalize;
+
+       g_type_class_add_private (object_class, sizeof (ZakCgiFormElementPrivate));
+}
+
+static void
+zak_cgi_form_element_init (ZakCgiFormElement *zak_cgi_form_element)
+{
+       ZakCgiFormElementPrivate *priv = ZAK_CGI_FORM_ELEMENT_GET_PRIVATE (zak_cgi_form_element);
+
+
+}
+
+/**
+ * zak_cgi_form_element_new:
+ *
+ * Returns: the newly created #ZakCgiFormElement object.
+ */
+ZakCgiFormElement
+*zak_cgi_form_element_new (void)
+{
+       ZakCgiFormElement *zak_cgi_form_element;
+       ZakCgiFormElementPrivate *priv;
+
+       zak_cgi_form_element = ZAK_CGI_FORM_ELEMENT (g_object_new (zak_cgi_form_element_get_type (), NULL));
+
+       priv = ZAK_CGI_FORM_ELEMENT_GET_PRIVATE (zak_cgi_form_element);
+
+       return zak_cgi_form_element;
+}
+
+/* PRIVATE */
+static void
+zak_cgi_form_element_set_property (GObject *object,
+                   guint property_id,
+                   const GValue *value,
+                   GParamSpec *pspec)
+{
+       ZakCgiFormElement *zak_cgi_form_element = (ZakCgiFormElement *)object;
+       ZakCgiFormElementPrivate *priv = ZAK_CGI_FORM_ELEMENT_GET_PRIVATE (zak_cgi_form_element);
+
+       switch (property_id)
+               {
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+               }
+}
+
+static void
+zak_cgi_form_element_get_property (GObject *object,
+                   guint property_id,
+                   GValue *value,
+                   GParamSpec *pspec)
+{
+       ZakCgiFormElement *zak_cgi_form_element = (ZakCgiFormElement *)object;
+       ZakCgiFormElementPrivate *priv = ZAK_CGI_FORM_ELEMENT_GET_PRIVATE (zak_cgi_form_element);
+
+       switch (property_id)
+               {
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+               }
+}
+
+static void
+zak_cgi_form_element_dispose (GObject *gobject)
+{
+       ZakCgiFormElement *zak_cgi_form_element = (ZakCgiFormElement *)gobject;
+       ZakCgiFormElementPrivate *priv = ZAK_CGI_FORM_ELEMENT_GET_PRIVATE (zak_cgi_form_element);
+
+
+       GObjectClass *parent_class = g_type_class_peek_parent (G_OBJECT_GET_CLASS (gobject));
+       parent_class->dispose (gobject);
+}
+
+static void
+zak_cgi_form_element_finalize (GObject *gobject)
+{
+       ZakCgiFormElement *zak_cgi_form_element = (ZakCgiFormElement *)gobject;
+       ZakCgiFormElementPrivate *priv = ZAK_CGI_FORM_ELEMENT_GET_PRIVATE (zak_cgi_form_element);
+
+
+
+       GObjectClass *parent_class = g_type_class_peek_parent (G_OBJECT_GET_CLASS (gobject));
+       parent_class->finalize (gobject);
+}
diff --git a/src/formelement.h b/src/formelement.h
new file mode 100644 (file)
index 0000000..561bec7
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2015 Andrea Zagli <azagli@libero.it>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef __ZAK_CGI_FORM_ELEMENT_H__
+#define __ZAK_CGI_FORM_ELEMENT_H__
+
+
+#include <glib-object.h>
+
+#include "main.h"
+
+
+G_BEGIN_DECLS
+
+
+#define ZAK_CGI_TYPE_FORM_ELEMENT                 (zak_cgi_form_element_get_type ())
+#define ZAK_CGI_FORM_ELEMENT(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), ZAK_CGI_TYPE_FORM_ELEMENT, ZakCgiFormElement))
+#define ZAK_CGI_FORM_ELEMENT_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), ZAK_CGI_TYPE_FORM_ELEMENT, ZakCgiFormElementClass))
+#define ZAK_CGI_IS_FORM_ELEMENT(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ZAK_CGI_TYPE_FORM_ELEMENT))
+#define ZAK_CGI_IS_FORM_ELEMENT_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), ZAK_CGI_TYPE_FORM_ELEMENT))
+#define ZAK_CGI_FORM_ELEMENT_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), ZAK_CGI_TYPE_FORM_ELEMENT, ZakCgiFormElementClass))
+
+typedef struct _ZakCgiFormElement ZakCgiFormElement;
+typedef struct _ZakCgiFormElementClass ZakCgiFormElementClass;
+
+struct _ZakCgiFormElement
+       {
+               GObject parent_instance;
+       };
+
+struct _ZakCgiFormElementClass
+       {
+               GObjectClass parent_class;
+       };
+
+
+GType zak_cgi_form_element_get_type (void);
+
+ZakCgiFormElement *zak_cgi_form_element_new (void);
+
+
+G_END_DECLS
+
+
+#endif /* __ZAK_CGI_FORM_ELEMENT_H__ */
index b33731e280453bdd85ed1f2f49f934afa7b6876f..d7d750c1f5bcd03149022a7b3f7278a7c42ed6c7 100644 (file)
@@ -20,6 +20,7 @@
 #define __LIBZAKCGI_H__
 
 #include <libzakcgi/main.h>
+#include <libzakcgi/form.h>
 #include <libzakcgi/session.h>
 #include <libzakcgi/tag.h>
 #include <libzakcgi/url.h>