[gnome-characters/wip/properties: 2/15] libgc: Add accessor to character properties
- From: Daiki Ueno <dueno src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-characters/wip/properties: 2/15] libgc: Add accessor to character properties
- Date: Tue, 10 Feb 2015 13:52:14 +0000 (UTC)
commit 2fb70fdbb40cfee3e981b914fdc61d0a31752d8a
Author: Daiki Ueno <ueno gnu org>
Date: Mon Feb 9 17:48:01 2015 +0900
libgc: Add accessor to character properties
lib/gc.c | 39 +++++++++++++++++++++++++++++++++++++++
lib/gc.h | 3 +++
2 files changed, 42 insertions(+), 0 deletions(-)
---
diff --git a/lib/gc.c b/lib/gc.c
index 3473406..65467c2 100644
--- a/lib/gc.c
+++ b/lib/gc.c
@@ -403,6 +403,45 @@ gc_character_name (gunichar uc)
return unicode_character_name (uc, buffer);
}
+/**
+ * gc_character_category:
+ * @uc: a UCS-4 character
+ *
+ * Returns: (nullable): character category name of @uc.
+ */
+const gchar *
+gc_character_category (gunichar uc)
+{
+ uc_general_category_t category = uc_general_category (uc);
+ return uc_general_category_long_name (category);
+}
+
+/**
+ * gc_character_script:
+ * @uc: a UCS-4 character
+ *
+ * Returns: (nullable): the name of script which @uc belongs to.
+ */
+const gchar *
+gc_character_script (gunichar uc)
+{
+ const uc_script_t *script = uc_script (uc);
+ return script->name;
+}
+
+/**
+ * gc_character_group:
+ * @uc: a UCS-4 character
+ *
+ * Returns: (nullable): the name of Unicode block which @uc belongs to.
+ */
+const gchar *
+gc_character_block (gunichar uc)
+{
+ const uc_block_t *block = uc_block (uc);
+ return block->name;
+}
+
G_DEFINE_BOXED_TYPE (GcSearchResult, gc_search_result,
g_array_ref, g_array_unref);
diff --git a/lib/gc.h b/lib/gc.h
index c784aa4..a35df9d 100644
--- a/lib/gc.h
+++ b/lib/gc.h
@@ -58,6 +58,9 @@ GcSearchResult *gc_search_finish (GAsyncResult *result,
GError **error);
gchar *gc_character_name (gunichar uc);
+const gchar *gc_character_category (gunichar uc);
+const gchar *gc_character_script (gunichar uc);
+const gchar *gc_character_block (gunichar uc);
/* GTK+ support. gtk_clipboard_get() takes an GdkAtom as the first
argument, but GdkAtom is not accessible through GI. */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]