Skip to content
zero-pinyin-service.h 912 B
Newer Older
Yuanle Song's avatar
Yuanle Song committed
#ifndef _ZERO_PINYIN_SERVICE_H_
#define _ZERO_PINYIN_SERVICE_H_

#include <glib.h>
#include <string.h>

#ifdef __cplusplus
extern "C"
{
#endif

typedef struct {
	gint shengmu_i;
	gint yunmu_i;
	guint length;
} Pinyin;

typedef struct {
	gchar str;
	guint matched_py_length;
} Candidate;

/**
 * an implementation of get_candidates() with simple test data.
 */
void get_candidates_test (const char* preedit_str,
			  GVariantBuilder *candidates_builder,
			  GVariantBuilder *matched_lengths_builder);

/**
 * fetch candidates for preedit_str.
 *
 * @preedit_str
 * @candidates_builder will add candidates to this builder
 * @matched_lengths_builder will add matched preedit_str length to this builder
 */
void get_candidates (const char* preedit_str,
		     GVariantBuilder *candidates_builder,
		     GVariantBuilder *matched_lengths_builder);

#ifdef __cplusplus
}
#endif

#endif /* _ZERO_PINYIN_SERVICE_H_ */