Rename TagClass to TagCollection
This commit is contained in:
parent
5917d059e4
commit
6f490b4491
6 changed files with 19 additions and 19 deletions
|
|
@ -20,7 +20,7 @@ internal interface IClosingPropertyTag : IPropertyTag
|
|||
bool StartsWithClosing(string templateString, out string exactName, out IClosingPropertyTag propertyTag);
|
||||
}
|
||||
|
||||
public class ConditionalTagClass<TClass> : TagClass
|
||||
public class ConditionalTagClass<TClass> : TagCollection
|
||||
{
|
||||
public ConditionalTagClass(bool caseSensative = true) :base(typeof(TClass), caseSensative) { }
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public class NamingTemplate
|
|||
private Delegate templateToString;
|
||||
private readonly List<string> warnings = new();
|
||||
private readonly List<string> errors = new();
|
||||
private readonly IEnumerable<TagClass> Classes;
|
||||
private readonly IEnumerable<TagCollection> Classes;
|
||||
private readonly List<ITemplateTag> _tagsInUse = new();
|
||||
|
||||
public const string ERROR_NULL_IS_INVALID = "Null template is invalid.";
|
||||
|
|
@ -47,9 +47,9 @@ public class NamingTemplate
|
|||
|
||||
/// <summary>Parse a template string to a <see cref="NamingTemplate"/></summary>
|
||||
/// <param name="template">The template string to parse</param>
|
||||
/// <param name="tagClasses">A collection of <see cref="TagClass"/> with
|
||||
/// <param name="tagClasses">A collection of <see cref="TagCollection"/> with
|
||||
/// properties registered to match to the <paramref name="template"/></param>
|
||||
public static NamingTemplate Parse(string template, IEnumerable<TagClass> tagClasses)
|
||||
public static NamingTemplate Parse(string template, IEnumerable<TagCollection> tagClasses)
|
||||
{
|
||||
var namingTemplate = new NamingTemplate(tagClasses);
|
||||
try
|
||||
|
|
@ -71,7 +71,7 @@ public class NamingTemplate
|
|||
return namingTemplate;
|
||||
}
|
||||
|
||||
private NamingTemplate(IEnumerable<TagClass> properties)
|
||||
private NamingTemplate(IEnumerable<TagCollection> properties)
|
||||
{
|
||||
Classes = properties;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ namespace FileManager.NamingTemplate;
|
|||
|
||||
public delegate string PropertyFormatter<T>(ITemplateTag templateTag, T value, string formatString);
|
||||
|
||||
public class PropertyTagClass<TClass> : TagClass
|
||||
public class PropertyTagClass<TClass> : TagCollection
|
||||
{
|
||||
public PropertyTagClass(bool caseSensative = true) : base(typeof(TClass), caseSensative) { }
|
||||
|
||||
|
|
|
|||
|
|
@ -8,17 +8,17 @@ using System.Text.RegularExpressions;
|
|||
namespace FileManager.NamingTemplate;
|
||||
|
||||
/// <summary>A collection of <see cref="IPropertyTag"/>s registered to a single <see cref="Type"/>.</summary>
|
||||
public abstract class TagClass : IEnumerable<ITemplateTag>
|
||||
public abstract class TagCollection : IEnumerable<ITemplateTag>
|
||||
{
|
||||
/// <summary>The <see cref="ParameterExpression"/> of the <see cref="TagClass"/>'s TClass type.</summary>
|
||||
/// <summary>The <see cref="ParameterExpression"/> of the <see cref="TagCollection"/>'s TClass type.</summary>
|
||||
public ParameterExpression Parameter { get; }
|
||||
/// <summary>The <see cref="ITemplateTag"/>s registered with this <see cref="TagClass"/> </summary>
|
||||
/// <summary>The <see cref="ITemplateTag"/>s registered with this <see cref="TagCollection"/> </summary>
|
||||
public IEnumerator<ITemplateTag> GetEnumerator() => PropertyTags.Select(p => p.TemplateTag).GetEnumerator();
|
||||
|
||||
protected RegexOptions Options { get; } = RegexOptions.Compiled;
|
||||
private List<IPropertyTag> PropertyTags { get; } = new();
|
||||
|
||||
protected TagClass(Type classType, bool caseSensative = true)
|
||||
protected TagCollection(Type classType, bool caseSensative = true)
|
||||
{
|
||||
Parameter = Expression.Parameter(classType, classType.Name);
|
||||
Options |= caseSensative ? RegexOptions.None : RegexOptions.IgnoreCase;
|
||||
Loading…
Add table
Add a link
Reference in a new issue