/* libxml-TagNameNodeList.c generated by valac 0.28.1, the Vala compiler
 * generated from libxml-TagNameNodeList.vala, do not modify */

/* -*- Mode: vala; indent-tabs-mode: nil; c-basic-offset: 0; tab-width: 2 -*- */
/* ObjectModel.vala
 *
 * Copyright (C) 2015  Daniel Espinosa <esodan@gmail.com>
 *
 * 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, see <http://www.gnu.org/licenses/>.
 *
 * Authors:
 *      Daniel Espinosa <esodan@gmail.com>
 */
/* TODO: this will somehow need to watch the document and find
 * out as new elements are added, and get reconstructed each
 * time, or get reconstructed-on-the-go?
 */

#include <glib.h>
#include <glib-object.h>
#include <gee.h>
#include <stdlib.h>
#include <string.h>


#define GXML_TYPE_XNODE_LIST (gxml_xnode_list_get_type ())
#define GXML_XNODE_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GXML_TYPE_XNODE_LIST, GXmlxNodeList))
#define GXML_IS_XNODE_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GXML_TYPE_XNODE_LIST))
#define GXML_XNODE_LIST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GXML_TYPE_XNODE_LIST, GXmlxNodeListIface))

typedef struct _GXmlxNodeList GXmlxNodeList;
typedef struct _GXmlxNodeListIface GXmlxNodeListIface;

#define GXML_TYPE_XNODE (gxml_xnode_get_type ())
#define GXML_XNODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GXML_TYPE_XNODE, GXmlxNode))
#define GXML_XNODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GXML_TYPE_XNODE, GXmlxNodeClass))
#define GXML_IS_XNODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GXML_TYPE_XNODE))
#define GXML_IS_XNODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GXML_TYPE_XNODE))
#define GXML_XNODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GXML_TYPE_XNODE, GXmlxNodeClass))

typedef struct _GXmlxNode GXmlxNode;
typedef struct _GXmlxNodeClass GXmlxNodeClass;

#define GXML_TYPE_LINKED_LIST (gxml_linked_list_get_type ())
#define GXML_LINKED_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GXML_TYPE_LINKED_LIST, GXmlLinkedList))
#define GXML_LINKED_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GXML_TYPE_LINKED_LIST, GXmlLinkedListClass))
#define GXML_IS_LINKED_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GXML_TYPE_LINKED_LIST))
#define GXML_IS_LINKED_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GXML_TYPE_LINKED_LIST))
#define GXML_LINKED_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GXML_TYPE_LINKED_LIST, GXmlLinkedListClass))

typedef struct _GXmlLinkedList GXmlLinkedList;
typedef struct _GXmlLinkedListClass GXmlLinkedListClass;
typedef struct _GXmlLinkedListPrivate GXmlLinkedListPrivate;

#define GXML_TYPE_TAG_NAME_NODE_LIST (gxml_tag_name_node_list_get_type ())
#define GXML_TAG_NAME_NODE_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GXML_TYPE_TAG_NAME_NODE_LIST, GXmlTagNameNodeList))
#define GXML_TAG_NAME_NODE_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GXML_TYPE_TAG_NAME_NODE_LIST, GXmlTagNameNodeListClass))
#define GXML_IS_TAG_NAME_NODE_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GXML_TYPE_TAG_NAME_NODE_LIST))
#define GXML_IS_TAG_NAME_NODE_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GXML_TYPE_TAG_NAME_NODE_LIST))
#define GXML_TAG_NAME_NODE_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GXML_TYPE_TAG_NAME_NODE_LIST, GXmlTagNameNodeListClass))

typedef struct _GXmlTagNameNodeList GXmlTagNameNodeList;
typedef struct _GXmlTagNameNodeListClass GXmlTagNameNodeListClass;
typedef struct _GXmlTagNameNodeListPrivate GXmlTagNameNodeListPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))

#define GXML_TYPE_XDOCUMENT (gxml_xdocument_get_type ())
#define GXML_XDOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GXML_TYPE_XDOCUMENT, GXmlxDocument))
#define GXML_XDOCUMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GXML_TYPE_XDOCUMENT, GXmlxDocumentClass))
#define GXML_IS_XDOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GXML_TYPE_XDOCUMENT))
#define GXML_IS_XDOCUMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GXML_TYPE_XDOCUMENT))
#define GXML_XDOCUMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GXML_TYPE_XDOCUMENT, GXmlxDocumentClass))

typedef struct _GXmlxDocument GXmlxDocument;
typedef struct _GXmlxDocumentClass GXmlxDocumentClass;

