PageRenderTime 49ms CodeModel.GetById 24ms RepoModel.GetById 1ms app.codeStats 0ms

/src/ZebraFlickr/CommandLine/Details.cs

https://bitbucket.org/garethl/zebraflickr
C# | 117 lines | 33 code | 17 blank | 67 comment | 0 complexity | efa89090d3ba2e6b74f90e1d8bff8c74 MD5 | raw file
  1. #region License
  2. // Copyright (c) 2012 Gareth Lennox (garethl@dwakn.com)
  3. // All rights reserved.
  4. //
  5. // Redistribution and use in source and binary forms, with or without modification,
  6. // are permitted provided that the following conditions are met:
  7. //
  8. // * Redistributions of source code must retain the above copyright notice,
  9. // this list of conditions and the following disclaimer.
  10. // * Redistributions in binary form must reproduce the above copyright notice,
  11. // this list of conditions and the following disclaimer in the documentation
  12. // and/or other materials provided with the distribution.
  13. // * Neither the name of Gareth Lennox nor the names of its
  14. // contributors may be used to endorse or promote products derived from this
  15. // software without specific prior written permission.
  16. //
  17. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  18. // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  19. // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  20. // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
  21. // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  22. // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  23. // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  24. // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  25. // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  26. // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. #endregion
  28. using System;
  29. namespace ZebraFlickr.CommandLine
  30. {
  31. /// <summary>
  32. /// Details attribute
  33. /// </summary>
  34. [AttributeUsage(AttributeTargets.Property, AllowMultiple = true, Inherited = true)]
  35. public class DetailsAttribute : Attribute
  36. {
  37. private bool _isGeneral;
  38. /// <summary>
  39. /// Creates new details
  40. /// </summary>
  41. public DetailsAttribute()
  42. {
  43. Index = -1;
  44. OtherLongNames = new string[] {};
  45. OtherShortNames = new string[] {};
  46. }
  47. /// <summary>
  48. /// Short name
  49. /// </summary>
  50. public virtual string ShortName { get; set; }
  51. /// <summary>
  52. /// Long name
  53. /// </summary>
  54. public virtual string LongName { get; set; }
  55. /// <summary>
  56. /// Any other short names
  57. /// </summary>
  58. public virtual string[] OtherShortNames { get; set; }
  59. /// <summary>
  60. /// Any other long names
  61. /// </summary>
  62. public virtual string[] OtherLongNames { get; set; }
  63. /// <summary>
  64. /// Description
  65. /// </summary>
  66. public string Description { get; set; }
  67. /// <summary>
  68. /// Possible values
  69. /// </summary>
  70. public virtual string[] Values { get; set; }
  71. /// <summary>
  72. /// Index
  73. /// </summary>
  74. public virtual int Index { get; set; }
  75. /// <summary>
  76. /// Decoder to use
  77. /// </summary>
  78. public virtual Type Decoder { get; set; }
  79. /// <summary>
  80. /// Is it required?
  81. /// </summary>
  82. public bool Required { get; set; }
  83. /// <summary>
  84. /// Is it a bare option (i.e. just the value, no prefix)
  85. /// </summary>
  86. public bool IsBareOption { get; set; }
  87. /// <summary>
  88. /// Default value
  89. /// </summary>
  90. public object Default { get; set; }
  91. /// <summary>
  92. /// Is this a general option (i.e. all commands have this option)
  93. /// </summary>
  94. public bool IsGeneral
  95. {
  96. get { return _isGeneral; }
  97. set { _isGeneral = value; }
  98. }
  99. }
  100. }