39 typedef int (*
UnihanCallback)(
void* userOption,
int col_num,
char** results,
char** col_names);
74 void (*func)(sqlite3_context *context,
int argc, sqlite3_value **argv);
75 void (*stepFunc)(sqlite3_context *context,
int argc, sqlite3_value **argv);
76 void (*finalizeFunc)(sqlite3_context *context);
97 #define UNIHAN_QUERY_OPTION_LIKE 1
98 #define UNIHAN_QUERY_OPTION_SCALAR_STRING 1 << 1
99 #define UNIHAN_QUERY_OPTION_SHOW_GIVEN_FIELD 1 << 2
100 #define UNIHAN_QUERY_OPTION_PINYIN_TONE_ACCENT 1 << 3
101 #define UNIHAN_QUERY_OPTION_PINYIN_FORMAT_MASK 7 << 4
102 #define UNIHAN_QUERY_OPTION_ZHUYIN_FORCE_DISPLAY 1 << 7
103 #define UNIHAN_QUERY_OPTION_ZHUYIN_FORMAT_MASK 7 << 8
105 #define UNIHAN_QUERY_OPTION_DEFAULT (PINYIN_ACCENT_UNIHAN << 4) | (ZHUYIN_TONEMARK_ORIGINAL << 8)
114 #define UNIHAN_QUERY_OPTION_GET_PINYIN_FORMAT(options) (options & UNIHAN_QUERY_OPTION_PINYIN_FORMAT_MASK) >> 4
122 #define UNIHAN_QUERY_OPTION_SET_PINYIN_FORMAT(options,format) options |= format << 4
130 #define UNIHAN_QUERY_OPTION_GET_ZHUYIN_FORMAT(options) (options & UNIHAN_QUERY_OPTION_ZHUYIN_FORMAT_MASK) >> 8
138 #define UNIHAN_QUERY_OPTION_SET_ZHUYIN_FORMAT(options,format) options |= format << 8
679 void *callbackOption,
char **errMsg_ptr);
const char * name
short source name in string. (e.g. "G0").
Definition: Unihan.h:50
UnihanField unihanField_parse(const char *str)
Parses the string argument as a UnihanField.
gboolean unihanField_is_IRG_Source(UnihanField field)
Whether the field is IRG_Source.
const char * description
full description of the IRG source. (e.g. "GB2310-80").
Definition: Unihan.h:51
UnihanRange unihanChar_in_range(gunichar code)
Return the range which the character belong to.
UnihanTable unihanField_get_table(UnihanField field)
Return the table that contains the key.
Phonetic symbols (PinYin and ZhuYin) processing functions.
UnihanTable unihanTable_parse(const char *tableName)
Parse the string argument as UnihanTable.
gboolean unihanChar_is_in_source(gunichar code, UnihanIRG_SourceId source)
Whether the character appeared in given source.
sqlite3 * unihanDb_get()
Returns the db which libUnihan is using.
UnihanIRG_SourceId unihanIRG_SourceId_parse(const char *sourceShortName)
Parse the string argument as Unihan IRG Source ID.
Data structure of database supporting functions.
Definition: Unihan.h:71
const char * unihanTable_to_string(UnihanTable table)
Returns a string representing a UnihanTable.
void unihanIRG_SourceRec_free(UnihanIRG_SourceRec *rec)
Free the UnihanIRG_SourceRec.
const char * funcName
Name to be referred in SQL.
Definition: Unihan.h:72
SQL_Result * unihan_find_all_matched(UnihanField givenField, const char *givenValue, UnihanField queryField, UnihanQueryOption qOption)
Find all matched results, given a field and its value.
const UnihanIRG_SourceData * unihanIRG_SourceData_get(UnihanIRG_SourceId sourceId)
Return the Unihan IRG_Source Data.
guint UnihanQueryOption
Unihan query options.
Definition: Unihan.h:95
const char * unihanField_to_string(UnihanField field)
Returns a string representing a UnihanField.
gboolean unihanChar_is_common_in_locale(gunichar code, UnihanLocale locale)
Whether the character is common in the specified locale.
SQL_Result * unihanSql_get_sql_result(const char *sqlClause)
Obtains a SQL_Result table of SQL command.
int unihanSql_count_matches(const char *sqlClause, char **errMsg_ptr)
Count the number of matches.
StringList is a structure that stores a list of constant strings.
Definition: str_functions.h:47
String processing functions.
int argc
Number of arguments.
Definition: Unihan.h:73
int unihan_insert_value(gunichar code, UnihanField field, const char *value)
Insert a Unihan textual formated record to corresponding tables.
UnihanIRG_Source unihanField_get_IRG_source(UnihanField field)
Return the corresponding IRG source if the field is IRG source field.
gboolean unihanField_is_pseudo(UnihanField field)
Whether the field is a pseudo field.
int unihan_insert(UnihanTable table, StringList *valueList)
Insert a record to table.
gunichar unihanChar_parse(const char *str)
Parses the string argument as a UCS4 (gunichar) character.
int unihanDb_open(const char *filename, int flags)
Open a Unihan db.
gboolean unihanChar_has_property(gunichar code, UnihanField field)
Whether the character is associate with the given field.
int unihanSql_exec(char *sqlClause, UnihanCallback callback, void *callbackOption, char **errMsg_ptr)
Execute the SQL to Unihan db.
const char * unihanRange_to_string(UnihanRange uRange)
Returns a string representing a UnihanLocale.
gboolean unihanField_is_singleton(UnihanField field)
Whether the field is a singleton field.
const char * unihanLocale_to_string(UnihanLocale locale)
Returns a string representing a UnihanLocale.
int unihan_insert_no_duplicate(UnihanTable table, StringList *valueList)
Insert a record to table with duplication check.
UnihanIRG_SourceId unihanChar_is_in_sources(gunichar code, UnihanIRG_SourceId source,...)
Find the first source which the character appears in.
int unihanDb_open_default()
Open the system default Unihan Db as read-only.
const DatabaseFuncStru DATABASE_FUNCS[]
List of database supporting functions.
UnihanIRG_SourceId
Enumeration of IRG Source ID.
Definition: Unihan_enum.h:378
UnihanField * unihanTable_get_primary_key_fields(UnihanTable table)
Returns all primary key fields of the given table in an UnihanField array.
Data structure that holds the result of SQL functions and command.
Definition: sqlite_functions.h:146
gboolean unihanIRG_Source_has_no_mapping(UnihanIRG_SourceId sourceId)
Whether the SourceId has mapping.
gboolean unihanField_is_lowercase(UnihanField field)
Whether the value in the field is stored as lowercase.
const char * sourceMapping
the mapping of the character in the source.
Definition: Unihan.h:63
UnihanField * unihanTable_get_db_fields(UnihanTable table)
Returns the actual data table fields in an UnihanField array.
gboolean unihanField_is_case_no_change(UnihanField field)
Whether the case of value should be kept.
int(* UnihanCallback)(void *userOption, int col_num, char **results, char **col_names)
Prototype of callback function for SQL execution.
Definition: Unihan.h:39
SQLite suppporting data structures and functions.
UnihanIRG_SourceRec * unihanIRG_SourceRec_parse(UnihanField field, const char *value)
Parse the string argument as Unihan IRG Source Rec.
SQL_Result * unihanDb_get_tableNames()
Returns the tables in database.
UnihanRange
Enumeration of Unihan Range.
Definition: Unihan_enum.h:467
IRG source data.
Definition: Unihan.h:49
UnihanTable
Enumeration of tables.
Definition: Unihan_enum.h:248
UnihanField
Enumeration of Unihan fields.
Definition: Unihan_enum.h:67
gboolean unihanField_is_indexed(UnihanField field)
Whether the field is indexed.
UnihanField * unihanTable_get_fields(UnihanTable table)
Returns all fields of the table in an UnihanField array.
int unihanField_array_index(UnihanField field, const UnihanField *fieldArray)
Return the index of a UnihanField in array.
IRG source rec.
Definition: Unihan.h:61
char * unihanChar_to_scalar_string(gunichar code)
Returns a string representing a UCS4 character.
UnihanLocale unihanLocale_parse(char *str)
Parse the string argument as Unihan Locale.
Enumeration and defintion used in libUnihan.
UnihanTable unihanField_get_extra_table(UnihanField field)
Return the corresponding extra table if the field needs one.
UnihanLocale
Enumeration of supported locales.
Definition: Unihan_enum.h:442
UnihanIRG_SourceId sourceId
a IRG source ID.
Definition: Unihan.h:62
UnihanTable * unihanField_get_all_tables(UnihanField field)
Return all the tables that contains the key.
char * unihan_find_firstMatched(UnihanField givenField, const char *givenValue, UnihanField queryField, UnihanQueryOption qOption)
Find the first matched result, given a field and its value.
gboolean unihanField_is_ucs4(UnihanField field)
Whether the field holds UCS4 value.
int unihanDb_close()
Close Unihan db.
gboolean unihanField_is_mandarin(UnihanField field)
Whether the field contains mandarin pronunciation.
gboolean unihanField_is_integer(UnihanField field)
Whether the field is an integer field.
int unihan_count_matched_record(UnihanTable table, StringList *valueList)
Count number of matched records in a table.
UnihanIRG_Source
Enumeration of IRG Source.
Definition: Unihan_enum.h:354