struct _GXmlxNodeListIface {
	GTypeInterface parent_iface;
	GXmlxNode* (*item) (GXmlxNodeList* self, gulong idx);
	GXmlxNode* (*insert_before) (GXmlxNodeList* self, GXmlxNode* new_child, GXmlxNode* ref_child);
	GXmlxNode* (*replace_child) (GXmlxNodeList* self, GXmlxNode* new_child, GXmlxNode* old_child);
	GXmlxNode* (*remove_child) (GXmlxNodeList* self, GXmlxNode* old_child);
	GXmlxNode* (*append_child) (GXmlxNodeList* self, GXmlxNode* new_child);
	gchar* (*to_string) (GXmlxNodeList* self, gboolean in_line);
	GXmlxNode* (*first) (GXmlxNodeList* self);
	GXmlxNode* (*last) (GXmlxNodeList* self);
	GXmlxNode* (*get) (GXmlxNodeList* self, gint n);
	gulong (*get_length) (GXmlxNodeList* self);
	void (*set_length) (GXmlxNodeList* self, gulong value);
};

struct _GXmlLinkedList {
	GeeLinkedList parent_instance;
	GXmlLinkedListPrivate * priv;
	GXmlxNode* root;
};

struct _GXmlLinkedListClass {
	GeeLinkedListClass parent_class;
};

struct _GXmlTagNameNodeList {
	GXmlLinkedList parent_instance;
	GXmlTagNameNodeListPrivate * priv;
	gchar* tag_name;
};

struct _GXmlTagNameNodeListClass {
	GXmlLinkedListClass parent_class;
};


static gpointer gxml_tag_name_node_list_parent_class = NULL;

GType gxml_xnode_get_type (void) G_GNUC_CONST;
GType gxml_xnode_list_get_type (void) G_GNUC_CONST;
GType gxml_linked_list_get_type (void) G_GNUC_CONST;
GType gxml_tag_name_node_list_get_type (void) G_GNUC_CONST;
enum  {
	GXML_TAG_NAME_NODE_LIST_DUMMY_PROPERTY
};
GType gxml_xdocument_get_type (void) G_GNUC_CONST;
GXmlTagNameNodeList* gxml_tag_name_node_list_new (const gchar* tag_name, GXmlxNode* root, GXmlxDocument* owner);
GXmlTagNameNodeList* gxml_tag_name_node_list_construct (GType object_type, const gchar* tag_name, GXmlxNode* root, GXmlxDocument* owner);
GXmlLinkedList* gxml_linked_list_new (GXmlxNode* root);
GXmlLinkedList* gxml_linked_list_construct (GType object_type, GXmlxNode* root);
static void gxml_tag_name_node_list_finalize (GObject* obj);


GXmlTagNameNodeList* gxml_tag_name_node_list_construct (GType object_type, const gchar* tag_name, GXmlxNode* root, GXmlxDocument* owner) {
	GXmlTagNameNodeList * self = NULL;
	GXmlxNode* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	gchar* _tmp2_ = NULL;
	g_return_val_if_fail (tag_name != NULL, NULL);
	g_return_val_if_fail (root != NULL, NULL);
	g_return_val_if_fail (owner != NULL, NULL);
	_tmp0_ = root;
	self = (GXmlTagNameNodeList*) gxml_linked_list_construct (object_type, _tmp0_);
	_tmp1_ = tag_name;
	_tmp2_ = g_strdup (_tmp1_);
	_g_free0 (self->tag_name);
	self->tag_name = _tmp2_;
	return self;
}


GXmlTagNameNodeList* gxml_tag_name_node_list_new (const gchar* tag_name, GXmlxNode* root, GXmlxDocument* owner) {
	return gxml_tag_name_node_list_construct (GXML_TYPE_TAG_NAME_NODE_LIST, tag_name, root, owner);
}


static void gxml_tag_name_node_list_class_init (GXmlTagNameNodeListClass * klass) {
	gxml_tag_name_node_list_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->finalize = gxml_tag_name_node_list_finalize;
}


static void gxml_tag_name_node_list_instance_init (GXmlTagNameNodeList * self) {
}


static void gxml_tag_name_node_list_finalize (GObject* obj) {
	GXmlTagNameNodeList * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GXML_TYPE_TAG_NAME_NODE_LIST, GXmlTagNameNodeList);
	_g_free0 (self->tag_name);
	G_OBJECT_CLASS (gxml_tag_name_node_list_parent_class)->finalize (obj);
}


GType gxml_tag_name_node_list_get_type (void) {
	static volatile gsize gxml_tag_name_node_list_type_id__volatile = 0;
	if (g_once_init_enter (&gxml_tag_name_node_list_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GXmlTagNameNodeListClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gxml_tag_name_node_list_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GXmlTagNameNodeList), 0, (GInstanceInitFunc) gxml_tag_name_node_list_instance_init, NULL };
		GType gxml_tag_name_node_list_type_id;
		gxml_tag_name_node_list_type_id = g_type_register_static (GXML_TYPE_LINKED_LIST, "GXmlTagNameNodeList", &g_define_type_info, 0);
		g_once_init_leave (&gxml_tag_name_node_list_type_id__volatile, gxml_tag_name_node_list_type_id);
	}
	return gxml_tag_name_node_list_type_id__volatile;
}



