2022-01-15 11:25:12 -05:00
|
|
|
|
using System;
|
|
|
|
|
using JetBrains.Annotations;
|
|
|
|
|
using UnityEditor;
|
|
|
|
|
|
|
|
|
|
namespace TriInspector
|
|
|
|
|
{
|
|
|
|
|
public abstract class TriValidator
|
|
|
|
|
{
|
|
|
|
|
internal bool ApplyOnArrayElement { get; set; }
|
|
|
|
|
|
2022-05-09 07:23:27 -04:00
|
|
|
|
[PublicAPI]
|
|
|
|
|
public virtual void Initialize(TriPropertyDefinition propertyDefinition)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-15 11:25:12 -05:00
|
|
|
|
[PublicAPI]
|
|
|
|
|
public abstract TriValidationResult Validate(TriProperty property);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public abstract class TriAttributeValidator : TriValidator
|
|
|
|
|
{
|
|
|
|
|
internal Attribute RawAttribute { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public abstract class TriAttributeValidator<TAttribute> : TriAttributeValidator
|
|
|
|
|
where TAttribute : Attribute
|
|
|
|
|
{
|
|
|
|
|
[PublicAPI]
|
|
|
|
|
public TAttribute Attribute => (TAttribute) RawAttribute;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public abstract class TriValueValidator : TriValidator
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public abstract class TriValueValidator<T> : TriValueValidator
|
|
|
|
|
{
|
|
|
|
|
public sealed override TriValidationResult Validate(TriProperty property)
|
|
|
|
|
{
|
|
|
|
|
return Validate(new TriValue<T>(property));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[PublicAPI]
|
|
|
|
|
public abstract TriValidationResult Validate(TriValue<T> propertyValue);
|
|
|
|
|
}
|
|
|
|
|
}
|