using System;
namespace QFSW.QC
{
///
/// Parser for a single type.
///
/// The type to parse.
public abstract class BasicQcParser : IQcParser
{
private Func _recursiveParser;
public virtual int Priority => 0;
public bool CanParse(Type type)
{
return type == typeof(T);
}
public virtual object Parse(string value, Type type, Func recursiveParser)
{
_recursiveParser = recursiveParser;
return Parse(value);
}
protected object ParseRecursive(string value, Type type)
{
return _recursiveParser(value, type);
}
protected TElement ParseRecursive(string value)
{
return (TElement)_recursiveParser(value, typeof(TElement));
}
public abstract T Parse(string value);
}
}