--- /dev/null
+/*
+ * Copyright (C) 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
+ * 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 <libzakutils/libzakutils.h>
+
+#include "utils.h"
+#include "formelementvalidatorcodfisc.h"
+
+enum
+ {
+ PROP_0,
+ PROP_EMPTY_GOOD
+ };
+
+static void solipa_zak_form_element_validator_codfisc_class_init (SolipaZakFormElementValidatorCodfiscClass *class);
+static void solipa_zak_form_element_validator_codfisc_init (SolipaZakFormElementValidatorCodfisc *solipa_zak_form_element);
+
+static void solipa_zak_form_element_validator_codfisc_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void solipa_zak_form_element_validator_codfisc_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+
+static void solipa_zak_form_element_validator_codfisc_dispose (GObject *gobject);
+static void solipa_zak_form_element_validator_codfisc_finalize (GObject *gobject);
+
+static gboolean solipa_zak_form_element_validator_codfisc_xml_parsing (ZakFormElementValidator *validator, xmlNode *xnode);
+static gboolean solipa_zak_form_element_validator_codfisc_validate (ZakFormElementValidator *validator_codfisc, const gchar *value);
+
+struct _SolipaZakFormElementValidatorCodfisc
+{
+ ZakFormElementValidator parent_instance;
+
+ /* Other members, including private data. */
+};
+
+#define SOLIPA_ZAK_FORM_ELEMENT_VALIDATOR_CODFISC_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), SOLIPA_ZAK_FORM_TYPE_ELEMENT_VALIDATOR_CODFISC, SolipaZakFormElementValidatorCodfiscPrivate))
+
+typedef struct _SolipaZakFormElementValidatorCodfiscPrivate SolipaZakFormElementValidatorCodfiscPrivate;
+struct _SolipaZakFormElementValidatorCodfiscPrivate
+ {
+ gboolean empty_good;
+ };
+
+G_DEFINE_TYPE (SolipaZakFormElementValidatorCodfisc, solipa_zak_form_element_validator_codfisc, ZAK_FORM_TYPE_ELEMENT_VALIDATOR)
+
+static void
+solipa_zak_form_element_validator_codfisc_class_init (SolipaZakFormElementValidatorCodfiscClass *class)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (class);
+ ZakFormElementValidatorClass *parent_class = ZAK_FORM_ELEMENT_VALIDATOR_CLASS (class);
+
+ object_class->set_property = solipa_zak_form_element_validator_codfisc_set_property;
+ object_class->get_property = solipa_zak_form_element_validator_codfisc_get_property;
+ object_class->dispose = solipa_zak_form_element_validator_codfisc_dispose;
+ object_class->finalize = solipa_zak_form_element_validator_codfisc_finalize;
+
+ parent_class->xml_parsing = solipa_zak_form_element_validator_codfisc_xml_parsing;
+ parent_class->validate = solipa_zak_form_element_validator_codfisc_validate;
+
+ g_type_class_add_private (object_class, sizeof (SolipaZakFormElementValidatorCodfiscPrivate));
+
+ g_object_class_install_property (object_class, PROP_EMPTY_GOOD,
+ g_param_spec_boolean ("empty-good",
+ "Empty good",
+ "Empty good",
+ FALSE,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+}
+
+static void
+solipa_zak_form_element_validator_codfisc_init (SolipaZakFormElementValidatorCodfisc *solipa_zak_form_element)
+{
+ SolipaZakFormElementValidatorCodfiscPrivate *priv = SOLIPA_ZAK_FORM_ELEMENT_VALIDATOR_CODFISC_GET_PRIVATE (solipa_zak_form_element);
+}
+
+/**
+ * solipa_zak_form_element_validator_codfisc_new:
+ *
+ * Returns: the newly created #SolipaZakFormElementValidatorCodfisc object.
+ */
+SolipaZakFormElementValidatorCodfisc
+*solipa_zak_form_element_validator_codfisc_new ()
+{
+ SolipaZakFormElementValidatorCodfisc *solipa_zak_form_element_validator_codfisc;
+
+ solipa_zak_form_element_validator_codfisc = SOLIPA_ZAK_FORM_ELEMENT_VALIDATOR_CODFISC (g_object_new (solipa_zak_form_element_validator_codfisc_get_type (), NULL));
+
+ return solipa_zak_form_element_validator_codfisc;
+}
+
+/**
+ * solipa_zak_form_element_validator_codfisc_xml_parsing:
+ * @validator:
+ * @xnode:
+ *
+ */
+static gboolean
+solipa_zak_form_element_validator_codfisc_xml_parsing (ZakFormElementValidator *validator, xmlNode *xnode)
+{
+ SolipaZakFormElementValidatorCodfiscPrivate *priv = SOLIPA_ZAK_FORM_ELEMENT_VALIDATOR_CODFISC_GET_PRIVATE (validator);
+
+ priv->empty_good = zak_utils_string_to_boolean ((gchar *)xmlNodeGetContent (xnode));
+
+ return TRUE;
+}
+
+/**
+ * solipa_zak_form_element_validator_codfisc_set_empty_good:
+ * @validator:
+ * @empty_good
+ *
+ */
+void
+solipa_zak_form_element_validator_codfisc_set_empty_good (SolipaZakFormElementValidatorCodfisc *validator, gboolean empty_good)
+{
+ SolipaZakFormElementValidatorCodfiscPrivate *priv = SOLIPA_ZAK_FORM_ELEMENT_VALIDATOR_CODFISC_GET_PRIVATE (validator);
+
+ priv->empty_good = empty_good;
+}
+
+/**
+ * solipa_zak_form_element_validator_codfisc_get_empty_good:
+ * @validator:
+ *
+ * Returns:
+ */
+gboolean
+solipa_zak_form_element_validator_codfisc_get_empty_good (SolipaZakFormElementValidatorCodfisc *validator)
+{
+ SolipaZakFormElementValidatorCodfiscPrivate *priv = SOLIPA_ZAK_FORM_ELEMENT_VALIDATOR_CODFISC_GET_PRIVATE (validator);
+
+ return priv->empty_good;
+}
+
+/* PRIVATE */
+static void
+solipa_zak_form_element_validator_codfisc_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ SolipaZakFormElementValidatorCodfisc *validator = (SolipaZakFormElementValidatorCodfisc *)object;
+ SolipaZakFormElementValidatorCodfiscPrivate *priv = SOLIPA_ZAK_FORM_ELEMENT_VALIDATOR_CODFISC_GET_PRIVATE (validator);
+
+ switch (property_id)
+ {
+ case PROP_EMPTY_GOOD:
+ solipa_zak_form_element_validator_codfisc_set_empty_good (validator, g_value_get_boolean (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+solipa_zak_form_element_validator_codfisc_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ SolipaZakFormElementValidatorCodfisc *validator = (SolipaZakFormElementValidatorCodfisc *)object;
+ SolipaZakFormElementValidatorCodfiscPrivate *priv = SOLIPA_ZAK_FORM_ELEMENT_VALIDATOR_CODFISC_GET_PRIVATE (validator);
+
+ switch (property_id)
+ {
+ case PROP_EMPTY_GOOD:
+ g_value_set_boolean (value, solipa_zak_form_element_validator_codfisc_get_empty_good (validator));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+solipa_zak_form_element_validator_codfisc_dispose (GObject *gobject)
+{
+ SolipaZakFormElementValidatorCodfisc *validator = (SolipaZakFormElementValidatorCodfisc *)gobject;
+ SolipaZakFormElementValidatorCodfiscPrivate *priv = SOLIPA_ZAK_FORM_ELEMENT_VALIDATOR_CODFISC_GET_PRIVATE (validator);
+
+
+
+ GObjectClass *parent_class = g_type_class_peek_parent (G_OBJECT_GET_CLASS (gobject));
+ parent_class->dispose (gobject);
+}
+
+static void
+solipa_zak_form_element_validator_codfisc_finalize (GObject *gobject)
+{
+ SolipaZakFormElementValidatorCodfisc *validator = (SolipaZakFormElementValidatorCodfisc *)gobject;
+ SolipaZakFormElementValidatorCodfiscPrivate *priv = SOLIPA_ZAK_FORM_ELEMENT_VALIDATOR_CODFISC_GET_PRIVATE (validator);
+
+
+
+ GObjectClass *parent_class = g_type_class_peek_parent (G_OBJECT_GET_CLASS (gobject));
+ parent_class->finalize (gobject);
+}
+
+static gboolean
+solipa_zak_form_element_validator_codfisc_validate (ZakFormElementValidator *validator,
+ const gchar *value)
+{
+ SolipaZakFormElementValidatorCodfiscPrivate *priv = SOLIPA_ZAK_FORM_ELEMENT_VALIDATOR_CODFISC_GET_PRIVATE (validator);
+
+ g_return_val_if_fail (value != NULL, FALSE);
+
+ return solipa_chk_codice_fiscale (value, priv->empty_good);
+}
--- /dev/null
+/*
+ * Copyright (C) 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
+ * 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 __SOLIPA_ZAK_FORM_ELEMENT_VALIDATOR_CODFISC_H__
+#define __SOLIPA_ZAK_FORM_ELEMENT_VALIDATOR_CODFISC_H__
+
+
+#include <glib-object.h>
+
+#include <libxml/tree.h>
+
+#include <libzakform/libzakform.h>
+
+
+G_BEGIN_DECLS
+
+
+#define SOLIPA_ZAK_FORM_TYPE_ELEMENT_VALIDATOR_CODFISC solipa_zak_form_element_validator_codfisc_get_type ()
+G_DECLARE_FINAL_TYPE (SolipaZakFormElementValidatorCodfisc, solipa_zak_form_element_validator_codfisc, SOLIPA_ZAK_FORM, ELEMENT_VALIDATOR_CODFISC, ZakFormElementValidator)
+
+SolipaZakFormElementValidatorCodfisc *solipa_zak_form_element_validator_codfisc_new (void);
+
+void solipa_zak_form_element_validator_codfisc_set_empty_good (SolipaZakFormElementValidatorCodfisc *validator, gboolean empty_godd);
+gboolean solipa_zak_form_element_validator_codfisc_get_empty_good (SolipaZakFormElementValidatorCodfisc *validator);
+
+
+G_END_DECLS
+
+
+#endif /* __SOLIPA_ZAK_FORM_ELEMENT_VALIDATOR_CODFISC_H__ */