Unihan_builtin.h File Reference

Data structures and functions for built-in tables and fields only. More...

#include "Unihan.h"

Go to the source code of this file.

Functions

UnihanTable unihanField_get_builtin_preferred_table (UnihanField field)
 Return the preferred table of field (Builtin).
UnihanTableunihanField_get_builtin_required_tables (UnihanField field)
 Return an array of tables which are required by the given field (Builtin).
gboolean unihanField_builtin_has_flags (UnihanField field, guint flags)
 Whether field has given flags.
UnihanField unihanField_builtin_parse (const char *str)
 Parses the string argument as a UnihanField.
const char * unihanField_builtin_to_string (UnihanField field)
 Returns a string representing a built-in UnihanField.
UnihanFieldunihanTable_get_builtin_fields (UnihanTable table)
 Returns all built-in fields of the table in an UnihanField array.
UnihanTable unihanTable_builtin_parse (const char *str)
 Parses the string argument as a UnihanTable.
const char * unihanTable_builtin_to_string (UnihanTable table)
 Returns all built-in fields of the table in an UnihanField array.
int unihan_import_builtin_table_tagValue (sqlite3 *db, gunichar code, UnihanField field, const char *tagValue)
 Import a tag value of a character from a line of Unihan.txt.


Detailed Description

This file contains the data structures and functions which only deal for built-in tables and fields.

These function are mainly for rebuilding database only, i.e. Normally not needed.


Function Documentation

int unihan_import_builtin_table_tagValue ( sqlite3 *  db,
gunichar  code,
UnihanField  field,
const char *  tagValue 
)

This function imports a line in Unihan.txt to database db. For non-singleton fields (fields which may have multiple values for each character), the tag value is split with the delimiter ' ', and each chunk is passed to unihan_import_builtin_table_single_tagValue() for further process.

Parameters:
db Db handle
code the UCS4 representation of the character.
field The UnihanField to be import.
tagValue The value of the field.
Returns:
0 if success, otherwise return nonzero value.
See also:
unihan_import_builtin_table_tagValue_original.

gboolean unihanField_builtin_has_flags ( UnihanField  field,
guint  flags 
)

Whether field has given flags. Always return FALSE if field is UNIHAN_INVALID_FIELD or field is not built-in (field >=UNIHAN_FIELD_3RD_PARTY).

Parameters:
field field to be checked.
flags flags to be checked.
Returns:
TRUE if field has flags; FALSE otherwise.

UnihanField unihanField_builtin_parse ( const char *  str  ) 

Parses the string argument as a UnihanField. Note that the match is case-sensitive.

Parameters:
str the string to be parsed.
Returns:
the equivalent UnihanField; UNIHAN_INVALID_FIELD if str does not match any of the field name.

const char* unihanField_builtin_to_string ( UnihanField  field  ) 

Parameters:
field the UnihanField.
Returns:
a string representing the UnihanField.

UnihanTable unihanField_get_builtin_preferred_table ( UnihanField  field  ) 

libUnihan is field-center, that is, normally you only need to mention the field to get the desirable result. This function returns the preferred table need to get that field.

The field can be either real or pseudo.

Note:
Some pseudo fields like UNIHAN_FIELD_kIRG_GSOURCE require more than one tables to obtain full function. Use unihanField_get_builtin_required_table() instead if this is the case.
Use unihanField_get_allTables() to obtain all the table that the field belongs to.

Parameters:
field the UnihanField.
Returns:
The preferred table if a valid field is given; UNIHAN_INVALID_TABLE if invalid field is given.
See also:
unihanField_get_builtin_required_table()

unihanField_get_all_builtin_tables(UnihanField field)

UnihanTable* unihanField_get_builtin_required_tables ( UnihanField  field  ) 

This function returns a newly allocated array of tables which are required by the given field. UNIHAN_INVALID_TABLE marks the end of the array.

If a real field is given, then it returns an array that has the preferred table.

If a pseudo field is given, then it returns an array which contains all tables it need to generate it.

Use free() or g_free() to free the result.

Parameters:
field the UnihanField.
Returns:
a newly allocated array of tables which are required by the given field; UNIHAN_INVALID_TABLE if invalid field is given.
See also:
unihanField_get_builtin_required_table()

unihanField_get_all_builtin_tables(UnihanField field)

UnihanTable unihanTable_builtin_parse ( const char *  str  ) 

Parses the string argument as a UnihanTable. Note that the match is case-sensitive.

Parameters:
str the string to be parsed.
Returns:
the equivalent UnihanTable; UNIHAN_INVALID_Table if str does not match any of the table name.

const char * unihanTable_builtin_to_string ( UnihanTable  table  ) 

Returns a string representing a built-in UnihanTable.

Returns all built-in fields of the table in an UnihanField array. The returned UnihanField array is terminated by UNIHAN_INVALID_FIELD. Use free() or g_free() to free the UnihanField array.

Parameters:
table the UnihanTable.
Returns:
all fields of the table in an UnihanField array.
Parameters:
table the UnihanTable.
Returns:
a string representing the UnihanTable.

UnihanField* unihanTable_get_builtin_fields ( UnihanTable  table  ) 

Returns all built-in fields of the table in an UnihanField array. The returned UnihanField array is terminated by UNIHAN_INVALID_FIELD. Use free() or g_free() to free the UnihanField array.

Parameters:
table the UnihanTable.
Returns:
all fields of the table in an UnihanField array.


Generated on Tue Jan 13 10:49:25 2009 for libUnihan by  doxygen 1.5.7.1