Rename Term.InOut and .Oper, add InOut property

wip/no-type-lookup
copygirl 2 years ago
parent 60c031a119
commit 33bbd75fbc
  1. 21
      src/gaemstone.ECS/Term.cs

@ -10,8 +10,8 @@ public class Term
public TermId? Source { get; set; } public TermId? Source { get; set; }
public TermId? Relation { get; set; } public TermId? Relation { get; set; }
public TermId? Target { get; set; } public TermId? Target { get; set; }
public TermInOutKind InOut { get; set; } public TermInOutKind InOutKind { get; set; }
public TermOperKind Oper { get; set; } public TermOperKind OperKind { get; set; }
public IdFlags Flags { get; set; } public IdFlags Flags { get; set; }
public Term() { } public Term() { }
@ -24,21 +24,22 @@ public class Term
public static implicit operator Term(IdRef id) => new(id); public static implicit operator Term(IdRef id) => new(id);
public static implicit operator Term(Id id) => new(id); public static implicit operator Term(Id id) => new(id);
public Term None { get { InOut = TermInOutKind.None; return this; } } public Term None { get { InOutKind = TermInOutKind.None; return this; } }
public Term In { get { InOut = TermInOutKind.In; return this; } } public Term In { get { InOutKind = TermInOutKind.In; return this; } }
public Term Out { get { InOut = TermInOutKind.Out; return this; } } public Term Out { get { InOutKind = TermInOutKind.Out; return this; } }
public Term InOut { get { InOutKind = TermInOutKind.InOut; return this; } }
public Term Or { get { Oper = TermOperKind.Or; return this; } } public Term Or { get { OperKind = TermOperKind.Or; return this; } }
public Term Not { get { Oper = TermOperKind.Not; return this; } } public Term Not { get { OperKind = TermOperKind.Not; return this; } }
public Term Optional { get { Oper = TermOperKind.Optional; return this; } } public Term Optional { get { OperKind = TermOperKind.Optional; return this; } }
public ecs_term_t ToFlecs(IAllocator allocator) => new() { public ecs_term_t ToFlecs(IAllocator allocator) => new() {
id = Id, id = Id,
src = Source?.ToFlecs(allocator) ?? default, src = Source?.ToFlecs(allocator) ?? default,
first = Relation?.ToFlecs(allocator) ?? default, first = Relation?.ToFlecs(allocator) ?? default,
second = Target?.ToFlecs(allocator) ?? default, second = Target?.ToFlecs(allocator) ?? default,
inout = (ecs_inout_kind_t)InOut, inout = (ecs_inout_kind_t)InOutKind,
oper = (ecs_oper_kind_t)Oper, oper = (ecs_oper_kind_t)OperKind,
id_flags = (ecs_id_t)(ulong)Flags, id_flags = (ecs_id_t)(ulong)Flags,
}; };
} }

Loading…
Cancel
Save