DeviceDependentGenerator extended to allow generation of enum dependent templates. Name suffix separate to its own attribute.
This commit is contained in:
1 parent
a21ab3134e
commit
d32eea0212
5 files changed
+375
-112
No files matched your search
@@ -5,13 +5,32 @@ namespace PerfectNumbers.Core;
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inherited = false, AllowMultiple = false)]
|
||||
public sealed class DeviceDependentTemplateAttribute : Attribute
|
||||
{
|
||||
public DeviceDependentTemplateAttribute(Type enumType, string? suffix = null)
|
||||
public DeviceDependentTemplateAttribute(Type enumType)
|
||||
{
|
||||
EnumType = enumType ?? throw new ArgumentNullException(nameof(enumType));
|
||||
Suffix = suffix;
|
||||
}
|
||||
|
||||
public Type EnumType { get; }
|
||||
}
|
||||
|
||||
public string? Suffix { get; }
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inherited = false, AllowMultiple = true)]
|
||||
public sealed class EnumDependentTemplateAttribute : Attribute
|
||||
{
|
||||
public EnumDependentTemplateAttribute(Type enumType)
|
||||
{
|
||||
EnumType = enumType ?? throw new ArgumentNullException(nameof(enumType));
|
||||
}
|
||||
|
||||
public Type EnumType { get; }
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inherited = false, AllowMultiple = false)]
|
||||
public sealed class NameSuffixAttribute : Attribute
|
||||
{
|
||||
public NameSuffixAttribute(string suffix)
|
||||
{
|
||||
Suffix = suffix ?? throw new ArgumentNullException(nameof(suffix));
|
||||
}
|
||||
|
||||
public string Suffix { get; }
|
||||
}
|
||||
Reference in new issue
Block a user