diff options
author | Akira TAGOH <akira@tagoh.org> | 2012-01-18 11:26:12 +0900 |
---|---|---|
committer | Akira TAGOH <akira@tagoh.org> | 2012-01-18 11:26:12 +0900 |
commit | 5d72b031d8eb68277a98afeb907273b304e4c4f2 (patch) | |
tree | df7d2257e14e952588ff530ebf10537efb47f38f | |
parent | 1dc33080f6272a8fccde50349ac97ed7512b5974 (diff) |
Update docs
-rw-r--r-- | liblangtag/lt-script-db.c | 63 | ||||
-rw-r--r-- | liblangtag/lt-script-db.h | 3 |
2 files changed, 52 insertions, 14 deletions
diff --git a/liblangtag/lt-script-db.c b/liblangtag/lt-script-db.c index 7523850..6f170c3 100644 --- a/liblangtag/lt-script-db.c +++ b/liblangtag/lt-script-db.c @@ -32,6 +32,14 @@ #include "lt-script-db.h" +/** + * SECTION:lt-script-db + * @Short_Description: An interface to access Script Database + * @Title: Database - Script + * + * This class provides an interface to access Script Database. which has been + * registered as ISO 15924. + */ struct _lt_script_db_t { lt_mem_t parent; GHashTable *script_entries; @@ -180,6 +188,13 @@ lt_script_db_parse(lt_script_db_t *scriptdb, } /*< public >*/ +/** + * lt_script_db_new: + * + * Create a new instance of a #lt_script_db_t. + * + * Returns: (transfer full): a new instance of #lt_script_db_t. + */ lt_script_db_t * lt_script_db_new(void) { @@ -221,33 +236,57 @@ lt_script_db_new(void) return retval; } +/** + * lt_script_db_ref: + * @scriptdb: a #lt_script_db_t. + * + * Increases the reference count of @scriptdb. + * + * Returns: (transfer none): the same @scriptdb object. + */ lt_script_db_t * -lt_script_db_ref(lt_script_db_t *script) +lt_script_db_ref(lt_script_db_t *scriptdb) { - g_return_val_if_fail (script != NULL, NULL); + g_return_val_if_fail (scriptdb != NULL, NULL); - return lt_mem_ref(&script->parent); + return lt_mem_ref(&scriptdb->parent); } +/** + * lt_script_db_unref: + * @scriptdb: a #lt_script_db_t. + * + * Decreases the reference count of @scriptdb. when its reference count + * drops to 0, the object is finalized (i.e. its memory is freed). + */ void -lt_script_db_unref(lt_script_db_t *script) +lt_script_db_unref(lt_script_db_t *scriptdb) { - if (script) - lt_mem_unref(&script->parent); + if (scriptdb) + lt_mem_unref(&scriptdb->parent); } +/** + * lt_script_db_lookup: + * @scriptdb: a #lt_script_db_t. + * @subtag: a subtag name to lookup. + * + * Lookup @lt_script_t if @subtag is valid and registered into the database. + * + * Returns: (transfer full): a #lt_script_t that meets with @subtag. + */ lt_script_t * -lt_script_db_lookup(lt_script_db_t *script, - const gchar *script_name) +lt_script_db_lookup(lt_script_db_t *scriptdb, + const gchar *subtag) { lt_script_t *retval; gchar *s; - g_return_val_if_fail (script != NULL, NULL); - g_return_val_if_fail (script_name != NULL, NULL); + g_return_val_if_fail (scriptdb != NULL, NULL); + g_return_val_if_fail (subtag != NULL, NULL); - s = g_strdup(script_name); - retval = g_hash_table_lookup(script->script_entries, + s = g_strdup(subtag); + retval = g_hash_table_lookup(scriptdb->script_entries, lt_strlower(s)); g_free(s); if (retval) diff --git a/liblangtag/lt-script-db.h b/liblangtag/lt-script-db.h index 2a61707..51e345f 100644 --- a/liblangtag/lt-script-db.h +++ b/liblangtag/lt-script-db.h @@ -37,9 +37,8 @@ typedef struct _lt_script_db_t lt_script_db_t; lt_script_db_t *lt_script_db_new (void); lt_script_db_t *lt_script_db_ref (lt_script_db_t *scriptdb); void lt_script_db_unref (lt_script_db_t *scriptdb); -GList *lt_script_db_get_scripts(lt_script_db_t *scriptdb); lt_script_t *lt_script_db_lookup (lt_script_db_t *scriptdb, - const gchar *script_name_or_alpha_code_or_num_code); + const gchar *subtag); G_END_DECLS |