2004-04-20 Sebastien Pouliot <sebastien@ximian.com>
[mono.git] / mcs / class / corlib / System.Runtime.Remoting.Metadata.W3cXsd2001 / SoapNonNegativeInteger.cs
1 //
2 // System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonNegativeInteger
3 //
4 // Authors:
5 //      Martin Willemoes Hansen (mwh@sysrq.dk)
6 //      Lluis Sanchez Gual (lluis@ximian.com)
7 //
8 // (C) 2003 Martin Willemoes Hansen
9 //
10
11 using System;
12
13 namespace System.Runtime.Remoting.Metadata.W3cXsd2001 
14 {
15         [Serializable]
16         public sealed class SoapNonNegativeInteger : ISoapXsd
17         {
18                 decimal _value;
19                 
20                 public SoapNonNegativeInteger()
21                 {
22                 }
23                 
24                 public SoapNonNegativeInteger(decimal value)
25                 {
26                         if (value < 0) 
27                                 throw SoapHelper.GetException (this, "invalid " + value);
28                         _value = value;
29                 }
30                 
31                 public decimal Value {
32                         get { return _value; } 
33                         set { _value = value; }
34                 }
35
36                 public static string XsdType {
37                         get { return "nonNegativeInteger"; }
38                 }
39
40                 public string GetXsdType()
41                 {
42                         return XsdType;
43                 }
44                 
45                 public static SoapNonNegativeInteger Parse (string value)
46                 {
47                         return new SoapNonNegativeInteger (decimal.Parse (value));
48                 }
49
50                 public override string ToString()
51                 {
52                         return _value.ToString ();
53                 }
54         }
55 }