/* TreeWalker.c generated by valac 0.56.19, the Vala compiler
 * generated from TreeWalker.vala, do not modify */

/* -*- Mode: vala; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */
/* GDocument.vala
 *
 * Copyright (C) 2018  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>
 */

#include "gxml/gxml.h"
#include <glib.h>
#include <glib-object.h>
#include <string.h>
#include "gxml.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

enum  {
	GXML_TREE_WALKER_0_PROPERTY,
	GXML_TREE_WALKER_ROOT_PROPERTY,
	GXML_TREE_WALKER_WHAT_TO_SHOW_PROPERTY,
	GXML_TREE_WALKER_CURRENT_NODE_PROPERTY,
	GXML_TREE_WALKER_NUM_PROPERTIES
};
static GParamSpec* gxml_tree_walker_properties[GXML_TREE_WALKER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

static gpointer gxml_tree_walker_parent_class = NULL;
static GXmlDomTreeWalkerIface * gxml_tree_walker_gxml_dom_tree_walker_parent_iface = NULL;

static GXmlDomNode* gxml_tree_walker_real_parent_node (GXmlDomTreeWalker* base);
static GXmlDomNode* gxml_tree_walker_real_first_child (GXmlDomTreeWalker* base);
static GXmlDomNode* gxml_tree_walker_traverse (GXmlTreeWalker* self,
                                        gboolean first);
static GXmlDomNode* gxml_tree_walker_real_last_child (GXmlDomTreeWalker* base);
static GXmlDomNode* gxml_tree_walker_real_previous_sibling (GXmlDomTreeWalker* base);
static GXmlDomNode* gxml_tree_walker_traverse_sibling (GXmlTreeWalker* self,
                                                gboolean next);
static GXmlDomNode* gxml_tree_walker_real_next_sibling (GXmlDomTreeWalker* base);
static GXmlDomNode* gxml_tree_walker_real_previous_node (GXmlDomTreeWalker* base);
static GXmlDomNode* gxml_tree_walker_real_next_node (GXmlDomTreeWalker* base);
static void gxml_tree_walker_finalize (GObject * obj);
static GType gxml_tree_walker_get_type_once (void);
static void _vala_gxml_tree_walker_get_property (GObject * object,
                                          guint property_id,
                                          GValue * value,
                                          GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static GXmlDomNode*
gxml_tree_walker_real_get_root (GXmlDomTreeWalker* base)
{
	GXmlDomNode* result;
	GXmlTreeWalker* self;
	GXmlDomNode* _tmp0_;
	GXmlDomNode* _tmp1_;
	self = (GXmlTreeWalker*) base;
	_tmp0_ = gxml_dom_tree_walker_get_root ((GXmlDomTreeWalker*) self);
	_tmp1_ = _tmp0_;
	result = _tmp1_;
	return result;
}

static gint
gxml_tree_walker_real_get_what_to_show (GXmlDomTreeWalker* base)
{
	gint result;
	GXmlTreeWalker* self;
	self = (GXmlTreeWalker*) base;
	result = self->_what_to_show;
	return result;
}

static GXmlDomNode*
gxml_tree_walker_real_get_current_node (GXmlDomTreeWalker* base)
{
	GXmlDomNode* result;
	GXmlTreeWalker* self;
	GXmlDomNode* _tmp0_;
	self = (GXmlTreeWalker*) base;
	_tmp0_ = self->_current_node;
	result = _tmp0_;
	return result;
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

GXmlTreeWalker*
gxml_tree_walker_construct (GType object_type,
                            GXmlDomNode* root,
                            gint w)
{
	GXmlTreeWalker * self = NULL;
	GXmlDomNode* _tmp0_;
	GXmlDomNode* _tmp1_;
	g_return_val_if_fail (root != NULL, NULL);
	self = (GXmlTreeWalker*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (root);
	_g_object_unref0 (self->_root);
	self->_root = _tmp0_;
	self->_what_to_show = w;
	_tmp1_ = _g_object_ref0 (root);
	_g_object_unref0 (self->_current_node);
	self->_current_node = _tmp1_;
	return self;
}

GXmlTreeWalker*
gxml_tree_walker_new (GXmlDomNode* root,
                      gint w)
{
	return gxml_tree_walker_construct (GXML_TYPE_TREE_WALKER, root, w);
}

static GXmlDomNode*
gxml_tree_walker_real_parent_node (GXmlDomTreeWalker* base)
{
	GXmlTreeWalker * self;
	GXmlDomNode* _tmp0_;
	GXmlDomNode* _tmp1_;
	GXmlDomNode* p = NULL;
	GXmlDomNode* _tmp2_;
	GXmlDomNode* _tmp3_;
	GXmlDomNode* _tmp4_;
	GXmlDomNode* _tmp5_;
	GXmlDomNode* _tmp6_;
	GXmlDomNode* _tmp7_;
	GXmlDomNodeFilterFilter _tmp8_ = 0;
	GXmlDomNode* _tmp9_;
	GXmlDomNode* _tmp10_;
	GXmlDomNode* _tmp11_;
	GXmlDomNode* _tmp12_;
	GXmlDomNode* _tmp13_;
	GXmlDomNode* _tmp14_;
	GXmlDomNode* _tmp15_;
	GXmlDomNode* result;
	self = (GXmlTreeWalker*) base;
	_tmp0_ = gxml_dom_tree_walker_get_current_node ((GXmlDomTreeWalker*) self);
	_tmp1_ = _tmp0_;
	if (_tmp1_ == NULL) {
		result = NULL;
		return result;
	}
	_tmp2_ = gxml_dom_tree_walker_get_current_node ((GXmlDomTreeWalker*) self);
	_tmp3_ = _tmp2_;
	_tmp4_ = gxml_dom_node_get_parent_node (_tmp3_);
	_tmp5_ = _tmp4_;
	p = _tmp5_;
	_tmp6_ = p;
	if (_tmp6_ == NULL) {
		result = NULL;
		_g_object_unref0 (p);
		return result;
	}
	_tmp7_ = p;
	g_signal_emit_by_name ((GXmlDomTreeWalker*) self, "accept-node", _tmp7_, &_tmp8_);
	if (_tmp8_ != GXML_DOM_NODE_FILTER_FILTER_ACCEPT) {
		result = NULL;
		_g_object_unref0 (p);
		return result;
	}
	_tmp9_ = p;
	_tmp10_ = gxml_dom_tree_walker_get_root ((GXmlDomTreeWalker*) self);
	_tmp11_ = _tmp10_;
	if (_tmp9_ == _tmp11_) {
		result = NULL;
		_g_object_unref0 (p);
		return result;
	}
	_tmp12_ = p;
	_tmp13_ = _g_object_ref0 (_tmp12_);
	_g_object_unref0 (self->_current_node);
	self->_current_node = _tmp13_;
	_tmp14_ = self->_current_node;
	_tmp15_ = _g_object_ref0 (_tmp14_);
	result = _tmp15_;
	_g_object_unref0 (p);
	return result;
}

static GXmlDomNode*
gxml_tree_walker_real_first_child (GXmlDomTreeWalker* base)
{
	GXmlTreeWalker * self;
	GXmlDomNode* _tmp0_;
	GXmlDomNode* result;
	self = (GXmlTreeWalker*) base;
	_tmp0_ = gxml_tree_walker_traverse (self, TRUE);
	result = _tmp0_;
	return result;
}

static GXmlDomNode*
gxml_tree_walker_real_last_child (GXmlDomTreeWalker* base)
{
	GXmlTreeWalker * self;
	GXmlDomNode* _tmp0_;
	GXmlDomNode* result;
	self = (GXmlTreeWalker*) base;
	_tmp0_ = gxml_tree_walker_traverse (self, FALSE);
	result = _tmp0_;
	return result;
}

static GXmlDomNode*
gxml_tree_walker_real_previous_sibling (GXmlDomTreeWalker* base)
{
	GXmlTreeWalker * self;
	GXmlDomNode* _tmp0_;
	GXmlDomNode* result;
	self = (GXmlTreeWalker*) base;
	_tmp0_ = gxml_tree_walker_traverse_sibling (self, FALSE);
	result = _tmp0_;
	return result;
}

static GXmlDomNode*
gxml_tree_walker_real_next_sibling (GXmlDomTreeWalker* base)
{
	GXmlTreeWalker * self;
	GXmlDomNode* _tmp0_;
	GXmlDomNode* result;
	self = (GXmlTreeWalker*) base;
	_tmp0_ = gxml_tree_walker_traverse_sibling (self, TRUE);
	result = _tmp0_;
	return result;
}

static GXmlDomNode*
gxml_tree_walker_real_previous_node (GXmlDomTreeWalker* base)
{
	GXmlTreeWalker * self;
	GXmlDomNode* result;
	self = (GXmlTreeWalker*) base;
	result = NULL;
	return result;
}

static GXmlDomNode*
gxml_tree_walker_real_next_node (GXmlDomTreeWalker* base)
{
	GXmlTreeWalker * self;
	GXmlDomNode* result;
	self = (GXmlTreeWalker*) base;
	result = NULL;
	return result;
}

static GXmlDomNode*
gxml_tree_walker_traverse (GXmlTreeWalker* self,
                           gboolean first)
{
	GXmlDomNode* _tmp0_;
	GXmlDomNode* _tmp1_;
	GXmlDomNode* n = NULL;
	GXmlDomNode* _tmp10_;
	GXmlDomNode* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gxml_dom_tree_walker_get_current_node ((GXmlDomTreeWalker*) self);
	_tmp1_ = _tmp0_;
	if (_tmp1_ == NULL) {
		result = NULL;
		return result;
	}
	n = NULL;
	if (first) {
		GXmlDomNode* _tmp2_;
		GXmlDomNode* _tmp3_;
		GXmlDomNode* _tmp4_;
		GXmlDomNode* _tmp5_;
		_tmp2_ = gxml_dom_tree_walker_get_current_node ((GXmlDomTreeWalker*) self);
		_tmp3_ = _tmp2_;
		_tmp4_ = gxml_dom_node_get_first_child (_tmp3_);
		_tmp5_ = _tmp4_;
		_g_object_unref0 (n);
		n = _tmp5_;
	} else {
		GXmlDomNode* _tmp6_;
		GXmlDomNode* _tmp7_;
		GXmlDomNode* _tmp8_;
		GXmlDomNode* _tmp9_;
		_tmp6_ = gxml_dom_tree_walker_get_current_node ((GXmlDomTreeWalker*) self);
		_tmp7_ = _tmp6_;
		_tmp8_ = gxml_dom_node_get_last_child (_tmp7_);
		_tmp9_ = _tmp8_;
		_g_object_unref0 (n);
		n = _tmp9_;
	}
	_tmp10_ = n;
	if (_tmp10_ == NULL) {
		result = NULL;
		_g_object_unref0 (n);
		return result;
	}
	while (TRUE) {
		GXmlDomNode* _tmp11_;
		GXmlDomNodeFilterFilter res = 0;
		GXmlDomNode* _tmp12_;
		GXmlDomNodeFilterFilter _tmp13_ = 0;
		_tmp11_ = n;
		if (!(_tmp11_ != NULL)) {
			break;
		}
		res = GXML_DOM_NODE_FILTER_FILTER_ACCEPT;
		_tmp12_ = n;
		g_signal_emit_by_name ((GXmlDomTreeWalker*) self, "accept-node", _tmp12_, &_tmp13_);
		res = _tmp13_;
		if (res == GXML_DOM_NODE_FILTER_FILTER_ACCEPT) {
			GXmlDomNode* _tmp14_;
			GXmlDomNode* _tmp15_;
			GXmlDomNode* _tmp16_;
			GXmlDomNode* _tmp17_;
			_tmp14_ = n;
			_tmp15_ = _g_object_ref0 (_tmp14_);
			_g_object_unref0 (self->_current_node);
			self->_current_node = _tmp15_;
			_tmp16_ = self->_current_node;
			_tmp17_ = _g_object_ref0 (_tmp16_);
			result = _tmp17_;
			_g_object_unref0 (n);
			return result;
		}
		if (res == GXML_DOM_NODE_FILTER_FILTER_SKIP) {
			GXmlDomNode* c = NULL;
			GXmlDomNode* _tmp24_;
			GXmlDomNode* s = NULL;
			GXmlDomNode* _tmp33_;
			gboolean _tmp36_ = FALSE;
			gboolean _tmp37_ = FALSE;
			GXmlDomNode* _tmp38_;
			GXmlDomNode* _tmp39_;
			GXmlDomNode* _tmp40_;
			GXmlDomNode* _tmp41_;
			gboolean _tmp42_;
			c = NULL;
			if (first) {
				GXmlDomNode* _tmp18_;
				GXmlDomNode* _tmp19_;
				GXmlDomNode* _tmp20_;
				_tmp18_ = n;
				_tmp19_ = gxml_dom_node_get_first_child (_tmp18_);
				_tmp20_ = _tmp19_;
				_g_object_unref0 (c);
				c = _tmp20_;
			} else {
				GXmlDomNode* _tmp21_;
				GXmlDomNode* _tmp22_;
				GXmlDomNode* _tmp23_;
				_tmp21_ = n;
				_tmp22_ = gxml_dom_node_get_last_child (_tmp21_);
				_tmp23_ = _tmp22_;
				_g_object_unref0 (c);
				c = _tmp23_;
			}
			_tmp24_ = c;
			if (_tmp24_ != NULL) {
				GXmlDomNode* _tmp25_;
				GXmlDomNode* _tmp26_;
				_tmp25_ = c;
				_tmp26_ = _g_object_ref0 (_tmp25_);
				_g_object_unref0 (n);
				n = _tmp26_;
				_g_object_unref0 (c);
				continue;
			}
			s = NULL;
			if (first) {
				GXmlDomNode* _tmp27_;
				GXmlDomNode* _tmp28_;
				GXmlDomNode* _tmp29_;
				_tmp27_ = n;
				_tmp28_ = gxml_dom_node_get_next_sibling (_tmp27_);
				_tmp29_ = _tmp28_;
				_g_object_unref0 (s);
				s = _tmp29_;
			} else {
				GXmlDomNode* _tmp30_;
				GXmlDomNode* _tmp31_;
				GXmlDomNode* _tmp32_;
				_tmp30_ = n;
				_tmp31_ = gxml_dom_node_get_previous_sibling (_tmp30_);
				_tmp32_ = _tmp31_;
				_g_object_unref0 (s);
				s = _tmp32_;
			}
			_tmp33_ = s;
			if (_tmp33_ != NULL) {
				GXmlDomNode* _tmp34_;
				GXmlDomNode* _tmp35_;
				_tmp34_ = s;
				_tmp35_ = _g_object_ref0 (_tmp34_);
				_g_object_unref0 (n);
				n = _tmp35_;
				_g_object_unref0 (s);
				_g_object_unref0 (c);
				continue;
			}
			_tmp38_ = n;
			_tmp39_ = gxml_dom_node_get_parent_node (_tmp38_);
			_tmp40_ = _tmp39_;
			_tmp41_ = _tmp40_;
			_tmp42_ = _tmp41_ == NULL;
			_g_object_unref0 (_tmp41_);
			if (_tmp42_) {
				_tmp37_ = TRUE;
			} else {
				GXmlDomNode* _tmp43_;
				GXmlDomNode* _tmp44_;
				GXmlDomNode* _tmp45_;
				GXmlDomNode* _tmp46_;
				GXmlDomNode* _tmp47_;
				GXmlDomNode* _tmp48_;
				_tmp43_ = n;
				_tmp44_ = gxml_dom_node_get_parent_node (_tmp43_);
				_tmp45_ = _tmp44_;
				_tmp46_ = _tmp45_;
				_tmp47_ = gxml_dom_tree_walker_get_root ((GXmlDomTreeWalker*) self);
				_tmp48_ = _tmp47_;
				_tmp37_ = _tmp46_ == _tmp48_;
				_g_object_unref0 (_tmp46_);
			}
			if (_tmp37_) {
				_tmp36_ = TRUE;
			} else {
				GXmlDomNode* _tmp49_;
				GXmlDomNode* _tmp50_;
				GXmlDomNode* _tmp51_;
				GXmlDomNode* _tmp52_;
				GXmlDomNode* _tmp53_;
				GXmlDomNode* _tmp54_;
				_tmp49_ = n;
				_tmp50_ = gxml_dom_node_get_parent_node (_tmp49_);
				_tmp51_ = _tmp50_;
				_tmp52_ = _tmp51_;
				_tmp53_ = gxml_dom_tree_walker_get_current_node ((GXmlDomTreeWalker*) self);
				_tmp54_ = _tmp53_;
				_tmp36_ = _tmp52_ == _tmp54_;
				_g_object_unref0 (_tmp52_);
			}
			if (_tmp36_) {
				result = NULL;
				_g_object_unref0 (s);
				_g_object_unref0 (c);
				_g_object_unref0 (n);
				return result;
			} else {
				GXmlDomNode* _tmp55_;
				GXmlDomNode* _tmp56_;
				GXmlDomNode* _tmp57_;
				_tmp55_ = n;
				_tmp56_ = gxml_dom_node_get_parent_node (_tmp55_);
				_tmp57_ = _tmp56_;
				_g_object_unref0 (n);
				n = _tmp57_;
			}
			_g_object_unref0 (s);
			_g_object_unref0 (c);
		}
	}
	result = NULL;
	_g_object_unref0 (n);
	return result;
}

static GXmlDomNode*
gxml_tree_walker_traverse_sibling (GXmlTreeWalker* self,
                                   gboolean next)
{
	GXmlDomNode* _tmp0_;
	GXmlDomNode* _tmp1_;
	GXmlDomNode* _tmp2_;
	GXmlDomNode* _tmp3_;
	GXmlDomNode* _tmp4_;
	GXmlDomNode* _tmp5_;
	GXmlDomNode* s = NULL;
	GXmlDomNode* n = NULL;
	GXmlDomNode* _tmp14_;
	GXmlDomNode* _tmp15_;
	GXmlDomNode* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gxml_dom_tree_walker_get_current_node ((GXmlDomTreeWalker*) self);
	_tmp1_ = _tmp0_;
	if (_tmp1_ == NULL) {
		result = NULL;
		return result;
	}
	_tmp2_ = gxml_dom_tree_walker_get_current_node ((GXmlDomTreeWalker*) self);
	_tmp3_ = _tmp2_;
	_tmp4_ = gxml_dom_tree_walker_get_root ((GXmlDomTreeWalker*) self);
	_tmp5_ = _tmp4_;
	if (_tmp3_ == _tmp5_) {
		result = NULL;
		return result;
	}
	s = NULL;
	if (next) {
		GXmlDomNode* _tmp6_;
		GXmlDomNode* _tmp7_;
		GXmlDomNode* _tmp8_;
		GXmlDomNode* _tmp9_;
		_tmp6_ = gxml_dom_tree_walker_get_current_node ((GXmlDomTreeWalker*) self);
		_tmp7_ = _tmp6_;
		_tmp8_ = gxml_dom_node_get_next_sibling (_tmp7_);
		_tmp9_ = _tmp8_;
		_g_object_unref0 (s);
		s = _tmp9_;
	} else {
		GXmlDomNode* _tmp10_;
		GXmlDomNode* _tmp11_;
		GXmlDomNode* _tmp12_;
		GXmlDomNode* _tmp13_;
		_tmp10_ = gxml_dom_tree_walker_get_current_node ((GXmlDomTreeWalker*) self);
		_tmp11_ = _tmp10_;
		_tmp12_ = gxml_dom_node_get_previous_sibling (_tmp11_);
		_tmp13_ = _tmp12_;
		_g_object_unref0 (s);
		s = _tmp13_;
	}
	_tmp14_ = s;
	_tmp15_ = _g_object_ref0 (_tmp14_);
	n = _tmp15_;
	while (TRUE) {
		GXmlDomNode* _tmp16_;
		GXmlDomNodeFilterFilter res = 0;
		GXmlDomNode* _tmp17_;
		GXmlDomNodeFilterFilter _tmp18_ = 0;
		GXmlDomNode* c = NULL;
		gboolean _tmp29_ = FALSE;
		GXmlDomNode* _tmp37_;
		GXmlDomNode* _tmp38_;
		GXmlDomNode* _tmp39_;
		gboolean _tmp40_ = FALSE;
		GXmlDomNode* _tmp41_;
		GXmlDomNode* _tmp45_;
		GXmlDomNodeFilterFilter _tmp46_ = 0;
		_tmp16_ = n;
		if (!(_tmp16_ != NULL)) {
			break;
		}
		res = GXML_DOM_NODE_FILTER_FILTER_ACCEPT;
		_tmp17_ = n;
		g_signal_emit_by_name ((GXmlDomTreeWalker*) self, "accept-node", _tmp17_, &_tmp18_);
		res = _tmp18_;
		if (res == GXML_DOM_NODE_FILTER_FILTER_ACCEPT) {
			GXmlDomNode* _tmp19_;
			GXmlDomNode* _tmp20_;
			GXmlDomNode* _tmp21_;
			GXmlDomNode* _tmp22_;
			_tmp19_ = n;
			_tmp20_ = _g_object_ref0 (_tmp19_);
			_g_object_unref0 (self->_current_node);
			self->_current_node = _tmp20_;
			_tmp21_ = self->_current_node;
			_tmp22_ = _g_object_ref0 (_tmp21_);
			result = _tmp22_;
			_g_object_unref0 (n);
			_g_object_unref0 (s);
			return result;
		}
		c = NULL;
		if (next) {
			GXmlDomNode* _tmp23_;
			GXmlDomNode* _tmp24_;
			GXmlDomNode* _tmp25_;
			_tmp23_ = n;
			_tmp24_ = gxml_dom_node_get_first_child (_tmp23_);
			_tmp25_ = _tmp24_;
			_g_object_unref0 (c);
			c = _tmp25_;
		} else {
			GXmlDomNode* _tmp26_;
			GXmlDomNode* _tmp27_;
			GXmlDomNode* _tmp28_;
			_tmp26_ = n;
			_tmp27_ = gxml_dom_node_get_last_child (_tmp26_);
			_tmp28_ = _tmp27_;
			_g_object_unref0 (c);
			c = _tmp28_;
		}
		if (res == GXML_DOM_NODE_FILTER_FILTER_REJECT) {
			_tmp29_ = TRUE;
		} else {
			GXmlDomNode* _tmp30_;
			_tmp30_ = c;
			_tmp29_ = _tmp30_ == NULL;
		}
		if (_tmp29_) {
			if (next) {
				GXmlDomNode* _tmp31_;
				GXmlDomNode* _tmp32_;
				GXmlDomNode* _tmp33_;
				_tmp31_ = n;
				_tmp32_ = gxml_dom_node_get_next_sibling (_tmp31_);
				_tmp33_ = _tmp32_;
				_g_object_unref0 (s);
				s = _tmp33_;
			} else {
				GXmlDomNode* _tmp34_;
				GXmlDomNode* _tmp35_;
				GXmlDomNode* _tmp36_;
				_tmp34_ = n;
				_tmp35_ = gxml_dom_node_get_previous_sibling (_tmp34_);
				_tmp36_ = _tmp35_;
				_g_object_unref0 (s);
				s = _tmp36_;
			}
		}
		_tmp37_ = n;
		_tmp38_ = gxml_dom_node_get_parent_node (_tmp37_);
		_tmp39_ = _tmp38_;
		_g_object_unref0 (n);
		n = _tmp39_;
		_tmp41_ = n;
		if (_tmp41_ == NULL) {
			_tmp40_ = TRUE;
		} else {
			GXmlDomNode* _tmp42_;
			GXmlDomNode* _tmp43_;
			GXmlDomNode* _tmp44_;
			_tmp42_ = n;
			_tmp43_ = gxml_dom_tree_walker_get_root ((GXmlDomTreeWalker*) self);
			_tmp44_ = _tmp43_;
			_tmp40_ = _tmp42_ == _tmp44_;
		}
		if (_tmp40_) {
			result = NULL;
			_g_object_unref0 (c);
			_g_object_unref0 (n);
			_g_object_unref0 (s);
			return result;
		}
		_tmp45_ = n;
		g_signal_emit_by_name ((GXmlDomTreeWalker*) self, "accept-node", _tmp45_, &_tmp46_);
		if (_tmp46_ == GXML_DOM_NODE_FILTER_FILTER_ACCEPT) {
			result = NULL;
			_g_object_unref0 (c);
			_g_object_unref0 (n);
			_g_object_unref0 (s);
			return result;
		}
		_g_object_unref0 (c);
	}
	result = s;
	_g_object_unref0 (n);
	return result;
}

static void
gxml_tree_walker_class_init (GXmlTreeWalkerClass * klass,
                             gpointer klass_data)
{
	gxml_tree_walker_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->get_property = _vala_gxml_tree_walker_get_property;
	G_OBJECT_CLASS (klass)->finalize = gxml_tree_walker_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_TREE_WALKER_ROOT_PROPERTY, gxml_tree_walker_properties[GXML_TREE_WALKER_ROOT_PROPERTY] = g_param_spec_object ("root", "root", "root", GXML_TYPE_DOM_NODE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_TREE_WALKER_WHAT_TO_SHOW_PROPERTY, gxml_tree_walker_properties[GXML_TREE_WALKER_WHAT_TO_SHOW_PROPERTY] = g_param_spec_int ("what-to-show", "what-to-show", "what-to-show", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_TREE_WALKER_CURRENT_NODE_PROPERTY, gxml_tree_walker_properties[GXML_TREE_WALKER_CURRENT_NODE_PROPERTY] = g_param_spec_object ("current-node", "current-node", "current-node", GXML_TYPE_DOM_NODE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
gxml_tree_walker_gxml_dom_tree_walker_interface_init (GXmlDomTreeWalkerIface * iface,
                                                      gpointer iface_data)
{
	gxml_tree_walker_gxml_dom_tree_walker_parent_iface = g_type_interface_peek_parent (iface);
	iface->parent_node = (GXmlDomNode* (*) (GXmlDomTreeWalker*)) gxml_tree_walker_real_parent_node;
	iface->first_child = (GXmlDomNode* (*) (GXmlDomTreeWalker*)) gxml_tree_walker_real_first_child;
	iface->last_child = (GXmlDomNode* (*) (GXmlDomTreeWalker*)) gxml_tree_walker_real_last_child;
	iface->previous_sibling = (GXmlDomNode* (*) (GXmlDomTreeWalker*)) gxml_tree_walker_real_previous_sibling;
	iface->next_sibling = (GXmlDomNode* (*) (GXmlDomTreeWalker*)) gxml_tree_walker_real_next_sibling;
	iface->previous_node = (GXmlDomNode* (*) (GXmlDomTreeWalker*)) gxml_tree_walker_real_previous_node;
	iface->next_node = (GXmlDomNode* (*) (GXmlDomTreeWalker*)) gxml_tree_walker_real_next_node;
	iface->get_root = gxml_tree_walker_real_get_root;
	iface->get_what_to_show = gxml_tree_walker_real_get_what_to_show;
	iface->get_current_node = gxml_tree_walker_real_get_current_node;
}

static void
gxml_tree_walker_instance_init (GXmlTreeWalker * self,
                                gpointer klass)
{
	self->_current_node = NULL;
}

static void
gxml_tree_walker_finalize (GObject * obj)
{
	GXmlTreeWalker * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GXML_TYPE_TREE_WALKER, GXmlTreeWalker);
	_g_object_unref0 (self->_root);
	_g_object_unref0 (self->_current_node);
	G_OBJECT_CLASS (gxml_tree_walker_parent_class)->finalize (obj);
}

/**
 * Implementation of {@link DomTreeWalker}
 */
static GType
gxml_tree_walker_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GXmlTreeWalkerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gxml_tree_walker_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GXmlTreeWalker), 0, (GInstanceInitFunc) gxml_tree_walker_instance_init, NULL };
	static const GInterfaceInfo gxml_dom_tree_walker_info = { (GInterfaceInitFunc) gxml_tree_walker_gxml_dom_tree_walker_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType gxml_tree_walker_type_id;
	gxml_tree_walker_type_id = g_type_register_static (G_TYPE_OBJECT, "GXmlTreeWalker", &g_define_type_info, 0);
	g_type_add_interface_static (gxml_tree_walker_type_id, GXML_TYPE_DOM_TREE_WALKER, &gxml_dom_tree_walker_info);
	return gxml_tree_walker_type_id;
}

GType
gxml_tree_walker_get_type (void)
{
	static volatile gsize gxml_tree_walker_type_id__once = 0;
	if (g_once_init_enter (&gxml_tree_walker_type_id__once)) {
		GType gxml_tree_walker_type_id;
		gxml_tree_walker_type_id = gxml_tree_walker_get_type_once ();
		g_once_init_leave (&gxml_tree_walker_type_id__once, gxml_tree_walker_type_id);
	}
	return gxml_tree_walker_type_id__once;
}

static void
_vala_gxml_tree_walker_get_property (GObject * object,
                                     guint property_id,
                                     GValue * value,
                                     GParamSpec * pspec)
{
	GXmlTreeWalker * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GXML_TYPE_TREE_WALKER, GXmlTreeWalker);
	switch (property_id) {
		case GXML_TREE_WALKER_ROOT_PROPERTY:
		g_value_set_object (value, gxml_dom_tree_walker_get_root ((GXmlDomTreeWalker*) self));
		break;
		case GXML_TREE_WALKER_WHAT_TO_SHOW_PROPERTY:
		g_value_set_int (value, gxml_dom_tree_walker_get_what_to_show ((GXmlDomTreeWalker*) self));
		break;
		case GXML_TREE_WALKER_CURRENT_NODE_PROPERTY:
		g_value_set_object (value, gxml_dom_tree_walker_get_current_node ((GXmlDomTreeWalker*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

