Newer
Older
#ifndef _ZERO_PINYIN_SERVICE_H_
#define _ZERO_PINYIN_SERVICE_H_
#include <glib.h>
#include <string.h>
#include <sqlite3.h>
G_BEGIN_DECLS
#define ZERO_PINYIN_WELL_KNOWN_NAME "com.emacsos.zero.ZeroPinyinService1"
#define ZERO_PINYIN_OBJECT_PATH "/com/emacsos/zero/ZeroPinyinService1"
#define ZERO_PINYIN_INTERFACE_NAME "com.emacsos.zero.ZeroPinyinService1.ZeroPinyinServiceInterface"
typedef struct {
gint shengmu_i;
gint yunmu_i;
guint length;
} Pinyin;
typedef struct {
gchar* str; /* the candidate string */
guint freq; /* word frequency [0, 65535] */
guint user_freq; /* user frequency [0, 65535] */
guint matched_py_length; /* matched preedit_str length */
} Candidate;
/**
* an implementation of get_candidates() with simple test data.
*/
void get_candidates_test (const char* preedit_str,
const guint fetch_size,
GVariantBuilder *candidates_builder,
GVariantBuilder *matched_lengths_builder);
/**
* fetch candidates for preedit_str.
*
* @preedit_str the preedit_str
* @fetch_size try to fetch this many candidates if possible
* @candidates_builder candidates will be added to this builder
* @matched_lengths_builder matched preedit_str length will be added to this builder
void get_candidates (sqlite3* db,
const char* preedit_str,
const guint fetch_size,
GVariantBuilder *candidates_builder,
GVariantBuilder *matched_lengths_builder);