Class BaseInputType
- Namespace
- AngleSharp.Html.InputTypes
- Assembly
- AngleSharp.dll
Base type for the all input field types. Primarily from: http://www.w3.org/TR/html5/forms.html#range-state-(type=range)
public abstract class BaseInputType
- Inheritance
-
BaseInputType
- Inherited Members
- Extension Methods
Constructors
BaseInputType(IHtmlInputElement, string, bool)
Creates a new base input type.
public BaseInputType(IHtmlInputElement input, string name, bool validate)
Parameters
input
IHtmlInputElementname
stringvalidate
bool
Fields
NumberPattern
Simple regular expression for floating point numbers.
protected static readonly Regex NumberPattern
Field Value
UnixEpoch
The start of the unix epoch (1st of January 1970).
protected static readonly DateTime UnixEpoch
Field Value
Properties
CanBeValidated
Gets if the input type can be validated.
public bool CanBeValidated { get; }
Property Value
Input
Gets the associated input element.
public IHtmlInputElement Input { get; }
Property Value
Name
Gets the name of the input type.
public string Name { get; }
Property Value
Methods
Check(IValidityState)
Checks the current input for its validity.
public virtual ValidationErrors Check(IValidityState current)
Parameters
current
IValidityState
Returns
CheckTime(IValidityState, string, DateTime?, DateTime?, DateTime?)
Validates the time using the given parameters.
protected ValidationErrors CheckTime(IValidityState state, string value, DateTime? date, DateTime? min, DateTime? max)
Parameters
state
IValidityStatevalue
stringdate
DateTime?min
DateTime?max
DateTime?
Returns
ConstructDataSet(FormDataSet)
Populates the form data set with the current input.
public virtual void ConstructDataSet(FormDataSet dataSet)
Parameters
dataSet
FormDataSet
ConvertFromDate(DateTime)
Tries to convert the given date time to a string.
public virtual string ConvertFromDate(DateTime value)
Parameters
value
DateTime
Returns
ConvertFromNumber(double)
Tries to convert the given number to a string.
public virtual string ConvertFromNumber(double value)
Parameters
value
double
Returns
ConvertToDate(string)
Tries to convert the given string to a date time.
public virtual DateTime? ConvertToDate(string value)
Parameters
value
string
Returns
ConvertToNumber(string?)
Tries to convert the given string to a number.
public virtual double? ConvertToNumber(string? value)
Parameters
value
string
Returns
DoStep(int)
Changes the value by n steps.
public virtual void DoStep(int n)
Parameters
n
int
FetchDigits(string)
Skips all legit digits while returning the final position.
protected static int FetchDigits(string value)
Parameters
value
string
Returns
GetDefaultStep()
Gets the default step size.
protected virtual double GetDefaultStep()
Returns
GetDefaultStepBase()
Gets the default step offset.
protected virtual double GetDefaultStepBase()
Returns
GetErrorsFrom(IValidityState)
Converts the given validity state to a validation error enum.
protected static ValidationErrors GetErrorsFrom(IValidityState state)
Parameters
state
IValidityState
Returns
GetStep()
Gets the current step size.
protected double GetStep()
Returns
GetStepScaleFactor()
Gets the step scaling factor.
protected virtual double GetStepScaleFactor()
Returns
GetWeekOfYear(DateTime)
Tries to convert the value to a week.
protected static int GetWeekOfYear(DateTime value)
Parameters
value
DateTime
Returns
IsAppendingData(IHtmlElement)
Checks if the given type wants to append data.
public virtual bool IsAppendingData(IHtmlElement submitter)
Parameters
submitter
IHtmlElement
Returns
IsInvalidPattern(string?, string?)
Checks if the string does not follow the pattern.
protected static bool IsInvalidPattern(string? pattern, string? value)
Parameters
Returns
IsLegalDay(int, int, int)
Checks if the given values form a legal date.
protected static bool IsLegalDay(int day, int month, int year)
Parameters
Returns
IsLegalHour(int)
Checks if the given value is a legal hour.
protected static bool IsLegalHour(int value)
Parameters
value
int
Returns
IsLegalMinute(int)
Checks if the given value is a legal minute.
protected static bool IsLegalMinute(int value)
Parameters
value
int
Returns
IsLegalMonth(int)
Checks if the given value is a legal month.
protected static bool IsLegalMonth(int value)
Parameters
value
int
Returns
IsLegalSecond(int)
Checks if the given value is a legal second.
protected static bool IsLegalSecond(int value)
Parameters
value
int
Returns
IsLegalWeek(int, int)
Checks if the given values form a legal week.
protected static bool IsLegalWeek(int week, int year)
Parameters
Returns
IsLegalYear(int)
Checks if the given value is a legal year.
protected static bool IsLegalYear(int value)
Parameters
value
int
Returns
IsStepMismatch()
Checks if the current value does not match the steps.
protected bool IsStepMismatch()
Returns
IsTimeSeparator(char)
Checks if the given character is a valid time separator.
protected static bool IsTimeSeparator(char chr)
Parameters
chr
char
Returns
PositionIsValidForDateTime(string, int)
Checks the assumption that the string continues with a date time.
protected static bool PositionIsValidForDateTime(string value, int position)
Parameters
Returns
ToNumber(string?)
Tries to convert the value to a number using the default expression.
protected static double? ToNumber(string? value)
Parameters
value
string
Returns
ToTime(string, ref int)
Tries to convert the value to a time starting at the given position.
protected static TimeSpan? ToTime(string value, ref int position)