/* -----------------------------------------------------
*
* File: FormatVerbosities.cs
* Author: sven.kopacz@keysight.com
* Created: 21.10.2016
*
* -----------------------------------------------------
*
* Description: See class summary
*
* -----------------------------------------------------
*/
using System;
namespace OpenTap
{
/// Indicates to what extend a formatter should be verbose.
public enum FormatVerbosities
{
/// For the unit minutes, a formatter would just return ":".
SuperBrief,
/// For the unit seconds, a formatter would return "s".
Brief,
/// For the unit seconds, a formatter would return "sec".
Normal,
/// For the unit seconds, a formatter would return "second".
Verbose
}
///
/// Attribute for giving directives to the TimeSpanControl provider, that shows the control provider in the GUI.
///
public class TimeSpanFormatAttribute : Attribute
{
///
/// Gets or sets a value indicating whether 'None' is allowed as a textual representation of
/// TimeSpan.Zero.
///
///
/// true if 'None' is allowed, false if not.
public bool AllowNone { get; private set; }
///
/// Gets or sets a value indicating whether we a negative timespan is allowed. If set to false,
/// any negative input will automatically be turned into a positive TimeSpan.
///
///
/// true if negative values are allowed, false if not.
public bool AllowNegative { get; private set; }
///
/// Sets the preferred verbosity for formatting the TimeSpan value.
///
public FormatVerbosities Verbosity { get; private set; }
///
/// Time span format attribute.
///
///
///
///
public TimeSpanFormatAttribute(bool allowNone = false, bool allowNegative = false, FormatVerbosities verbosity = FormatVerbosities.Normal)
{
AllowNone = allowNone;
AllowNegative = allowNegative;
Verbosity = verbosity;
}
}
}