[Groonga-commit] groonga/groonga at 84cd49b [master] Add grn_char_type_to_string()

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Apr 9 12:23:13 JST 2018


Kouhei Sutou	2018-04-09 12:23:13 +0900 (Mon, 09 Apr 2018)

  New Revision: 84cd49b0c5a50378194fd358e429df6a3eba2da9
  https://github.com/groonga/groonga/commit/84cd49b0c5a50378194fd358e429df6a3eba2da9

  Message:
    Add grn_char_type_to_string()

  Modified files:
    include/groonga/groonga.h
    lib/string.c

  Modified: include/groonga/groonga.h (+3 -2)
===================================================================
--- include/groonga/groonga.h    2018-04-08 00:54:46 +0900 (ec6b09829)
+++ include/groonga/groonga.h    2018-04-09 12:23:13 +0900 (e789f8c5e)
@@ -1594,10 +1594,11 @@ typedef enum {
   GRN_CHAR_HIRAGANA,
   GRN_CHAR_KATAKANA,
   GRN_CHAR_KANJI,
-  GRN_CHAR_OTHERS,
-  GRN_CHAR_EMOJI
+  GRN_CHAR_OTHERS
 } grn_char_type;
 
+GRN_API const char *grn_char_type_to_string(grn_char_type type);
+
 GRN_API grn_obj *grn_string_open(grn_ctx *ctx,
                                  const char *string,
                                  unsigned int length_in_bytes,

  Modified: lib/string.c (+25 -0)
===================================================================
--- lib/string.c    2018-04-08 00:54:46 +0900 (3ba8b8678)
+++ lib/string.c    2018-04-09 12:23:13 +0900 (c3da752db)
@@ -25,6 +25,31 @@
 
 #include <groonga/tokenizer.h>
 
+const char *
+grn_char_type_to_string(grn_char_type type)
+{
+  switch (type) {
+  case GRN_CHAR_NULL:
+    return "null";
+  case GRN_CHAR_ALPHA:
+    return "alpha";
+  case GRN_CHAR_DIGIT:
+    return "digit";
+  case GRN_CHAR_SYMBOL:
+    return "symbol";
+  case GRN_CHAR_HIRAGANA:
+    return "hiragana";
+  case GRN_CHAR_KATAKANA:
+    return "katakana";
+  case GRN_CHAR_KANJI:
+    return "kanji";
+  case GRN_CHAR_OTHERS:
+    return "others";
+  }
+
+  return "unknown";
+}
+
 static grn_string *
 grn_fake_string_open(grn_ctx *ctx, grn_string *string)
 {
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180409/b2d87897/attachment-0001.htm 



More information about the Groonga-commit mailing list
Back to archive index