2
// Mono.Tools.LocaleBuilder.NumberFormatEntry
5
// Jackson Harper (jackson@ximian.com)
7
// (C) 2004 Novell, Inc (http://www.novell.com)
14
namespace Mono.Tools.LocaleBuilder {
16
public class NumberFormatEntry : Entry {
18
public static readonly int MaxGroupSize = 5;
20
public int CurrencyDecimalDigits;
21
public string CurrencyDecimalSeparator;
22
public string CurrencyGroupSeparator;
23
public int [] CurrencyGroupSizes;
24
public int CurrencyNegativePattern;
25
public int CurrencyPositivePattern;
26
public string CurrencySymbol;
27
public string NaNSymbol;
28
public string NegativeSign;
29
public int NumberDecimalDigits;
30
public string NumberDecimalSeparator;
31
public string NumberGroupSeparator;
32
public int [] NumberGroupSizes;
33
public int NumberNegativePattern;
34
public int PercentDecimalDigits;
35
public string PercentDecimalSeparator;
36
public string PercentGroupSeparator;
37
public int [] PercentGroupSizes;
38
public int PercentNegativePattern;
39
public int PercentPositivePattern;
40
public string PercentSymbol;
41
public string PerMilleSymbol;
42
public string PositiveInfinitySymbol;
43
public string PositiveSign;
47
public string NegativeInfinitySymbol {
49
return NegativeSign + PositiveInfinitySymbol;
53
public void AppendTableRow (StringBuilder builder)
55
builder.Append ("\t{");
57
builder.Append ("\"" + EncodeString (CurrencyDecimalSeparator) + "\", ");
58
builder.Append ("\"" + EncodeString (CurrencyGroupSeparator) + "\", ");
59
builder.Append ("\"" + EncodeString (PercentDecimalSeparator) + "\", ");
60
builder.Append ("\"" + EncodeString (PercentGroupSeparator) + "\", ");
61
builder.Append ("\"" + EncodeString (NumberDecimalSeparator) + "\", ");
62
builder.Append ("\"" + EncodeString (NumberGroupSeparator) + "\", ");
64
builder.Append ("\"" + EncodeString (CurrencySymbol) + "\", ");
65
builder.Append ("\"" + EncodeString (PercentSymbol) + "\", ");
66
builder.Append ("\"" + EncodeString (NaNSymbol) + "\", ");
67
builder.Append ("\"" + EncodeString (PerMilleSymbol) + "\", ");
68
builder.Append ("\"" + EncodeString (NegativeInfinitySymbol) + "\", ");
69
builder.Append ("\"" + EncodeString (PositiveInfinitySymbol) + "\", ");
71
builder.Append ("\"" + EncodeString (NegativeSign) + "\", ");
72
builder.Append ("\"" + EncodeString (PositiveSign) + "\", ");
74
builder.Append (CurrencyNegativePattern + ", ");
75
builder.Append (CurrencyPositivePattern + ", ");
76
builder.Append (PercentNegativePattern + ", ");
77
builder.Append (PercentPositivePattern + ", ");
78
builder.Append (NumberNegativePattern + ", ");
80
builder.Append (CurrencyDecimalDigits + ", ");
81
builder.Append (PercentDecimalDigits + ", ");
82
builder.Append (NumberDecimalDigits + ", ");
84
AppendGroupSizes (builder, CurrencyGroupSizes);
85
builder.Append (", ");
86
AppendGroupSizes (builder, PercentGroupSizes);
87
builder.Append (", ");
88
AppendGroupSizes (builder, NumberGroupSizes);
93
private void AppendGroupSizes (StringBuilder builder, int [] gs)
95
int len = (gs == null ? 0 : gs.Length);
98
for (int i = 0; i < MaxGroupSize; i++) {
100
builder.Append (gs [0]);
103
if (i+1 < MaxGroupSize)
104
builder.Append (", ");
106
builder.Append ('}');
109
public override string ToString ()
111
StringBuilder builder = new StringBuilder ();
112
AppendTableRow (builder);
113
return builder.ToString ();