@@ -29,102 +29,109 @@ namespace Flecs.NET.Core;
2929 /// {{ Generator . XmlTypeParameters [ i ] }}
3030 public unsafe partial struct {{ Generator . GetTypeName ( Type . IterIterable , i ) }} : IEquatable<{{ Generator . GetTypeName ( Type . IterIterable , i ) }} >
3131 {
32- private IterIterable _iterIterable;
32+ /// <inheritdoc cref="IIterIterable.Underlying"/>
33+ public IterIterable Underlying;
3334
34- internal IterIterable(IterIterable iterIterable)
35+ /// <inheritdoc cref="IIterIterable.Iterator"/>
36+ public ref ecs_iter_t Iterator => ref Underlying.Iterator;
37+
38+ /// <inheritdoc cref="IIterIterable.IterableType"/>
39+ public readonly IterableType IterableType => Underlying.IterableType;
40+
41+ internal IterIterable(IterIterable handle)
3542 {
36- _iterIterable = iterIterable ;
43+ Underlying = handle ;
3744 }
3845
3946 /// <inheritdoc cref="IterIterable(ecs_iter_t, IterableType)"/>
4047 public IterIterable(ecs_iter_t iter, IterableType iterableType)
4148 {
42- _iterIterable = new IterIterable(iter, iterableType);
49+ Underlying = new IterIterable(iter, iterableType);
4350 }
4451
4552 /// <inheritdoc cref="IterIterable.SetVar(int, ulong)"/>
4653 public ref {{ Generator . GetTypeName ( Type . IterIterable , i ) }} SetVar(int varId, ulong value)
4754 {
48- _iterIterable .SetVar(varId, value);
55+ Underlying .SetVar(varId, value);
4956 return ref this;
5057 }
5158
5259 /// <inheritdoc cref="IterIterable.SetVar(string, ulong)"/>
5360 public ref {{ Generator . GetTypeName ( Type . IterIterable , i ) }} SetVar(string name, ulong value)
5461 {
55- _iterIterable .SetVar(name, value);
62+ Underlying .SetVar(name, value);
5663 return ref this;
5764 }
5865
5966 /// <inheritdoc cref="IterIterable.SetVar(string, ecs_table_t*)"/>
6067 public ref {{ Generator . GetTypeName ( Type . IterIterable , i ) }} SetVar(string name, ecs_table_t* value)
6168 {
62- _iterIterable .SetVar(name, value);
69+ Underlying .SetVar(name, value);
6370 return ref this;
6471 }
6572
6673 /// <inheritdoc cref="IterIterable.SetVar(string, ecs_table_range_t)"/>
6774 public ref {{ Generator . GetTypeName ( Type . IterIterable , i ) }} SetVar(string name, ecs_table_range_t value)
6875 {
69- _iterIterable .SetVar(name, value);
76+ Underlying .SetVar(name, value);
7077 return ref this;
7178 }
7279
7380 /// <inheritdoc cref="IterIterable.SetVar(string, Table)"/>
7481 public ref {{ Generator . GetTypeName ( Type . IterIterable , i ) }} SetVar(string name, Table value)
7582 {
76- _iterIterable .SetVar(name, value);
83+ Underlying .SetVar(name, value);
7784 return ref this;
7885 }
7986
8087 /// <inheritdoc cref="IterIterable.ToJson(in IterToJsonDesc)"/>
8188 public string ToJson(in IterToJsonDesc desc)
8289 {
83- return _iterIterable .ToJson(in desc);
90+ return Underlying .ToJson(in desc);
8491 }
8592
8693 /// <inheritdoc cref="IterIterable.ToJson()"/>
8794 public string ToJson()
8895 {
89- return _iterIterable .ToJson();
96+ return Underlying .ToJson();
9097 }
9198
9299 /// <inheritdoc cref="IterIterable.Count()"/>
93100 public int Count()
94101 {
95- return _iterIterable .Count();
102+ return Underlying .Count();
96103 }
97104
98105 /// <inheritdoc cref="IterIterable.IsTrue()"/>
99106 public bool IsTrue()
100107 {
101- return _iterIterable .IsTrue();
108+ return Underlying .IsTrue();
102109 }
103110
104111 /// <inheritdoc cref="IterIterable.First()"/>
105112 public Entity First()
106113 {
107- return _iterIterable .First();
114+ return Underlying .First();
108115 }
109116
110117 /// <inheritdoc cref="IterIterable.SetGroup(ulong)"/>
111118 public ref {{ Generator . GetTypeName ( Type . IterIterable , i ) }} SetGroup(ulong groupId)
112119 {
113- _iterIterable .SetGroup(groupId);
120+ Underlying .SetGroup(groupId);
114121 return ref this;
115122 }
116123
117124 /// <inheritdoc cref="IterIterable.SetGroup{T}()"/>
118125 public ref {{ Generator . GetTypeName ( Type . IterIterable , i ) }} SetGroup<T>()
119126 {
120- _iterIterable .SetGroup<T>();
127+ Underlying .SetGroup<T>();
121128 return ref this;
122129 }
123130
124131 /// <inheritdoc cref="IterIterable.Equals(IterIterable)"/>
125132 public bool Equals({{ Generator . GetTypeName ( Type . IterIterable , i ) }} other)
126133 {
127- return _iterIterable .Equals(other._iterIterable );
134+ return Underlying .Equals(other.Underlying );
128135 }
129136
130137 /// <inheritdoc cref="IterIterable.Equals(object)"/>
@@ -136,7 +143,7 @@ public override bool Equals(object? obj)
136143 /// <inheritdoc cref="IterIterable.GetHashCode()"/>
137144 public override int GetHashCode()
138145 {
139- return _iterIterable .GetHashCode();
146+ return Underlying .GetHashCode();
140147 }
141148
142149 /// <inheritdoc cref="IterIterable.op_Equality"/>
@@ -151,25 +158,31 @@ public override int GetHashCode()
151158 return !(left == right);
152159 }
153160 }
161+
162+ // IIterIterable Interface
163+ public unsafe partial struct {{ Generator . GetTypeName ( Type . IterIterable , i ) }} : IIterIterable
164+ {
165+ ref IterIterable IIterIterable.Underlying => ref Underlying;
166+ }
154167
155168 // IIterableBase Interface
156169 public unsafe partial struct {{ Generator . GetTypeName ( Type . IterIterable , i ) }} : IIterableBase
157170 {
158- /// <inheritdoc cref="IterIterable .World"/>
159- public ref ecs_world_t* World => ref _iterIterable.World ;
171+ /// <inheritdoc cref="IIterableBase .World"/>
172+ ecs_world_t* IIterableBase. World => Iterator.world ;
160173
161- /// <inheritdoc cref="IterIterable .GetIter(ecs_world_t*) "/>
174+ /// <inheritdoc cref="IIterableBase .GetIter"/>
162175 [MethodImpl(MethodImplOptions.AggressiveInlining)]
163- public ecs_iter_t GetIter(ecs_world_t* world = null )
176+ public ecs_iter_t GetIter(World world = default )
164177 {
165- return _iterIterable .GetIter(world);
178+ return Underlying .GetIter(world);
166179 }
167180
168- /// <inheritdoc cref="IterIterable .GetNext(ecs_iter_t*) "/>
181+ /// <inheritdoc cref="IIterableBase .GetNext"/>
169182 [MethodImpl(MethodImplOptions.AggressiveInlining)]
170- public bool GetNext(ecs_iter_t* it)
183+ public bool GetNext(Iter it)
171184 {
172- return _iterIterable .GetNext(it);
185+ return Underlying .GetNext(it);
173186 }
174187 }
175188
@@ -179,73 +192,73 @@ public unsafe partial struct {{Generator.GetTypeName(Type.IterIterable, i)}} : {
179192 /// <inheritdoc cref="IterIterable.Page(int, int)"/>
180193 public {{ Generator . GetTypeName ( Type . PageIterable , i ) }} Page(int offset, int limit)
181194 {
182- return new {{ Generator . GetTypeName ( Type . PageIterable , i ) }} (_iterIterable .Page(offset, limit));
195+ return new {{ Generator . GetTypeName ( Type . PageIterable , i ) }} (Underlying .Page(offset, limit));
183196 }
184197
185198 /// <inheritdoc cref="IterIterable.Worker(int, int)"/>
186199 public {{ Generator . GetTypeName ( Type . WorkerIterable , i ) }} Worker(int index, int count)
187200 {
188- return new {{ Generator . GetTypeName ( Type . WorkerIterable , i ) }} (_iterIterable .Worker(index, count));
201+ return new {{ Generator . GetTypeName ( Type . WorkerIterable , i ) }} (Underlying .Worker(index, count));
189202 }
190203
191204 /// <inheritdoc cref="IterIterable.Iter(Flecs.NET.Core.World)"/>
192205 public {{ Generator . GetTypeName ( Type . IterIterable , i ) }} Iter(World world = default)
193206 {
194- return new(_iterIterable .Iter(world));
207+ return new(Underlying .Iter(world));
195208 }
196209
197210 /// <inheritdoc cref="IterIterable.Iter(Flecs.NET.Core.Iter)"/>
198211 public {{ Generator . GetTypeName ( Type . IterIterable , i ) }} Iter(Iter it)
199212 {
200- return new(_iterIterable .Iter(it));
213+ return new(Underlying .Iter(it));
201214 }
202215
203216 /// <inheritdoc cref="IterIterable.Iter(Flecs.NET.Core.Entity)"/>
204217 public {{ Generator . GetTypeName ( Type . IterIterable , i ) }} Iter(Entity entity)
205218 {
206- return new(_iterIterable .Iter(entity));
219+ return new(Underlying .Iter(entity));
207220 }
208221
209222 /// <inheritdoc cref="IterIterable.SetVar(int, ulong)"/>
210223 {{ Generator . GetTypeName ( Type . IterIterable , i ) }} {{ Generator . GetTypeName ( Type . IIterable , i ) }} .SetVar(int varId, ulong value)
211224 {
212- return new(_iterIterable .SetVar(varId, value));
225+ return new(Underlying .SetVar(varId, value));
213226 }
214227
215228 /// <inheritdoc cref="IterIterable.SetVar(string, ulong)"/>
216229 {{ Generator . GetTypeName ( Type . IterIterable , i ) }} {{ Generator . GetTypeName ( Type . IIterable , i ) }} .SetVar(string name, ulong value)
217230 {
218- return new(_iterIterable .SetVar(name, value));
231+ return new(Underlying .SetVar(name, value));
219232 }
220233
221234 /// <inheritdoc cref="IterIterable.SetVar(string, ecs_table_t*)"/>
222235 {{ Generator . GetTypeName ( Type . IterIterable , i ) }} {{ Generator . GetTypeName ( Type . IIterable , i ) }} .SetVar(string name, ecs_table_t* value)
223236 {
224- return new(_iterIterable .SetVar(name, value));
237+ return new(Underlying .SetVar(name, value));
225238 }
226239
227240 /// <inheritdoc cref="IterIterable.SetVar(string, ecs_table_range_t)"/>
228241 {{ Generator . GetTypeName ( Type . IterIterable , i ) }} {{ Generator . GetTypeName ( Type . IIterable , i ) }} .SetVar(string name, ecs_table_range_t value)
229242 {
230- return new(_iterIterable .SetVar(name, value));
243+ return new(Underlying .SetVar(name, value));
231244 }
232245
233246 /// <inheritdoc cref="IterIterable.SetVar(string, Table)"/>
234247 {{ Generator . GetTypeName ( Type . IterIterable , i ) }} {{ Generator . GetTypeName ( Type . IIterable , i ) }} .SetVar(string name, Table value)
235248 {
236- return new(_iterIterable .SetVar(name, value));
249+ return new(Underlying .SetVar(name, value));
237250 }
238251
239252 /// <inheritdoc cref="IterIterable.SetGroup(ulong)"/>
240253 {{ Generator . GetTypeName ( Type . IterIterable , i ) }} {{ Generator . GetTypeName ( Type . IIterable , i ) }} .SetGroup(ulong groupId)
241254 {
242- return new(_iterIterable .SetGroup(groupId));
255+ return new(Underlying .SetGroup(groupId));
243256 }
244257
245258 /// <inheritdoc cref="IterIterable.SetGroup{T}()"/>
246259 {{ Generator . GetTypeName ( Type . IterIterable , i ) }} {{ Generator . GetTypeName ( Type . IIterable , i ) }} .SetGroup<T>()
247260 {
248- return new(_iterIterable .SetGroup<T>());
261+ return new(Underlying .SetGroup<T>());
249262 }
250263 }
251264 """ ;
0 commit comments