1
+ //
2
+ // HGInputContext.h
3
+ // CharmIM
4
+ //
5
+ // Created by youknowone on 11. 9. 1..
6
+ // Copyright 2011 youknowone.org. All rights reserved.
7
+ //
8
+
9
+ /* !
10
+ @header
11
+ @brief See hangul.h and hangulinputcontext.c to see related libhangul functions
12
+
13
+ libhangul의 hangul input context 코드를 Objective-C 객체 모델로 감싼다. 관련 libhangul 함수를 보기 위해서 hangul/hangul.h와 hangul/hangulinputcontext.c 를 본다.
14
+ */
15
+
16
+ #import < Foundation/Foundation.h>
17
+ #import < Hangul/HGCharacter.h>
18
+
19
+ @class HGHangulCombination;
20
+
21
+ /* !
22
+ @brief @ref HangulKeyboard 를 감싼다.
23
+
24
+ @ref HGInputContext 를 위해 새 데이터를 만들때는 -init 을, 원래의 HangulKeyboard 데이터를 변환하기 위해서는 -initWithKeyboardData:freeWhenDone: 과 -keyboardWithKeyboardData:freeWhenDone: 을 사용한다.
25
+ */
26
+ @interface HGKeyboard : NSObject {
27
+ @private
28
+ HangulKeyboard *data;
29
+
30
+ struct {
31
+ unsigned freeWhenDone:1 ;
32
+ } flags;
33
+ }
34
+ /* ! @property
35
+ @brief 미구현 기능을 위해 HangulKeyboard 객체에 접근할 때 사용한다.
36
+ */
37
+ @property (nonatomic , readonly ) HangulKeyboard *data;
38
+
39
+ // ! @brief HangulKeyboard 데이터를 기반으로 객체 생성
40
+ - (id )initWithKeyboardData : (HangulKeyboard *)data freeWhenDone : (BOOL )YesOrNo ;
41
+ // ! @brief HangulKeyboard 데이터를 기반으로 객체 생성
42
+ + (id )keyboardWithKeyboardData : (HangulKeyboard *)data freeWhenDone : (BOOL )YesOrNo ;
43
+
44
+ // ! @brief @ref hangul_keyboard_set_value
45
+ - (void )setValue : (HGUCSChar)value forKey : (int )key ;
46
+ // ! @brief @ref hangul_keyboard_set_type
47
+ - (void )setType : (int )type ;
48
+
49
+ @end
50
+
51
+ /* !
52
+ @brief 출력 형태에 관한 상수
53
+ */
54
+ typedef enum {
55
+ HGOutputModeSyllable = HANGUL_OUTPUT_SYLLABLE,
56
+ HGOutputModeJamo = HANGUL_OUTPUT_JAMO,
57
+ } HGOutputMode;
58
+
59
+ /* !
60
+ @brief @ref HangulInputContext 를 감싼다.
61
+
62
+ @ref HangulInputContext 의 기능에 대한 Objective-C의 객체 모델을 제공한다. 객체 모델이 지원하지 않는 기능에 대해서는 -context 로 libhangul의 컨텍스트에 직접 접근하여 사용할 수 있다.
63
+ */
64
+ @interface HGInputContext : NSObject {
65
+ @private
66
+ HangulInputContext *context;
67
+ }
68
+
69
+ // ! @brief 미구현 기능을 이용하기 위해 HangulInputContext 에 직접 접근
70
+ @property (nonatomic , readonly ) HangulInputContext *context;
71
+
72
+ // ! @brief @ref hangul_ic_new @ref hangul_ic_delete
73
+ - (id )initWithKeyboardIdentifier : (NSString *)code ;
74
+ // ! @brief @ref hangul_ic_process
75
+ - (BOOL )process : (int )ascii ;
76
+ // ! @brief @ref hangul_ic_reset
77
+ - (void )reset ;
78
+ // ! @brief @ref hangul_ic_backspace
79
+ - (BOOL )backspace ;
80
+
81
+ // ! @brief @ref hangul_ic_is_empty
82
+ @property (nonatomic , readonly , getter =isEmpty) BOOL empty;
83
+ // ! @brief @ref hangul_ic_has_choseong
84
+ @property (nonatomic , readonly ) BOOL hasChoseong;
85
+ // ! @brief @ref hangul_ic_has_jungseong
86
+ @property (nonatomic , readonly ) BOOL hasJungseong;
87
+ // ! @brief @ref hangul_ic_has_jongseong
88
+ @property (nonatomic , readonly ) BOOL hasJongseong;
89
+ // ! @brief @ref hangul_ic_is_transliteration
90
+ @property (nonatomic , readonly , getter =isTransliteration) BOOL transliteration;
91
+ /* !
92
+ @brief @ref hangul_ic_preedit_string
93
+
94
+ @ref IMKInputController 의 -composedString 과 대응한다.
95
+ */
96
+ @property (nonatomic , readonly ) NSString *preeditString;
97
+ // ! @brief @ref hangul_ic_commit_string
98
+ @property (nonatomic , readonly ) NSString *commitString;
99
+ /* !
100
+ @brief @ref hangul_ic_flush
101
+
102
+ @discussion 현재 조합 중인 글자의 조합을 완료하고 @ref preeditString 을 결과로 돌려준다.
103
+ */
104
+ - (NSString *)flushString ; // unclear naming...
105
+
106
+ // ! @brief @ref hangul_ic_set_output_mode
107
+ - (void )setOutputMode : (HGOutputMode)mode ;
108
+ // ! @brief @ref hangul_ic_set_keyboard
109
+ - (void )setKeyboard : (HGKeyboard *)aKeyboard ;
110
+ // ! @brief @ref hangul_ic_set_keyboard
111
+ - (void )setKeyboardWithData : (HangulKeyboard *)keyboardData ;
112
+ // ! @brief @ref hangul_ic_select_keyboard
113
+ - (void )setKeyboardWithIdentifier : (NSString *)identifier ;
114
+ // ! @brief @ref hangul_ic_set_combination
115
+ - (void )setCombination : (HangulCombination *)aCombination ;
116
+
117
+ /* out of use, out of mind
118
+ void hangul_ic_connect_callback(HangulInputContext* hic, const char* event,
119
+ void* callback, void* user_data);
120
+
121
+ */
122
+ @end
123
+
124
+ /* out of use, out of mind
125
+ unsigned hangul_ic_get_n_keyboards();
126
+ */
127
+ // ! @brief @ref hangul_ic_get_keyboard_id
128
+ NSString *HGKeyboardIdentifierAtIndex (NSUInteger index);
129
+ // ! @brief @ref hangul_ic_get_keyboard_name
130
+ NSString *HGKeyboardNameAtIndex (NSUInteger index);
131
+
132
+
133
+ /* !
134
+ @brief HGUSCChar - NSString 변환
135
+
136
+ libhangul의 ucschar 문자열을 NSString 으로 변환하는 생성자 카테고리이다.
137
+ */
138
+ @interface NSString (HGUCS)
139
+
140
+ // ! @brief HGUCSChar 문자열로 NSString을 생성 (UTF-32LE)
141
+ - (id )initWithHGUCSString : (const HGUCSChar *)ucsString ;
142
+ // ! @brief HGUCSChar 문자열로 NSString을 생성 (UTF-32LE)
143
+ + (id )stringWithHGUCSString : (const HGUCSChar *)ucsString ;
144
+
145
+ @end
0 commit comments