Mercurial > projects > dwt-addons
comparison dwtx/dwtxhelper/mangoicu/UTransform.d @ 91:11e8159caf7a
make the mango icu fork work.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 07 Jul 2008 15:53:07 +0200 |
parents | 040da1cb0d76 |
children | f05207c07a98 |
comparison
equal
deleted
inserted
replaced
90:7ffeace6c47f | 91:11e8159caf7a |
---|---|
80 All trademarks and registered trademarks mentioned herein are the | 80 All trademarks and registered trademarks mentioned herein are the |
81 property of their respective owners. | 81 property of their respective owners. |
82 | 82 |
83 *******************************************************************************/ | 83 *******************************************************************************/ |
84 | 84 |
85 module dwtx.dwthelper.mangoicu.UTransform; | 85 module dwtx.dwtxhelper.mangoicu.UTransform; |
86 | 86 |
87 private import dwtx.dwthelper.mangoicu.ICU, | 87 private import dwtx.dwtxhelper.mangoicu.ICU, |
88 dwtx.dwthelper.mangoicu.UString; | 88 dwtx.dwtxhelper.mangoicu.UString; |
89 | 89 |
90 /******************************************************************************* | 90 /******************************************************************************* |
91 | 91 |
92 See <A HREF="http://oss.software.ibm.com/icu/apiref/utrans_8h.html"> | 92 See <A HREF="http://oss.software.ibm.com/icu/apiref/utrans_8h.html"> |
93 this page</A> for full details. | 93 this page</A> for full details. |
107 | 107 |
108 /*********************************************************************** | 108 /*********************************************************************** |
109 | 109 |
110 ***********************************************************************/ | 110 ***********************************************************************/ |
111 | 111 |
112 this (UText id) | 112 this (UStringView id) |
113 { | 113 { |
114 Error e; | 114 UErrorCode e; |
115 | 115 |
116 handle = utrans_openU (id.get.ptr, id.len, 0, null, 0, null, e); | 116 handle = utrans_openU (id.get.ptr, id.len, 0, null, 0, null, e); |
117 testError (e, "failed to open ID transform"); | 117 testError (e, "failed to open ID transform"); |
118 } | 118 } |
119 | 119 |
120 /*********************************************************************** | 120 /*********************************************************************** |
121 | 121 |
122 ***********************************************************************/ | 122 ***********************************************************************/ |
123 | 123 |
124 this (UText rule, Direction dir) | 124 this (UStringView rule, Direction dir) |
125 { | 125 { |
126 Error e; | 126 UErrorCode e; |
127 | 127 |
128 handle = utrans_openU (null, 0, dir, rule.get.ptr, rule.len, null, e); | 128 handle = utrans_openU (null, 0, dir, rule.get.ptr, rule.len, null, e); |
129 testError (e, "failed to open rule-based transform"); | 129 testError (e, "failed to open rule-based transform"); |
130 } | 130 } |
131 | 131 |
140 | 140 |
141 /*********************************************************************** | 141 /*********************************************************************** |
142 | 142 |
143 ***********************************************************************/ | 143 ***********************************************************************/ |
144 | 144 |
145 UText getID () | 145 UStringView getID () |
146 { | 146 { |
147 uint len; | 147 uint len; |
148 wchar *s = utrans_getUnicodeID (handle, len); | 148 wchar *s = utrans_getUnicodeID (handle, len); |
149 return new UText (s[0..len]); | 149 return new UStringView (s[0..len]); |
150 } | 150 } |
151 | 151 |
152 /*********************************************************************** | 152 /*********************************************************************** |
153 | 153 |
154 ***********************************************************************/ | 154 ***********************************************************************/ |
155 | 155 |
156 UTransform setFilter (UText filter) | 156 UTransform setFilter (UStringView filter) |
157 { | 157 { |
158 Error e; | 158 UErrorCode e; |
159 | 159 |
160 if (filter.length) | 160 if (filter.length) |
161 utrans_setFilter (handle, filter.get.ptr, filter.len, e); | 161 utrans_setFilter (handle, filter.get.ptr, filter.len, e); |
162 else | 162 else |
163 utrans_setFilter (handle, null, 0, e); | 163 utrans_setFilter (handle, null, 0, e); |
170 | 170 |
171 ***********************************************************************/ | 171 ***********************************************************************/ |
172 | 172 |
173 UTransform execute (UString text) | 173 UTransform execute (UString text) |
174 { | 174 { |
175 Error e; | 175 UErrorCode e; |
176 uint textLen = text.len; | 176 uint textLen = text.len; |
177 | 177 |
178 utrans_transUChars (handle, text.get.ptr, &textLen, text.content.length, 0, &text.len, e); | 178 utrans_transUChars (handle, text.get.ptr, &textLen, text.content.length, 0, &text.len, e); |
179 testError (e, "failed to execute transform"); | 179 testError (e, "failed to execute transform"); |
180 return this; | 180 return this; |
196 | 196 |
197 ***********************************************************************/ | 197 ***********************************************************************/ |
198 | 198 |
199 private static extern (C) | 199 private static extern (C) |
200 { | 200 { |
201 Handle function (wchar*, uint, uint, wchar*, uint, void*, inout Error) utrans_openU; | 201 Handle function (wchar*, uint, uint, wchar*, uint, void*, inout UErrorCode) utrans_openU; |
202 void function (Handle) utrans_close; | 202 void function (Handle) utrans_close; |
203 wchar* function (Handle, inout uint) utrans_getUnicodeID; | 203 wchar* function (Handle, inout uint) utrans_getUnicodeID; |
204 void function (Handle, wchar*, uint, inout Error) utrans_setFilter; | 204 void function (Handle, wchar*, uint, inout UErrorCode) utrans_setFilter; |
205 void function (Handle, wchar*, uint*, uint, uint, uint*, inout Error) utrans_transUChars; | 205 void function (Handle, wchar*, uint*, uint, uint, uint*, inout UErrorCode) utrans_transUChars; |
206 } | 206 } |
207 | 207 |
208 /*********************************************************************** | 208 /*********************************************************************** |
209 | 209 |
210 ***********************************************************************/ | 210 ***********************************************************************/ |