/* contacts-io-parser.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from contacts-io-parser.vala, do not modify */

/*
 * Copyright (C) 2021 Niels De Graef <nielsdegraef@gmail.com>
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */

#include <glib-object.h>
#include <gio/gio.h>
#include "contactscore.h"
#include <glib.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define CONTACTS_IO_TYPE_PARSER (contacts_io_parser_get_type ())
#define CONTACTS_IO_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_IO_TYPE_PARSER, ContactsIoParser))
#define CONTACTS_IO_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_IO_TYPE_PARSER, ContactsIoParserClass))
#define CONTACTS_IO_IS_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_IO_TYPE_PARSER))
#define CONTACTS_IO_IS_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_IO_TYPE_PARSER))
#define CONTACTS_IO_PARSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_IO_TYPE_PARSER, ContactsIoParserClass))

typedef struct _ContactsIoParser ContactsIoParser;
typedef struct _ContactsIoParserClass ContactsIoParserClass;
typedef struct _ContactsIoParserPrivate ContactsIoParserPrivate;
enum  {
	CONTACTS_IO_PARSER_0_PROPERTY,
	CONTACTS_IO_PARSER_NUM_PROPERTIES
};
static GParamSpec* contacts_io_parser_properties[CONTACTS_IO_PARSER_NUM_PROPERTIES];

struct _ContactsIoParser {
	GObject parent_instance;
	ContactsIoParserPrivate * priv;
};

struct _ContactsIoParserClass {
	GObjectClass parent_class;
	ContactsContact** (*parse) (ContactsIoParser* self, GInputStream* input, gint* result_length1, GError** error);
};

static gpointer contacts_io_parser_parent_class = NULL;

VALA_EXTERN GType contacts_io_parser_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ContactsIoParser, g_object_unref)
VALA_EXTERN ContactsContact** contacts_io_parser_parse (ContactsIoParser* self,
                                            GInputStream* input,
                                            gint* result_length1,
                                            GError** error);
static ContactsContact** contacts_io_parser_real_parse (ContactsIoParser* self,
                                                 GInputStream* input,
                                                 gint* result_length1,
                                                 GError** error);
VALA_EXTERN ContactsIoParser* contacts_io_parser_construct (GType object_type);
static GType contacts_io_parser_get_type_once (void);

/**
   * Takes the given input stream and tries to parse it into a set of contacts.
   */
static ContactsContact**
contacts_io_parser_real_parse (ContactsIoParser* self,
                               GInputStream* input,
                               gint* result_length1,
                               GError** error)
{
	g_critical ("Type `%s' does not implement abstract method `contacts_io_parser_parse'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return NULL;
}

ContactsContact**
contacts_io_parser_parse (ContactsIoParser* self,
                          GInputStream* input,
                          gint* result_length1,
                          GError** error)
{
	ContactsIoParserClass* _klass_;
	g_return_val_if_fail (self != NULL, NULL);
	_klass_ = CONTACTS_IO_PARSER_GET_CLASS (self);
	if (_klass_->parse) {
		return _klass_->parse (self, input, result_length1, error);
	}
	return NULL;
}

ContactsIoParser*
contacts_io_parser_construct (GType object_type)
{
	ContactsIoParser * self = NULL;
	self = (ContactsIoParser*) g_object_new (object_type, NULL);
	return self;
}

static void
contacts_io_parser_class_init (ContactsIoParserClass * klass,
                               gpointer klass_data)
{
	contacts_io_parser_parent_class = g_type_class_peek_parent (klass);
	((ContactsIoParserClass *) klass)->parse = (ContactsContact** (*) (ContactsIoParser*, GInputStream*, gint*, GError**)) contacts_io_parser_real_parse;
}

static void
contacts_io_parser_instance_init (ContactsIoParser * self,
                                  gpointer klass)
{
}

/**
 * A Parser is an object that can deal with importing a specific format of
 * describing a Contact (vCard is the most common example, but there exist
 * also CSV based formats and others).
 *
 * The main purpose of an Io.Parser is to parser whatever input it gets into an
 * array of {@link Contacts.Contact}s. After that, we can for example either
 * serialize the contact into a contact again.
 */
 G_GNUC_NO_INLINE static GType
contacts_io_parser_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ContactsIoParserClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) contacts_io_parser_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ContactsIoParser), 0, (GInstanceInitFunc) contacts_io_parser_instance_init, NULL };
	GType contacts_io_parser_type_id;
	contacts_io_parser_type_id = g_type_register_static (G_TYPE_OBJECT, "ContactsIoParser", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
	return contacts_io_parser_type_id;
}

GType
contacts_io_parser_get_type (void)
{
	static volatile gsize contacts_io_parser_type_id__once = 0;
	if (g_once_init_enter (&contacts_io_parser_type_id__once)) {
		GType contacts_io_parser_type_id;
		contacts_io_parser_type_id = contacts_io_parser_get_type_once ();
		g_once_init_leave (&contacts_io_parser_type_id__once, contacts_io_parser_type_id);
	}
	return contacts_io_parser_type_id__once;
}

