コード例 #1
0
 /// <summary>
 /// Adds a new option specification.
 /// </summary>
 /// <param name="requirementLevel">The requirement level of the entry to add.</param>
 /// <param name="nameKind">The name kind to consider.</param>
 /// <param name="aliases">Aliases of the option to add.</param>
 public IOptionSpecSet AddOption(
     RequirementLevels requirementLevel,
     OptionNameKind nameKind,
     params string[] aliases)
 {
     return(AddOption(DataValueTypes.Text, requirementLevel, nameKind, aliases));
 }
コード例 #2
0
 /// <summary>
 /// Adds a new option specification.
 /// </summary>
 /// <param name="dataValueType">The value type to consider.</param>
 /// <param name="nameKind">The name kind to consider.</param>
 /// <param name="aliases">Aliases of the option to add.</param>
 public IOptionSpecSet AddOption(
     DataValueTypes dataValueType,
     OptionNameKind nameKind,
     params string[] aliases)
 {
     return(AddOption(dataValueType, RequirementLevels.Required, OptionNameKind.OnlyValue, aliases));
 }
コード例 #3
0
 /// <summary>
 /// Adds a new option specification.
 /// </summary>
 /// <param name="type">The type to consider.</param>
 /// <param name="requirementLevel">The requirement level of the option to consider.</param>
 /// <param name="nameKind">The name kind to consider.</param>
 /// <param name="aliases">Aliases of the option to add.</param>
 public IOptionSpecSet AddOption(
     Type type,
     RequirementLevels requirementLevel,
     OptionNameKind nameKind,
     params string[] aliases)
 {
     return(AddOption(type.GetValueType(), requirementLevel, nameKind, aliases));
 }
コード例 #4
0
 /// <summary>
 /// Adds a new option specification.
 /// </summary>
 /// <param name="dataValueType">The value type to consider.</param>
 /// <param name="requirementLevel">The requirement level of the entry to consider.</param>
 /// <param name="nameKind">The name kind to consider.</param>
 /// <param name="aliases">Aliases of the option to add.</param>
 public IOptionSpecSet AddOption(
     DataValueTypes dataValueType,
     RequirementLevels requirementLevel,
     OptionNameKind nameKind,
     params string[] aliases)
 {
     Add(new OptionSpec(dataValueType, requirementLevel, nameKind, aliases));
     return(this);
 }
コード例 #5
0
ファイル: OptionSpec.cs プロジェクト: bindopen/BindOpen
 /// <summary>
 /// Instantiates a new instance of the OptionSpec class.
 /// </summary>
 /// <param name="dataValueType">The value type to consider.</param>
 /// <param name="requirementLevel">The requirement level of the entry to consider.</param>
 /// <param name="nameKind">The name kind to consider.</param>
 /// <param name="aliases">Aliases of the option to add.</param>
 public OptionSpec(
     DataValueTypes dataValueType,
     RequirementLevels requirementLevel,
     OptionNameKind nameKind,
     params string[] aliases) : base()
 {
     Aliases           = (aliases ?? new string[1] {
         "{{*}}"
     }).ToList();
     MinimumItemNumber = nameKind.HasValue() ? 1 : 0;
     MaximumItemNumber = nameKind.HasName() ? 0 : 1;
     RequirementLevel  = requirementLevel;
 }
コード例 #6
0
ファイル: OptionSpec.cs プロジェクト: bindopen/BindOpen
 /// <summary>
 /// Instantiates a new instance of the OptionSpec class.
 /// </summary>
 /// <param name="type">The type to consider.</param>
 /// <param name="requirementLevel">The requirement level of the option to consider.</param>
 /// <param name="nameKind">The name kind to consider.</param>
 /// <param name="aliases">Aliases of the option to add.</param>
 public OptionSpec(
     Type type,
     RequirementLevels requirementLevel,
     OptionNameKind nameKind,
     params string[] aliases) : this(type.GetValueType(), requirementLevel, nameKind, aliases)
 {
     if (type?.IsEnum == true)
     {
         ConstraintStatement = new DataConstraintStatement();
         ConstraintStatement.AddConstraint(
             null,
             "standard$" + KnownRoutineKind.ItemMustBeInList,
             ElementFactory.CreateSet(
                 ElementFactory.CreateScalar(DataValueTypes.Text, type.GetEnumFields())));
     }
 }
コード例 #7
0
ファイル: OptionSpec.cs プロジェクト: bindopen/BindOpen
 /// <summary>
 /// Instantiates a new instance of the OptionSpec class.
 /// </summary>
 /// <param name="requirementLevel">The requirement level of the entry to add.</param>
 /// <param name="nameKind">The name kind to consider.</param>
 /// <param name="aliases">Aliases of the option to add.</param>
 public OptionSpec(
     RequirementLevels requirementLevel,
     OptionNameKind nameKind,
     params string[] aliases) : this(DataValueTypes.Text, requirementLevel, nameKind, aliases)
 {
 }
コード例 #8
0
ファイル: OptionSpec.cs プロジェクト: bindopen/BindOpen
 /// <summary>
 /// Instantiates a new instance of the OptionSpec class.
 /// </summary>
 /// <param name="dataValueType">The value type to consider.</param>
 /// <param name="nameKind">The name kind to consider.</param>
 /// <param name="aliases">Aliases of the option to add.</param>
 public OptionSpec(
     DataValueTypes dataValueType,
     OptionNameKind nameKind,
     params string[] aliases) : this(dataValueType, RequirementLevels.Required, OptionNameKind.OnlyName, aliases)
 {
 }
コード例 #9
0
ファイル: OptionSpec.cs プロジェクト: bindopen/BindOpen
 /// <summary>
 /// Instantiates a new instance of the OptionSpec class.
 /// </summary>
 /// <param name="nameKind">The name kind to consider.</param>
 /// <param name="aliases">Aliases of the option to add.</param>
 public OptionSpec(
     OptionNameKind nameKind,
     params string[] aliases) : this(DataValueTypes.Text, RequirementLevels.Optional, OptionNameKind.OnlyName, aliases)
 {
 }
コード例 #10
0
ファイル: OptionNameKind.cs プロジェクト: bindopen/BindOpen
 /// <summary>
 /// Indicates whether the specified kind has value.
 /// </summary>
 /// <param name="kind">The kind of the option name.</param>
 /// <returns>Returns true or false.</returns>
 public static bool HasValue(this OptionNameKind kind)
 {
     return(kind == OptionNameKind.NameThenValue || kind == OptionNameKind.NameWithValue || kind == OptionNameKind.OnlyValue);
 }