Fix license
[platform/core/uifw/anthy.git] / anthy / xstr.h
1 /*
2  * AnthyÆâÉô¤Ç»È¤¦Ê¸»úÎó
3  * Æä˼ÂÁõ¤ò±£Ê䷤褦¤È¤·¤Æ¤¤¤ë¤ï¤±¤Ç¤Ï̵¤¤¤Î¤Ç¡¢
4  * ¤³¤³¤Ë¤¢¤ë´Ø¿ô¤Î»ÈÍѤ϶¯À©¤·¤Ê¤¤¡£
5  */
6 #ifndef _xstr_h_included_
7 #define _xstr_h_included_
8
9 /** Ê¸»ú·¿
10  * UCS4¤¬Æþ¤Ã¤Æ¤¤¤ë */
11 typedef int xchar;
12
13 /** Ê¸»úÎó
14  * xstr¤Ëtypedef¤µ¤ì¤Æ¤¤¤ë
15  */
16 typedef struct xstr_ {
17   /** Ê¸»úÎó¤Ø¤Î¥Ý¥¤¥ó¥¿ */
18   xchar *str;
19   /** xchar¤Î¿ô */
20   int len;
21 } xstr;
22
23 /* ¥Ç¥Ð¥Ã¥°ÍѤνÐÎÏ´Ø¿ô */
24 void anthy_putxchar(xchar );
25 void anthy_putxstr(xstr *);
26 void anthy_putxstrln(xstr *);
27
28 /* C¤Îʸ»úÎó¤Ø¤Î½ñ¤­½Ð¤· */
29 int anthy_sputxchar(char *, xchar , int encoding);
30 int anthy_sputxstr(char *, xstr *, int encoding);
31 int anthy_snputxstr(char *, int , xstr *, int encoding);
32
33 /* xstr¤Èstr¶¦¤Ëmalloc¤µ¤ì¤ë¡¢free¤ÇξÊý²òÊü¤¹¤ë¤«anthy_free_xstr¤Ç²òÊü¤¹¤ë */
34 xstr *anthy_cstr_to_xstr(const char *, int );
35 /* ·ë²Ì¤Ïmalloc¤Ç³ÎÊݤµ¤ì¤ë */
36 char *anthy_xstr_to_cstr(xstr *, int);
37
38 /* xstr¤Èstr¶¦¤Ëmalloc¤µ¤ì¤ë */
39 xstr *anthy_xstr_dup(xstr *);
40 void anthy_free_xstr(xstr *);
41
42 /* ·ë²Ì¤Ïmalloc¤Ç³ÎÊݤµ¤ì¤ë */
43 xchar *anthy_xstr_dup_str(xstr *);
44 void anthy_free_xstr_str(xstr *);
45
46 /* Ê¸»úÎó¤ò¥³¥Ô¡¼¤¹¤ë */
47 xstr* anthy_xstrcpy(xstr *, xstr *);
48 /* Ê¸»úÎó¤òÈæ³Ó¤¹¤ë¡£strcmp¤ÈƱÅù¤ÎÆ°ºî(ÊÖ¤êÃͤÎÉä¹æ¤Ë°ÕÌ£¤¬¤¢¤ë) */
49 int anthy_xstrcmp(xstr *, xstr *);
50 /* nʸ»úÌܤޤÇʸ»úÎó¤òÈæ³Ó¤¹¤ë¡£strncmp¤ÈƱÅù¤ÎÆ°ºî(ÊÖ¤êÃͤÎÉä¹æ¤Ë°ÕÌ£¤¬¤¢¤ë) */
51 int anthy_xstrncmp(xstr *, xstr *, int);
52 /* s->str¤òrealloc¤¹¤ë */
53 xstr *anthy_xstrcat(xstr *s, xstr *d);
54 /* xs->str¤òrealloc¤¹¤ë */
55 xstr *anthy_xstrappend(xstr *xs, xchar c);
56
57 /* strtoll¤ÎxstrÈÇ */
58 long long anthy_xstrtoll(xstr *);
59 /* Á´³Ñ¿ô»ú¤«¤éȾ³Ñ¿ô»ú¤Ø¤ÎÊÑ´¹ */
60 xstr *anthy_xstr_wide_num_to_num(xstr *);
61 /* ¤Ò¤é¤¬¤Ê¤«¤é¥«¥¿¥«¥Ê¤Ø¤ÎÊÑ´¹ */
62 xstr *anthy_xstr_hira_to_kata(xstr *);
63 /**/
64 xstr *anthy_xstr_hira_to_half_kata(xstr *);
65 xstr *anthy_conv_half_wide(xstr *xs);
66
67 /*  xchar¤Î·¿ */
68 #define XCT_ALL 0xffffffff
69 #define XCT_NONE 0
70 #define XCT_HIRA 1
71 #define XCT_KATA 2
72 #define XCT_ASCII 4
73 #define XCT_NUM 8
74 #define XCT_WIDENUM 16
75 #define XCT_OPEN 32
76 #define XCT_CLOSE 64
77 /* Ä¾Á°¤Îʸ»ú¤Î°ìÉô */
78 #define XCT_PART 128
79 /* ½õ»ì */
80 #define XCT_DEP 256
81 /* µ­¹æ */
82 #define XCT_SYMBOL 1024
83 /* ´Á»ú */
84 #define XCT_KANJI 2048
85 /* ¶çÆÉÅÀ */
86 #define XCT_PUNCTUATION 4096
87
88 /** XCT_*¤¬Ê֤äƤ¯¤ë */
89 int anthy_get_xchar_type(const xchar );
90 /** Á´¤Æ¤Îʸ»ú¤ËÂФ·¤ÆXCT_*¤ÎÏÀÍýÀѤò¤È¤Ã¤¿¤â¤Î */
91 int anthy_get_xstr_type(const xstr *);
92
93 /* hash */
94 int anthy_xstr_hash(xstr *);
95
96 /* xstr.c */
97 int anthy_init_xstr(void);
98 void anthy_quit_xstr(void);
99 void anthy_xstr_set_print_encoding(int );
100
101 int anthy_euc_to_ucs(int ec);
102 int anthy_ucs_to_euc(int uc);
103
104 const char *anthy_utf8_to_ucs4_xchar(const char *s, xchar *res);
105 /**/
106 char *anthy_conv_euc_to_utf8(const char *s);
107 char *anthy_conv_utf8_to_euc(const char *s);
108
109 #endif