*** empty log message ***
[m17n/m17n-lib-cs.git] / MText.cs
1 using System;
2 using System.Text;
3 using M17N.Core;
4
5 namespace M17N.Core
6 {
7 #if false
8   public enum MTextFormat
9   {
10     MTEXT_FORMAT_US_ASCII,
11     MTEXT_FORMAT_UTF_8,
12     MTEXT_FORMAT_UTF_16BE,
13     MTEXT_FORMAT_UTF_16LE,
14     MTEXT_FORMAT_UTF_32BE,
15     MTEXT_FORMAT_UTF_32LE,
16   }
17 #endif
18
19   public class MText
20   {
21 #if false
22     public enum MTextFormat format;
23 #endif
24
25     private class MTextPlist : MPlist
26     {
27       public class MInterval
28       {
29         MPlist stack;
30         int nprops;
31         public int start, end;
32         public MInterval prev, next;
33       }
34
35       MInterval head, tail;
36
37       public MTextPlist (MText mt)
38       {
39         head = tail = new MInterval ();
40         head.start = 0;
41         head.end = mt.sb.Length;
42       }
43     }
44
45     private StringBuilder sb;
46     private int cache_pos;
47     private int cache_idx;
48     private MTextPlist plist;
49
50     private static UTF8Encoding utf8 = new UTF8Encoding ();
51
52     public MText ()
53     {
54       cache_pos = cache_idx = 0;
55       plist = null;
56       sb = new StringBuilder ();
57     }
58
59     public MText (byte[] str)
60     {
61       cache_pos = cache_idx = 0;
62       plist = null;          
63       sb = new StringBuilder (utf8.GetString (str));
64     }
65
66     public MText (String str)
67     {
68       cache_pos = cache_idx = 0;
69       plist = null;          
70       sb = new StringBuilder (str);
71     }
72
73     public int this[int i]
74     {
75       set { this.sb[i] = (char) value; }
76       get { return this.sb[i]; }
77     }
78   }
79
80   public class MTextProperty
81   {
82   }
83 }