using System; namespace Vellum.Generator { /// /// Describes a [Saveable] type as plain data: the shape its converter is written from, and what to check about it. /// They are kept apart so a change to the checks alone, such as a member moving down a line, doesn't rewrite the /// generated file. /// public sealed class SaveableModel : IEquatable { /// /// Holds the shape to write a converter from, or null if none is written. /// public readonly SaveableShape Shape; public readonly SaveableChecks Checks; public SaveableModel(SaveableShape shape, SaveableChecks checks) { Shape = shape; Checks = checks; } public bool Equals(SaveableModel other) { if (other == null || !Checks.Equals(other.Checks)) { return false; } if (Shape == null) { return other.Shape == null; } return Shape.Equals(other.Shape); } public override bool Equals(object obj) { return Equals(obj as SaveableModel); } public override int GetHashCode() { return Checks.GetHashCode(); } } }