Add model-owned record grouping: declaration, tree, create-in-group, ref labels
[CultInspectorGroupBy(nameof(A), nameof(B))] on a document class names the members its record list groups by, outermost first. CultInspectorModel owns the rest: GroupingOf validates the declaration (a refused one gives a flat list and a notice), GroupRecords partitions RecordCandidates by value identity with occupied values only, CreateInGroup builds the record a node holds, RecordRefLabel owns None and Missing <key>. A variant groups by its resolved Document. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
8ad0691bdd
commit
79e9318698
4 changed files with 687 additions and 0 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace GameCult.Caching
|
||||
{
|
||||
|
|
@ -78,6 +79,21 @@ namespace GameCult.Caching
|
|||
public Type? AssetType { get; }
|
||||
}
|
||||
|
||||
// Groups a document type's record list by the named members, outermost first: the argument order is the nesting order.
|
||||
// The nearest declaration up the inheritance chain wins, so a derived type may re-declare, and an empty declaration
|
||||
// opts out of a base's. A member must be a visible, editable string, integer, bool, non-[Flags] enum or CultRecordRef;
|
||||
// anything else gives a flat list and a notice. Presentation only: no schema, index or stored byte changes.
|
||||
[AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = false)]
|
||||
public sealed class CultInspectorGroupByAttribute : Attribute
|
||||
{
|
||||
public CultInspectorGroupByAttribute(params string[] members)
|
||||
{
|
||||
Members = members ?? throw new ArgumentNullException(nameof(members));
|
||||
}
|
||||
|
||||
public IReadOnlyList<string> Members { get; }
|
||||
}
|
||||
|
||||
// Marks a lowering's drawer class as the drawer for a claimed type. Claimed is either an Attribute subclass (the
|
||||
// drawer draws every member carrying that attribute) or a value type (every value of that type, or of any closed
|
||||
// form when Claimed is an open generic definition). Attribute claims win over type claims, which win over the
|
||||
|
|
|
|||
Loading…
Reference in a new issue