typedef GObject *(* FormElementExtensionConstructorFunc) (void);
typedef gboolean (* FormElementExtensionXmlParsingFunc) (GObject *, xmlNodePtr);
typedef ZakFormElementFilter *(* FormElementFilterConstructorFunc) (void);
-typedef gboolean (* FormElementFilterXmlParsingFunc) (ZakFormElementFilter *, xmlNodePtr);
typedef ZakFormElementValidator *(* FormElementValidatorConstructorFunc) (void);
typedef ZakFormValidator *(* FormValidatorConstructorFunc) (void);
FormElementExtensionConstructorFunc extension_constructor;
FormElementExtensionXmlParsingFunc extension_xml_parsing;
FormElementFilterConstructorFunc filter_constructor;
- FormElementFilterXmlParsingFunc filter_xml_parsing;
FormElementValidatorConstructorFunc validator_constructor;
gboolean to_unlink;
filter = filter_constructor ();
zak_form_element_add_filter (element, filter);
- if (g_module_symbol ((GModule *)g_ptr_array_index (priv->ar_modules, i),
- g_strconcat (type, "_xml_parsing", NULL),
- (gpointer *)&filter_xml_parsing))
- {
- if (filter_xml_parsing != NULL)
- {
- filter_xml_parsing (filter, xnode);
- }
- }
+ zak_form_element_filter_xml_parsing (filter, xnode);
break;
}
to_unlink = TRUE;
}
- else if (xmlStrcmp (xnode->name, (const xmlChar *)"validator") == 0)
+ else if (xmlStrcmp (xnode->name, (const xmlChar *)"validator") == 0)
{
type = xmlGetProp (xnode, (const xmlChar *)"type");
value = zak_form_element_get_value (element);
val = zak_form_element_filter_filter ((ZakFormElementFilter *)g_ptr_array_index (priv->pa_filters, i),
- value);
+ value);
zak_form_element_set_value (element, val);
}
}
static void zak_form_element_filter_init (ZakFormElementFilter *zak_form_element_filter);
static void zak_form_element_filter_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec);
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
static void zak_form_element_filter_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec);
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
static void zak_form_element_filter_dispose (GObject *gobject);
static void zak_form_element_filter_finalize (GObject *gobject);
object_class->finalize = zak_form_element_filter_finalize;
g_object_class_install_property (object_class, PROP_ENABLED,
- g_param_spec_boolean ("enabled",
- "Enabled",
- "Enabled",
- TRUE,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+ g_param_spec_boolean ("enabled",
+ "Enabled",
+ "Enabled",
+ TRUE,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
}
static void
ZakFormElementFilterPrivate *priv = zak_form_element_filter_get_instance_private (zak_form_element_filter);
}
+gboolean
+zak_form_element_filter_xml_parsing (ZakFormElementFilter *self, xmlNode *xnode)
+{
+ gboolean ret;
+
+ g_return_val_if_fail (ZAK_FORM_IS_ELEMENT_FILTER (self), FALSE);
+
+ if (ZAK_FORM_ELEMENT_FILTER_GET_CLASS (self)->xml_parsing!= NULL)
+ {
+ ret = ZAK_FORM_ELEMENT_FILTER_GET_CLASS (self)->xml_parsing (self, xnode);
+ }
+ else
+ {
+ ret = FALSE;
+ }
+
+ return ret;
+}
+
gchar
*zak_form_element_filter_filter (ZakFormElementFilter *self, const gchar *value)
{
/* PRIVATE */
static void
zak_form_element_filter_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
ZakFormElementFilter *zak_form_element_filter = (ZakFormElementFilter *)object;
ZakFormElementFilterPrivate *priv = zak_form_element_filter_get_instance_private (zak_form_element_filter);
static void
zak_form_element_filter_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
ZakFormElementFilter *zak_form_element_filter = (ZakFormElementFilter *)object;
ZakFormElementFilterPrivate *priv = zak_form_element_filter_get_instance_private (zak_form_element_filter);
#include <glib-object.h>
+#include <libxml/xpath.h>
+
G_BEGIN_DECLS
{
GObjectClass parent_cleass;
+ gboolean (*xml_parsing) (ZakFormElementFilter *filter, xmlNode *xnode);
gchar *(*filter) (ZakFormElementFilter *self, const gchar *value);
};
+gboolean zak_form_element_filter_xml_parsing (ZakFormElementFilter *filter, xmlNode *xnode);
gchar *zak_form_element_filter_filter (ZakFormElementFilter *self, const gchar *value);
gboolean zak_form_element_filter_get_enabled (ZakFormElementFilter *filter);
/*
- * Copyright (C) 2015 Andrea Zagli <azagli@libero.it>
+ * Copyright (C) 2015-2017 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
static void zak_form_element_filter_luc_dispose (GObject *gobject);
static void zak_form_element_filter_luc_finalize (GObject *gobject);
+static gboolean zak_form_element_filter_luc_xml_parsing (ZakFormElementFilter *filter, xmlNode *xnode);
static gchar *zak_form_element_filter_luc_filter (ZakFormElementFilter *filter_luc, const gchar *value);
enum
object_class->dispose = zak_form_element_filter_luc_dispose;
object_class->finalize = zak_form_element_filter_luc_finalize;
+ parent_class->xml_parsing = zak_form_element_filter_luc_xml_parsing;
parent_class->filter = zak_form_element_filter_luc_filter;
g_type_class_add_private (object_class, sizeof (ZakFormElementFilterLucPrivate));
* @xnode:
*
*/
-gboolean
+static gboolean
zak_form_element_filter_luc_xml_parsing (ZakFormElementFilter *filter, xmlNode *xnode)
{
gchar *content;
/* PRIVATE */
static void
zak_form_element_filter_luc_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
ZakFormElementFilterLuc *zak_form_element = (ZakFormElementFilterLuc *)object;
ZakFormElementFilterLucPrivate *priv = ZAK_FORM_ELEMENT_FILTER_LUC_GET_PRIVATE (zak_form_element);
static void
zak_form_element_filter_luc_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
ZakFormElementFilterLuc *zak_form_element = (ZakFormElementFilterLuc *)object;
ZakFormElementFilterLucPrivate *priv = ZAK_FORM_ELEMENT_FILTER_LUC_GET_PRIVATE (zak_form_element);
static gchar
*zak_form_element_filter_luc_filter (ZakFormElementFilter *filter_luc,
- const gchar *value)
+ const gchar *value)
{
gchar *ret;
gchar *_value;
/*
- * Copyright (C) 2015 Andrea Zagli <azagli@libero.it>
+ * Copyright (C) 2015-2017 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
G_DECLARE_FINAL_TYPE (ZakFormElementFilterLuc, zak_form_element_filter_luc, ZAK_FORM, ELEMENT_FILTER_LUC, ZakFormElementFilter)
ZakFormElementFilterLuc *zak_form_element_filter_luc_new (void);
-gboolean zak_form_element_filter_luc_xml_parsing (ZakFormElementFilter *filter, xmlNode *xnode);
G_END_DECLS
/*
- * Copyright (C) 2015 Andrea Zagli <azagli@libero.it>
+ * Copyright (C) 2015-2017 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
static void zak_form_element_filter_trim_init (ZakFormElementFilterTrim *zak_form_element);
static void zak_form_element_filter_trim_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec);
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
static void zak_form_element_filter_trim_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec);
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
static void zak_form_element_filter_trim_dispose (GObject *gobject);
static void zak_form_element_filter_trim_finalize (GObject *gobject);
+static gboolean zak_form_element_filter_trim_xml_parsing (ZakFormElementFilter *filter, xmlNode *xnode);
static gchar *zak_form_element_filter_trim_filter (ZakFormElementFilter *filter_trim, const gchar *value);
struct _ZakFormElementFilterTrim
object_class->dispose = zak_form_element_filter_trim_dispose;
object_class->finalize = zak_form_element_filter_trim_finalize;
+ parent_class->xml_parsing = zak_form_element_filter_trim_xml_parsing;
parent_class->filter = zak_form_element_filter_trim_filter;
g_type_class_add_private (object_class, sizeof (ZakFormElementFilterTrimPrivate));
* @xnode:
*
*/
-gboolean
+static gboolean
zak_form_element_filter_trim_xml_parsing (ZakFormElementFilter *filter, xmlNode *xnode)
{
/* nothing to do */
static gchar
*zak_form_element_filter_trim_filter (ZakFormElementFilter *filter_trim,
- const gchar *value)
+ const gchar *value)
{
gchar *ret;
gchar *_value;
_value = g_strdup (value);
- ret = g_strdup (g_strstrip (_value));
+ ret = g_strdup (g_strstrip (_value));
return ret;
}
/*
- * Copyright (C) 2015 Andrea Zagli <azagli@libero.it>
+ * Copyright (C) 2015-2017 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
G_DECLARE_FINAL_TYPE (ZakFormElementFilterTrim, zak_form_element_filter_trim, ZAK_FORM, ELEMENT_FILTER_TRIM, ZakFormElementFilter)
ZakFormElementFilterTrim *zak_form_element_filter_trim_new (void);
-gboolean zak_form_element_filter_trim_xml_parsing (ZakFormElementFilter *filter, xmlNode *xnode);
G_END_DECLS