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

/*
 * Copyright (C) 2011-2014 Daiki Ueno <ueno@gnu.org>
 * Copyright (C) 2011-2014 Red Hat, Inc.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "libkkc/libkkc.h"
#include <stdlib.h>
#include <string.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

static gboolean kkc_sentence_dictionary_real_select_segments (KkcSentenceDictionary* self,
                                                       KkcSegment** input,
                                                       gint input_length1);
static GType kkc_sentence_dictionary_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

/**
         * Lookup constraint.
         *
         * @param input input string to lookup
         * @param constraint output location of constraint
         *
         * @return `true` if found, `false` otherwise
         */
gboolean
kkc_sentence_dictionary_lookup_constraint (KkcSentenceDictionary* self,
                                           const gchar* input,
                                           gint** constraint,
                                           gint* constraint_length1)
{
	KkcSentenceDictionaryIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = KKC_SENTENCE_DICTIONARY_GET_INTERFACE (self);
	if (_iface_->lookup_constraint) {
		return _iface_->lookup_constraint (self, input, constraint, constraint_length1);
	}
	return FALSE;
}

/**
         * Lookup phrase.
         *
         * @param input input sequence to lookup
         * @param phrase output location of phrase
         *
         * @return `true` if found, `false` otherwise
         */
gboolean
kkc_sentence_dictionary_lookup_phrase (KkcSentenceDictionary* self,
                                       gchar** input,
                                       gint input_length1,
                                       gchar*** phrase,
                                       gint* phrase_length1)
{
	KkcSentenceDictionaryIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = KKC_SENTENCE_DICTIONARY_GET_INTERFACE (self);
	if (_iface_->lookup_phrase) {
		return _iface_->lookup_phrase (self, input, input_length1, phrase, phrase_length1);
	}
	return FALSE;
}

static gboolean
kkc_sentence_dictionary_real_select_segments (KkcSentenceDictionary* self,
                                              KkcSegment** input,
                                              gint input_length1)
{
	gboolean result;
	result = FALSE;
	return result;
}

gboolean
kkc_sentence_dictionary_select_segments (KkcSentenceDictionary* self,
                                         KkcSegment** input,
                                         gint input_length1)
{
	KkcSentenceDictionaryIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = KKC_SENTENCE_DICTIONARY_GET_INTERFACE (self);
	if (_iface_->select_segments) {
		return _iface_->select_segments (self, input, input_length1);
	}
	return FALSE;
}

static void
kkc_sentence_dictionary_default_init (KkcSentenceDictionaryIface * iface,
                                      gpointer iface_data)
{
	iface->select_segments = kkc_sentence_dictionary_real_select_segments;
}

/**
     * Base interface of sentence dictionaries.
     */
static GType
kkc_sentence_dictionary_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (KkcSentenceDictionaryIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) kkc_sentence_dictionary_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType kkc_sentence_dictionary_type_id;
	kkc_sentence_dictionary_type_id = g_type_register_static (G_TYPE_INTERFACE, "KkcSentenceDictionary", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (kkc_sentence_dictionary_type_id, G_TYPE_OBJECT);
	g_type_interface_add_prerequisite (kkc_sentence_dictionary_type_id, KKC_TYPE_DICTIONARY);
	return kkc_sentence_dictionary_type_id;
}

GType
kkc_sentence_dictionary_get_type (void)
{
	static volatile gsize kkc_sentence_dictionary_type_id__once = 0;
	if (g_once_init_enter (&kkc_sentence_dictionary_type_id__once)) {
		GType kkc_sentence_dictionary_type_id;
		kkc_sentence_dictionary_type_id = kkc_sentence_dictionary_get_type_once ();
		g_once_init_leave (&kkc_sentence_dictionary_type_id__once, kkc_sentence_dictionary_type_id);
	}
	return kkc_sentence_dictionary_type_id__once;
}

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;
}

