New test.
[mono.git] / tools / locale-builder / TextInfoEntry.cs
1 using System;
2 using System.Text;
3 using System.Collections;
4 using System.Xml;
5 using System.Xml.XPath;
6
7 namespace Mono.Tools.LocaleBuilder {
8
9         public class TextInfoEntry : Entry {
10                 
11                 string ansi = "0";
12                 string ebcdic = "0";
13                 string mac = "0";
14                 string oem = "0";
15                 string listsep = ",";
16
17                 public TextInfoEntry (int lcid, XPathDocument d)
18                 {
19                         string q = "/textinfos/textinfo [@lcid=" + lcid + "]";
20                         XPathNodeIterator ni = (XPathNodeIterator) d.CreateNavigator ().Evaluate (q);
21                         // no info, move along
22                         if (! ni.MoveNext ())
23                                 throw new Exception ();         
24                         
25                         ansi = ni.Current.GetAttribute ("ansi", String.Empty);
26                         ebcdic = ni.Current.GetAttribute ("ebcdic", String.Empty);
27                         mac = ni.Current.GetAttribute ("mac", String.Empty);
28                         oem = ni.Current.GetAttribute ("oem", String.Empty);
29                         listsep = ni.Current.GetAttribute ("listsep", String.Empty);
30                 }
31                 
32                 public override string ToString ()
33                 {
34                         StringBuilder b = new StringBuilder ();
35                         b.Append ("{ ");
36                         b.Append (ansi);
37                         b.Append (", ");
38                         b.Append (ebcdic);
39                         b.Append (", ");
40                         b.Append (mac );
41                         b.Append (", ");
42                         b.Append (oem);
43                         b.Append (", '");
44                         b.Append (listsep);
45                         b.Append ("' }");
46                         
47                         return b.ToString ();
48                 }
49         }
50 }