2005-07-27 Atsushi Enomoto <atsushi@ximian.com>
[mono.git] / mcs / class / corlib / Mono.Globalization.Unicode / NormalizationTableUtil.cs
1 using System;
2 using System.Globalization;
3 using System.Text;
4
5 namespace Mono.Globalization.Unicode
6 {
7         internal /*static*/ class NormalizationTableUtil
8         {
9                 public static readonly CodePointIndexer prop;
10                 public static readonly CodePointIndexer map;
11
12                 static NormalizationTableUtil ()
13                 {
14                         int [] propStarts = new int [] {
15                                 0, 0xAC00, 0xF900, 0x1D100,
16                                 0x2f800, 0x2fa10
17                                 };
18                         int [] propEnds = new int [] {
19                                 0x3400, 0xD7AF, 0x10000, 0x1D800,
20                                 0x2f810, 0x2fa20
21                                 };
22                         int [] mapStarts = new int [] {
23                                 0, 0xF900, 0x1d150, 0x2f800
24                                 };
25                         int [] mapEnds = new int [] {
26                                 0x3400, 0x10000, 0x1d800, 0x2fb00
27                                 };
28
29                         prop = new CodePointIndexer (propStarts, propEnds, 0, 0);
30                         map = new CodePointIndexer (mapStarts, mapEnds, 0, 0);
31                 }
32
33                 public static int PropIdx (int cp)
34                 {
35                         return prop.ToIndex (cp);
36                 }
37
38                 public static int PropCP (int index)
39                 {
40                         return prop.ToCodePoint (index);
41                 }
42
43                 public static int PropCount { get { return prop.TotalCount; } }
44
45                 public static int MapIdx (int cp)
46                 {
47                         return map.ToIndex (cp);
48                 }
49
50                 public static int MapCP (int index)
51                 {
52                         return map.ToCodePoint (index);
53                 }
54
55                 public static int MapCount { get { return map.TotalCount; } }
56         }
57 }