Merge branch 'v3.4'
[dotnetopenid.git] / tools / Sandcastle / Source / CommandLine / BooleanOption.cs
blob6ea23a19d3b2f9da91967a0d3a23bc1b6cb592ae
1 // Copyright © Microsoft Corporation.
2 // This source file is subject to the Microsoft Permissive License.
3 // See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
4 // All other rights reserved.
6 using System;
7 using System.IO;
8 using System.Collections.Generic;
10 namespace Microsoft.Ddue.Tools.CommandLine {
12 public sealed class BooleanOption : Option {
14 public BooleanOption(string name) : base(name) { }
16 public BooleanOption(string name, string description) : base(name, description) { }
18 internal override ParseResult ParseArgument(string argument) {
19 if ((argument != "+") && (argument != "-")) return (ParseResult.MalformedArgument);
20 if (present) return (ParseResult.MultipleOccurance);
21 present = true;
22 if (argument == "+") {
23 value = true;
24 } else {
25 value = false;
27 return (ParseResult.Success);
30 internal override void WriteTemplate(TextWriter writer) {
31 writer.WriteLine("/{0}+|-", Name);