Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Teixeira <monoman@gmail.com>2002-09-03 10:12:30 +0400
committerRafael Teixeira <monoman@gmail.com>2002-09-03 10:12:30 +0400
commitea216a1299c7d266d708e979916b6337b8e1a133 (patch)
treee75f75a4165f27216d28094dafb8bebff6037262 /mcs/class/Mono.GetOptions/OptionAttribute.cs
parent96005596ea806c3649ec2291065f3734a6213ee7 (diff)
see the changelog
svn path=/trunk/mcs/; revision=7189
Diffstat (limited to 'mcs/class/Mono.GetOptions/OptionAttribute.cs')
-rw-r--r--mcs/class/Mono.GetOptions/OptionAttribute.cs66
1 files changed, 66 insertions, 0 deletions
diff --git a/mcs/class/Mono.GetOptions/OptionAttribute.cs b/mcs/class/Mono.GetOptions/OptionAttribute.cs
new file mode 100644
index 00000000000..739d71f15bb
--- /dev/null
+++ b/mcs/class/Mono.GetOptions/OptionAttribute.cs
@@ -0,0 +1,66 @@
+using System;
+
+namespace Mono.GetOptions
+{
+
+ [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method)]
+ public class OptionAttribute : Attribute
+ {
+ public string ShortDescription;
+ public char ShortForm;
+ public string LongForm;
+ public int MaxOccurs; // negative means there is no limit
+
+ private void SetValues(
+ string shortDescription,
+ char shortForm,
+ string longForm,
+ int maxOccurs)
+ {
+ ShortDescription = shortDescription;
+ ShortForm = shortForm;
+ LongForm = longForm;
+ MaxOccurs = maxOccurs;
+ }
+
+ public OptionAttribute(string shortDescription)
+ {
+ SetValues(shortDescription, ' ', string.Empty, 0);
+ }
+
+ public OptionAttribute(string shortDescription, char shortForm)
+ {
+ SetValues(shortDescription, shortForm, string.Empty, 0);
+ }
+
+ public OptionAttribute(string shortDescription, char shortForm, string longForm)
+ {
+ SetValues(shortDescription, shortForm, longForm, 0);
+ }
+
+ public OptionAttribute(string shortDescription, string longForm)
+ {
+ SetValues(shortDescription, ' ', longForm, 0);
+ }
+
+ public OptionAttribute(int maxOccurs, string shortDescription)
+ {
+ SetValues(shortDescription, ' ', string.Empty, maxOccurs);
+ }
+
+ public OptionAttribute(int maxOccurs, string shortDescription, char shortForm)
+ {
+ SetValues(shortDescription, shortForm, string.Empty, maxOccurs);
+ }
+
+ public OptionAttribute(int maxOccurs, string shortDescription, char shortForm, string longForm)
+ {
+ SetValues(shortDescription, shortForm, longForm, maxOccurs);
+ }
+
+ public OptionAttribute(int maxOccurs, string shortDescription, string longForm)
+ {
+ SetValues(shortDescription, ' ', longForm, maxOccurs);
+ }
+ }
+}