annotate dwtx/dwtxhelper/mangoicu/UCollator.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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1 /*******************************************************************************
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3 @file UCollator.d
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
4
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
5 Copyright (c) 2004 Kris Bell
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
6
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
7 This software is provided 'as-is', without any express or implied
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
8 warranty. In no event will the authors be held liable for damages
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
9 of any kind arising from the use of this software.
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
10
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
11 Permission is hereby granted to anyone to use this software for any
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
12 purpose, including commercial applications, and to alter it and/or
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
13 redistribute it freely, subject to the following restrictions:
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
14
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
15 1. The origin of this software must not be misrepresented; you must
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
16 not claim that you wrote the original software. If you use this
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
17 software in a product, an acknowledgment within documentation of
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
18 said product would be appreciated but is not required.
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
19
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
20 2. Altered source versions must be plainly marked as such, and must
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
21 not be misrepresented as being the original software.
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
22
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
23 3. This notice may not be removed or altered from any distribution
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
24 of the source.
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
25
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
26 4. Derivative works are permitted, but they must carry this notice
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
27 in full and credit the original source.
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
28
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
29
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
30 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
31
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
32
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
33 @version Initial version, November 2004
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
34 @author Kris
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
35
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
36 Note that this package and documentation is built around the ICU
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
37 project (http://oss.software.ibm.com/icu/). Below is the license
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
38 statement as specified by that software:
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
39
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
40
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
41 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
42
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
43
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
44 ICU License - ICU 1.8.1 and later
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
45
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
46 COPYRIGHT AND PERMISSION NOTICE
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
47
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
48 Copyright (c) 1995-2003 International Business Machines Corporation and
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
49 others.
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
50
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
51 All rights reserved.
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
52
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
53 Permission is hereby granted, free of charge, to any person obtaining a
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
54 copy of this software and associated documentation files (the
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
55 "Software"), to deal in the Software without restriction, including
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
56 without limitation the rights to use, copy, modify, merge, publish,
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
57 distribute, and/or sell copies of the Software, and to permit persons
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
58 to whom the Software is furnished to do so, provided that the above
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
59 copyright notice(s) and this permission notice appear in all copies of
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
60 the Software and that both the above copyright notice(s) and this
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
61 permission notice appear in supporting documentation.
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
62
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
63 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
64 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
65 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
66 OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
67 HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
68 INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
69 FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
70 NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
71 WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
72
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
73 Except as contained in this notice, the name of a copyright holder
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
74 shall not be used in advertising or otherwise to promote the sale, use
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
75 or other dealings in this Software without prior written authorization
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
76 of the copyright holder.
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
77
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
78 ----------------------------------------------------------------------
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
79
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
80 All trademarks and registered trademarks mentioned herein are the
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
81 property of their respective owners.
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
82
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
83 *******************************************************************************/
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
84
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
85 module dwtx.dwtxhelper.mangoicu.UCollator;
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
86
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
87 private import dwtx.dwtxhelper.mangoicu.ICU,
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
88 dwtx.dwtxhelper.mangoicu.USet,
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
89 dwtx.dwtxhelper.mangoicu.ULocale,
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
90 dwtx.dwtxhelper.mangoicu.UString;
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
91
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
92 /*******************************************************************************
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
93
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
94 The API for Collator performs locale-sensitive string comparison.
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
95 You use this service to build searching and sorting routines for
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
96 natural language text. Important: The ICU collation service has been
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
97 reimplemented in order to achieve better performance and UCA compliance.
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
98 For details, see the collation design document.
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
99
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
100 For more information about the collation service see the users guide.
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
101
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
102 Collation service provides correct sorting orders for most locales
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
103 supported in ICU. If specific data for a locale is not available,
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
104 the orders eventually falls back to the UCA sort order.
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
105
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
106 Sort ordering may be customized by providing your own set of rules.
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
107 For more on this subject see the Collation customization section of
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
108 the users guide.
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
109
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
110 See <A HREF="http://oss.software.ibm.com/icu/apiref/ucol_8h.html">
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
111 this page</A> for full details.
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
112
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
113 *******************************************************************************/
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
114
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
115 class UCollator : ICU
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
116 {
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
117 package Handle handle;
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
118
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
119 enum Attribute
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
120 {
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
121 FrenchCollation,
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
122 AlternateHandling,
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
123 CaseFirst,
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
124 CaseLevel,
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
125 NormalizationMode,
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
126 DecompositionMode = NormalizationMode,
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
127 strength,
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
128 HiraganaQuaternaryMode,
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
129 NumericCollation,
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
130 AttributeCount
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
131 }
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
132
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
133 enum AttributeValue
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
134 {
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
135 Default = -1,
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
136 Primary = 0,
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
137 Secondary = 1,
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
138 Tertiary = 2,
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
139 DefaultStrength = Tertiary,
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
140 CeStrengthLimit,
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
141 Quaternary = 3,
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
142 Identical = 15,
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
143 strengthLimit,
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
144 Off = 16,
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
145 On = 17,
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
146 Shifted = 20,
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
147 NonIgnorable = 21,
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
148 LowerFirst = 24,
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
149 UpperFirst = 25,
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
150 AttributeValueCount
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
151 }
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
152
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
153 enum RuleOption
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
154 {
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
155 TailoringOnly,
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
156 FullRules
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
157 }
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
158
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
159 enum BoundMode
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
160 {
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
161 BoundLower = 0,
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
162 BoundUpper = 1,
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
163 BoundUpperLong = 2,
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
164 BoundValueCount
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
165 }
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
166
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
167 typedef AttributeValue Strength;
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
168
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
169 /***********************************************************************
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
170
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
171 Open a UCollator for comparing strings. The locale specified
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
172 determines the required collation rules. Special values for
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
173 locales can be passed in - if ULocale.Default is passed for
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
174 the locale, the default locale collation rules will be used.
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
175 If ULocale.Root is passed, UCA rules will be used
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
176
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
177 ***********************************************************************/
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
178
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
179 this (ULocale locale)
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
180 {
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
181 UErrorCode e;
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
182
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
183 handle = ucol_open (toString(locale.name), e);
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
184 testError (e, "failed to open collator");
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
185 }
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
186
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
187 /***********************************************************************
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
188
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
189 Produce a UCollator instance according to the rules supplied.
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
190
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
191 The rules are used to change the default ordering, defined in
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
192 the UCA in a process called tailoring. For the syntax of the
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
193 rules please see users guide
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
194
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
195 ***********************************************************************/
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
196
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
197 this (UStringView rules, AttributeValue mode, Strength strength)
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
198 {
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
199 UErrorCode e;
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
200
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
201 handle = ucol_openRules (rules.get.ptr, rules.len, mode, strength, null, e);
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
202 testError (e, "failed to open rules-based collator");
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
203 }
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
204
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
205 /***********************************************************************
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
206
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
207 Open a collator defined by a short form string. The
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
208 structure and the syntax of the string is defined in
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
209 the "Naming collators" section of the users guide:
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
210 http://oss.software.ibm.com/icu/userguide/Collate_Concepts.html#Naming_Collators
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
211 Attributes are overriden by the subsequent attributes.
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
212 So, for "S2_S3", final strength will be 3. 3066bis
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
213 locale overrides individual locale parts.
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
214
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
215 The call to this constructor is equivalent to a plain
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
216 constructor, followed by a series of calls to setAttribute
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
217 and setVariableTop
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
218
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
219 ***********************************************************************/
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
220
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
221 this (char[] shortName, bool forceDefaults)
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
222 {
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
223 UErrorCode e;
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
224
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
225 handle = ucol_openFromShortString (toString(shortName), forceDefaults, null, e);
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
226 testError (e, "failed to open short-name collator");
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
227 }
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
228
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
229 /***********************************************************************
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
230
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
231 Internal constructor invoked via USearch
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
232
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
233 ***********************************************************************/
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
234
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
235 package this (Handle handle)
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
236 {
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
237 this.handle = handle;
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
238 }
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
239
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
240 /***********************************************************************
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
241
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
242 Close a UCollator
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
243
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
244 ***********************************************************************/
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
245
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
246 ~this ()
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
247 {
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
248 ucol_close (handle);
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
249 }
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
250
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
251 /***********************************************************************
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
252
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
253 Get a set containing the contractions defined by the
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
254 collator.
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
255
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
256 The set includes both the UCA contractions and the
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
257 contractions defined by the collator. This set will
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
258 contain only strings. If a tailoring explicitly
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
259 suppresses contractions from the UCA (like Russian),
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
260 removed contractions will not be in the resulting set.
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
261
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
262 ***********************************************************************/
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
263
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
264 void getContractions (USet set)
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
265 {
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
266 UErrorCode e;
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
267
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
268 ucol_getContractions (handle, set.handle, e);
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
269 testError (e, "failed to get collator contractions");
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
270 }
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
271
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
272 /***********************************************************************
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
273
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
274 Compare two strings. Return value is -, 0, +
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
275
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
276 ***********************************************************************/
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
277
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
278 int strcoll (UStringView source, UStringView target)
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
279 {
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
280 return ucol_strcoll (handle, source.get.ptr, source.len, target.get.ptr, target.len);
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
281 }
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
282
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
283 /***********************************************************************
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
284
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
285 Determine if one string is greater than another. This
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
286 function is equivalent to strcoll() > 1
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
287
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
288 ***********************************************************************/
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
289
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
290 bool greater (UStringView source, UStringView target)
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
291 {
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
292 return ucol_greater (handle, source.get.ptr, source.len, target.get.ptr, target.len) != 0;
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
293 }
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
294
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
295 /***********************************************************************
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
296
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
297 Determine if one string is greater than or equal to
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
298 another. This function is equivalent to strcoll() >= 0
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
299
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
300 ***********************************************************************/
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
301
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
302 bool greaterOrEqual (UStringView source, UStringView target)
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
303 {
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
304 return ucol_greaterOrEqual (handle, source.get.ptr, source.len, target.get.ptr, target.len) != 0;
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
305 }
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
306
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
307 /***********************************************************************
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
308
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
309 This function is equivalent to strcoll() == 0
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
310
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
311 ***********************************************************************/
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
312
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
313 bool equal (UStringView source, UStringView target)
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
314 {
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
315 return ucol_equal (handle, source.get.ptr, source.len, target.get.ptr, target.len) != 0;
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
316 }
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
317
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
318 /***********************************************************************
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
319
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
320 Get the collation strength used in a UCollator. The
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
321 strength influences how strings are compared.
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
322
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
323 ***********************************************************************/
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
324
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
325 Strength getStrength ()
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
326 {
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
327 return ucol_getStrength (handle);
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
328 }
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
329
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
330 /***********************************************************************
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
331
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
332 Set the collation strength used in this UCollator. The
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
333 strength influences how strings are compared. one of
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
334 Primary, Secondary, Tertiary, Quaternary, Dentical, or
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
335 Default
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
336
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
337 ***********************************************************************/
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
338
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
339 void setStrength (Strength s)
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
340 {
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
341 ucol_setStrength (handle, s);
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
342 }
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
343
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
344 /***********************************************************************
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
345
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
346 Get the display name for a UCollator. The display name is
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
347 suitable for presentation to a user
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
348
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
349 ***********************************************************************/
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
350
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
351 void getDisplayName (ULocale obj, ULocale display, UString dst)
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
352 {
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
353 uint fmt (wchar* p, uint len, inout UErrorCode e)
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
354 {
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
355 return ucol_getDisplayName (toString(obj.name), toString(display.name), dst.get.ptr, dst.len, e);
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
356 }
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
357
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
358 dst.format (&fmt, "failed to get collator display name");
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
359 }
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
360
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
361 /***********************************************************************
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
362
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
363 Returns current rules. Options define whether full rules
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
364 are returned or just the tailoring.
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
365
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
366 ***********************************************************************/
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
367
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
368 void getRules (UString dst, RuleOption o = RuleOption.FullRules)
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
369 {
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
370 uint fmt (wchar* p, uint len, inout UErrorCode e)
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
371 {
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
372 uint needed = ucol_getRulesEx (handle, o, dst.get.ptr, dst.len);
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
373 if (needed > len)
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
374 e = e.BufferOverflow;
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
375 return needed;
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
376 }
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
377
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
378 dst.format (&fmt, "failed to get collator rules");
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
379 }
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
380
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
381 /***********************************************************************
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
382
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
383 Get the short definition string for a collator.
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
384
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
385 This API harvests the collator's locale and the attribute
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
386 set and produces a string that can be used for opening a
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
387 collator with the same properties using the char[] style
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
388 constructor. This string will be normalized.
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
389
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
390 The structure and the syntax of the string is defined in the
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
391 "Naming collators" section of the users guide:
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
392 http://oss.software.ibm.com/icu/userguide/Collate_Concepts.html#Naming_Collators
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
393
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
394 ***********************************************************************/
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
395
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
396 char[] getShortDefinitionString (ULocale locale = ULocale.Default)
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
397 {
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
398 UErrorCode e;
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
399 char[64] dst;
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
400
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
401 uint len = ucol_getShortDefinitionString (handle, toString(locale.name), dst.ptr, dst.length, e);
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
402 testError (e, "failed to get collator short name");
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
403 return dst[0..len].dup;
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
404 }
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
405
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
406 /***********************************************************************
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
407
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
408 Verifies and normalizes short definition string. Normalized
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
409 short definition string has all the option sorted by the
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
410 argument name, so that equivalent definition strings are the
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
411 same
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
412
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
413 ***********************************************************************/
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
414
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
415 char[] normalizeShortDefinitionString (char[] source)
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
416 {
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
417 UErrorCode e;
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
418 char[64] dst;
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
419
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
420 uint len = ucol_normalizeShortDefinitionString (toString(source), dst.ptr, dst.length, null, e);
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
421 testError (e, "failed to normalize collator short name");
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
422 return dst[0..len].dup;
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
423 }
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
424
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
425 /***********************************************************************
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
426
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
427 Get a sort key for a string from a UCollator. Sort keys
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
428 may be compared using strcmp.
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
429
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
430 ***********************************************************************/
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
431
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
432 ubyte[] getSortKey (UStringView t, ubyte[] result)
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
433 {
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
434 uint len = ucol_getSortKey (handle, t.get.ptr, t.len, result.ptr, result.length);
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
435 if (len < result.length)
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
436 return result [0..len];
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
437 return null;
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
438 }
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
439
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
440 /***********************************************************************
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
441
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
442 Merge two sort keys. The levels are merged with their
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
443 corresponding counterparts (primaries with primaries,
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
444 secondaries with secondaries etc.). Between the values
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
445 from the same level a separator is inserted. example
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
446 (uncompressed): 191B1D 01 050505 01 910505 00 and
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
447 1F2123 01 050505 01 910505 00 will be merged as
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
448 191B1D 02 1F212301 050505 02 050505 01 910505 02 910505 00
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
449 This allows for concatenating of first and last names for
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
450 sorting, among other things. If the destination buffer is
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
451 not big enough, the results are undefined. If any of source
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
452 lengths are zero or any of source pointers are null/undefined,
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
453 result is of size zero.
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
454
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
455 ***********************************************************************/
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
456
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
457 ubyte[] mergeSortkeys (ubyte[] left, ubyte[] right, ubyte[] result)
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
458 {
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
459 uint len = ucol_mergeSortkeys (left.ptr, left.length, right.ptr, right.length, result.ptr, result.length);
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
460 if (len < result.length)
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
461 return result [0..len];
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
462 return null;
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
463 }
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
464
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
465 /***********************************************************************
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
466
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
467 Produce a bound for a given sortkey and a number of levels.
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
468
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
469 Return value is always the number of bytes needed, regardless
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
470 of whether the result buffer was big enough or even valid.
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
471
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
472 Resulting bounds can be used to produce a range of strings
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
473 that are between upper and lower bounds. For example, if
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
474 bounds are produced for a sortkey of string "smith", strings
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
475 between upper and lower bounds with one level would include
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
476 "Smith", "SMITH", "sMiTh".
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
477
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
478 There are two upper bounds that can be produced. If BoundUpper
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
479 is produced, strings matched would be as above. However, if
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
480 bound produced using BoundUpperLong is used, the above example
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
481 will also match "Smithsonian" and similar.
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
482
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
483 ***********************************************************************/
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
484
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
485 ubyte[] getBound (BoundMode mode, ubyte[] source, ubyte[] result, uint levels = 1)
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
486 {
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
487 UErrorCode e;
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
488
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
489 uint len = ucol_getBound (source.ptr, source.length, mode, levels, result.ptr, result.length, e);
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
490 testError (e, "failed to get sortkey bound");
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
491 if (len < result.length)
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
492 return result [0..len];
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
493 return null;
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
494 }
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
495
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
496 /***********************************************************************
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
497
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
498 Gets the version information for a Collator.
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
499
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
500 Version is currently an opaque 32-bit number which depends,
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
501 among other things, on major versions of the collator
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
502 tailoring and UCA
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
503
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
504 ***********************************************************************/
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
505
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
506 void getVersion (inout Version v)
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
507 {
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
508 ucol_getVersion (handle, v);
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
509 }
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
510
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
511 /***********************************************************************
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
512
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
513 Gets the UCA version information for this Collator
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
514
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
515 ***********************************************************************/
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
516
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
517 void getUCAVersion (inout Version v)
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
518 {
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
519 ucol_getUCAVersion (handle, v);
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
520 }
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
521
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
522 /***********************************************************************
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
523
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
524 Universal attribute setter
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
525
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
526 ***********************************************************************/
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
527
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
528 void setAttribute (Attribute attr, AttributeValue value)
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
529 {
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
530 UErrorCode e;
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
531
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
532 ucol_setAttribute (handle, attr, value, e);
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
533 testError (e, "failed to set collator attribute");
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
534 }
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
535
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
536 /***********************************************************************
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
537
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
538 Universal attribute getter
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
539
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
540 ***********************************************************************/
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
541
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
542 AttributeValue getAttribute (Attribute attr)
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
543 {
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
544 UErrorCode e;
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
545
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
546 AttributeValue v = ucol_getAttribute (handle, attr, e);
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
547 testError (e, "failed to get collator attribute");
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
548 return v;
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
549 }
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
550
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
551 /***********************************************************************
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
552
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
553 Variable top is a two byte primary value which causes all
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
554 the codepoints with primary values that are less or equal
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
555 than the variable top to be shifted when alternate handling
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
556 is set to Shifted.
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
557
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
558 ***********************************************************************/
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
559
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
560 void setVariableTop (UStringView t)
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
561 {
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
562 UErrorCode e;
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
563
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
564 ucol_setVariableTop (handle, t.get.ptr, t.len, e);
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
565 testError (e, "failed to set variable-top");
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
566 }
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
567
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
568 /***********************************************************************
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
569
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
570 Sets the variable top to a collation element value
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
571 supplied.Variable top is set to the upper 16 bits.
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
572 Lower 16 bits are ignored.
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
573
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
574 ***********************************************************************/
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
575
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
576 void setVariableTop (uint x)
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
577 {
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
578 UErrorCode e;
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
579
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
580 ucol_restoreVariableTop (handle, x, e);
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
581 testError (e, "failed to restore variable-top");
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
582 }
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
583
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
584 /***********************************************************************
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
585
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
586 Gets the variable top value of this Collator. Lower 16 bits
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
587 are undefined and should be ignored.
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
588
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
589 ***********************************************************************/
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
590
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
591 uint getVariableTop ()
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
592 {
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
593 UErrorCode e;
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
594
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
595 uint x = ucol_getVariableTop (handle, e);
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
596 testError (e, "failed to get variable-top");
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
597 return x;
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
598 }
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
599
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
600 /***********************************************************************
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
601
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
602 Gets the locale name of the collator. If the collator is
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
603 instantiated from the rules, then this function will throw
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
604 an exception
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
605
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
606 ***********************************************************************/
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
607
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
608 void getLocale (ULocale locale, ULocale.Type type)
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
609 {
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
610 UErrorCode e;
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
611
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
612 locale.name = toArray (ucol_getLocaleByType (handle, type, e));
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
613 if (isError(e) || locale.name is null)
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
614 exception ("failed to get collator locale");
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
615 }
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
616
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
617 /***********************************************************************
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
618
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
619 Get the Unicode set that contains all the characters and
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
620 sequences tailored in this collator.
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
621
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
622 ***********************************************************************/
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
623
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
624 USet getTailoredSet ()
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
625 {
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
626 UErrorCode e;
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
627
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
628 Handle h = ucol_getTailoredSet (handle, e);
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
629 testError (e, "failed to get tailored set");
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
630 return new USet (h);
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
631 }
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
632
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
633
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
634 /***********************************************************************
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
635
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
636 Bind the ICU functions from a shared library. This is
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
637 complicated by the issues regarding D and DLLs on the
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
638 Windows platform
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
639
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
640 ***********************************************************************/
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
641
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
642 private static void* library;
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
643
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
644 /***********************************************************************
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
645
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
646 ***********************************************************************/
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
647
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
648 private static extern (C)
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
649 {
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
650 void function (Handle) ucol_close;
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
651 Handle function (char *loc, inout UErrorCode e) ucol_open;
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
652 Handle function (wchar* rules, uint rulesLength, AttributeValue normalizationMode, Strength strength, UParseError *parseError, inout UErrorCode e) ucol_openRules;
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
653 Handle function (char *definition, byte forceDefaults, UParseError *parseError, inout UErrorCode e) ucol_openFromShortString;
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
654 uint function (Handle, Handle conts, inout UErrorCode e) ucol_getContractions;
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
655 int function (Handle, wchar* source, uint sourceLength, wchar* target, uint targetLength) ucol_strcoll;
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
656 byte function (Handle, wchar* source, uint sourceLength, wchar* target, uint targetLength) ucol_greater;
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
657 byte function (Handle, wchar* source, uint sourceLength, wchar* target, uint targetLength) ucol_greaterOrEqual;
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
658 byte function (Handle, wchar* source, uint sourceLength, wchar* target, uint targetLength) ucol_equal;
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
659 Strength function (Handle) ucol_getStrength;
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
660 void function (Handle, Strength strength) ucol_setStrength;
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
661 uint function (char *objLoc, char *dispLoc, wchar* result, uint resultLength, inout UErrorCode e) ucol_getDisplayName;
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
662 uint function (Handle, char *locale, char *buffer, uint capacity, inout UErrorCode e) ucol_getShortDefinitionString;
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
663 uint function (char *source, char *destination, uint capacity, UParseError *parseError, inout UErrorCode e) ucol_normalizeShortDefinitionString;
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
664 uint function (Handle, wchar* source, uint sourceLength, ubyte *result, uint resultLength) ucol_getSortKey;
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
665 uint function (ubyte *source, uint sourceLength, BoundMode boundType, uint noOfLevels, ubyte *result, uint resultLength, inout UErrorCode e) ucol_getBound;
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
666 void function (Handle, Version info) ucol_getVersion;
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
667 void function (Handle, Version info) ucol_getUCAVersion;
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
668 uint function (ubyte *src1, uint src1Length, ubyte *src2, uint src2Length, ubyte *dest, uint destCapacity) ucol_mergeSortkeys;
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
669 void function (Handle, Attribute attr, AttributeValue value, inout UErrorCode e) ucol_setAttribute;
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
670 AttributeValue function (Handle, Attribute attr, inout UErrorCode e) ucol_getAttribute;
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
671 uint function (Handle, wchar* varTop, uint len, inout UErrorCode e) ucol_setVariableTop;
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
672 uint function (Handle, inout UErrorCode e) ucol_getVariableTop;
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
673 void function (Handle, uint varTop, inout UErrorCode e) ucol_restoreVariableTop;
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
674 uint function (Handle, RuleOption delta, wchar* buffer, uint bufferLen) ucol_getRulesEx;
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
675 char* function (Handle, ULocale.Type type, inout UErrorCode e) ucol_getLocaleByType;
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
676 Handle function (Handle, inout UErrorCode e) ucol_getTailoredSet;
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
677 }
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
678
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
679 /***********************************************************************
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
680
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
681 ***********************************************************************/
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
682
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
683 static FunctionLoader.Bind[] targets =
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
684 [
91
11e8159caf7a make the mango icu fork work.
Frank Benoit <benoit@tionex.de>
parents: 89
diff changeset
685 {cast(void**) &ucol_open, "ucol_open"},
89
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
686 {cast(void**) &ucol_close, "ucol_close"},
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
687 {cast(void**) &ucol_openRules, "ucol_openRules"},
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
688 {cast(void**) &ucol_openFromShortString, "ucol_openFromShortString"},
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
689 {cast(void**) &ucol_getContractions, "ucol_getContractions"},
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
690 {cast(void**) &ucol_strcoll, "ucol_strcoll"},
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
691 {cast(void**) &ucol_greater, "ucol_greater"},
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
692 {cast(void**) &ucol_greaterOrEqual, "ucol_greaterOrEqual"},
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
693 {cast(void**) &ucol_equal, "ucol_equal"},
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
694 {cast(void**) &ucol_getStrength, "ucol_getStrength"},
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
695 {cast(void**) &ucol_setStrength, "ucol_setStrength"},
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
696 {cast(void**) &ucol_getDisplayName, "ucol_getDisplayName"},
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
697 {cast(void**) &ucol_getShortDefinitionString, "ucol_getShortDefinitionString"},
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
698 {cast(void**) &ucol_normalizeShortDefinitionString, "ucol_normalizeShortDefinitionString"},
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
699 {cast(void**) &ucol_getSortKey, "ucol_getSortKey"},
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
700 {cast(void**) &ucol_getBound, "ucol_getBound"},
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
701 {cast(void**) &ucol_getVersion, "ucol_getVersion"},
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
702 {cast(void**) &ucol_getUCAVersion, "ucol_getUCAVersion"},
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
703 {cast(void**) &ucol_mergeSortkeys, "ucol_mergeSortkeys"},
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
704 {cast(void**) &ucol_setAttribute, "ucol_setAttribute"},
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
705 {cast(void**) &ucol_getAttribute, "ucol_getAttribute"},
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
706 {cast(void**) &ucol_setVariableTop, "ucol_setVariableTop"},
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
707 {cast(void**) &ucol_getVariableTop, "ucol_getVariableTop"},
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
708 {cast(void**) &ucol_restoreVariableTop, "ucol_restoreVariableTop"},
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
709 {cast(void**) &ucol_getRulesEx, "ucol_getRulesEx"},
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
710 {cast(void**) &ucol_getLocaleByType, "ucol_getLocaleByType"},
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
711 {cast(void**) &ucol_getTailoredSet, "ucol_getTailoredSet"},
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
712 ];
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
713
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
714 /***********************************************************************
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
715
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
716 ***********************************************************************/
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
717
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
718 static this ()
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
719 {
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
720 library = FunctionLoader.bind (icuin, targets);
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
721 }
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
722
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
723 /***********************************************************************
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
724
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
725 ***********************************************************************/
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
726
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
727 static ~this ()
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
728 {
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
729 FunctionLoader.unbind (library);
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
730 }
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
731 }
040da1cb0d76 Add a local copy of the mango ICU binding to work out the utf8 usability. Will hopefully go back into mango.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
732