2002-08-03 Tim Coleman <tim@timcoleman.com>
[mono.git] / mcs / class / System.Web.Services / System.Web.Services.Description / MimeTextMatch.cs
1 // \r
2 // System.Web.Services.Description.MimeTextMatch.cs\r
3 //\r
4 // Author:\r
5 //   Tim Coleman (tim@timcoleman.com)\r
6 //\r
7 // Copyright (C) Tim Coleman, 2002\r
8 //\r
9 \r
10 using System.ComponentModel;\r
11 using System.Xml.Serialization;\r
12 \r
13 namespace System.Web.Services.Description {\r
14         public sealed class MimeTextMatch {\r
15 \r
16                 #region Fields\r
17 \r
18                 int capture;\r
19                 int group;\r
20                 bool ignoreCase;\r
21                 MimeTextMatchCollection matches;\r
22                 string name;\r
23                 string pattern;\r
24                 int repeats;\r
25                 string type;\r
26 \r
27                 #endregion // Fields\r
28 \r
29                 #region Constructors\r
30                 \r
31                 public MimeTextMatch ()\r
32                 {\r
33                         capture = 0;\r
34                         group = 1;\r
35                         ignoreCase = false;\r
36                         matches = null;\r
37                         name = String.Empty;\r
38                         pattern = String.Empty;\r
39                         repeats = 1;\r
40                         type = String.Empty;\r
41                 }\r
42                 \r
43                 #endregion // Constructors\r
44 \r
45                 #region Properties\r
46 \r
47                 [DefaultValue (0)]\r
48                 [XmlAttribute ("capture")]\r
49                 public int Capture {\r
50                         get { return capture; }\r
51                         set {\r
52                                 if (value < 0)\r
53                                         throw new ArgumentException ();\r
54                                 capture = value; \r
55                         }\r
56                 }\r
57         \r
58                 [DefaultValue (1)]      \r
59                 [XmlAttribute ("group")]\r
60                 public int Group {\r
61                         get { return group; }\r
62                         set {\r
63                                 if (value < 0)\r
64                                         throw new ArgumentException ();\r
65                                 group = value; \r
66                         }\r
67                 }\r
68 \r
69                 [XmlAttribute ("ignoreCase")]\r
70                 public bool IgnoreCase {\r
71                         get { return ignoreCase; }\r
72                         set { ignoreCase = value; }\r
73                 }\r
74 \r
75                 [XmlElement ("match")]\r
76                 public MimeTextMatchCollection Matches {\r
77                         get { return matches; }\r
78                 }\r
79 \r
80                 [XmlAttribute ("name")]\r
81                 public string Name {\r
82                         get { return name; }\r
83                         set { name = value; }\r
84                 }\r
85 \r
86                 [XmlAttribute ("pattern")]\r
87                 public string Pattern {\r
88                         get { return pattern; }\r
89                         set { pattern = value; }\r
90                 }\r
91 \r
92                 [XmlIgnore]\r
93                 public int Repeats {\r
94                         get { return repeats; }\r
95                         set {\r
96                                 if (value < 0)\r
97                                         throw new ArgumentException ();\r
98                                 repeats = value; \r
99                         }\r
100                 }\r
101 \r
102                 [DefaultValue ("1")]\r
103                 [XmlAttribute ("repeats")]\r
104                 public string RepeatsString {\r
105                         get { return Repeats.ToString (); }\r
106                         set { Repeats = Int32.Parse (value); }\r
107                 }\r
108 \r
109                 [XmlAttribute ("type")]\r
110                 public string Type {\r
111                         get { return type; }\r
112                         set { type = value; }\r
113                 }\r
114 \r
115                 #endregion // Properties\r
116 \r
117                 #region Methods\r
118 \r
119                 internal void SetParent (MimeTextMatchCollection matches) \r
120                 {\r
121                         this.matches = matches;\r
122                 }\r
123 \r
124                 #endregion // Methods\r
125         }\r
126 }\r