@@ -29,102 +29,109 @@ namespace Flecs.NET.Core;
29
29
/// {{ Generator . XmlTypeParameters [ i ] }}
30
30
public unsafe partial struct {{ Generator . GetTypeName ( Type . IterIterable , i ) }} : IEquatable<{{ Generator . GetTypeName ( Type . IterIterable , i ) }} >
31
31
{
32
- private IterIterable _iterIterable;
32
+ /// <inheritdoc cref="IIterIterable.Underlying"/>
33
+ public IterIterable Underlying;
33
34
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)
35
42
{
36
- _iterIterable = iterIterable ;
43
+ Underlying = handle ;
37
44
}
38
45
39
46
/// <inheritdoc cref="IterIterable(ecs_iter_t, IterableType)"/>
40
47
public IterIterable(ecs_iter_t iter, IterableType iterableType)
41
48
{
42
- _iterIterable = new IterIterable(iter, iterableType);
49
+ Underlying = new IterIterable(iter, iterableType);
43
50
}
44
51
45
52
/// <inheritdoc cref="IterIterable.SetVar(int, ulong)"/>
46
53
public ref {{ Generator . GetTypeName ( Type . IterIterable , i ) }} SetVar(int varId, ulong value)
47
54
{
48
- _iterIterable .SetVar(varId, value);
55
+ Underlying .SetVar(varId, value);
49
56
return ref this;
50
57
}
51
58
52
59
/// <inheritdoc cref="IterIterable.SetVar(string, ulong)"/>
53
60
public ref {{ Generator . GetTypeName ( Type . IterIterable , i ) }} SetVar(string name, ulong value)
54
61
{
55
- _iterIterable .SetVar(name, value);
62
+ Underlying .SetVar(name, value);
56
63
return ref this;
57
64
}
58
65
59
66
/// <inheritdoc cref="IterIterable.SetVar(string, ecs_table_t*)"/>
60
67
public ref {{ Generator . GetTypeName ( Type . IterIterable , i ) }} SetVar(string name, ecs_table_t* value)
61
68
{
62
- _iterIterable .SetVar(name, value);
69
+ Underlying .SetVar(name, value);
63
70
return ref this;
64
71
}
65
72
66
73
/// <inheritdoc cref="IterIterable.SetVar(string, ecs_table_range_t)"/>
67
74
public ref {{ Generator . GetTypeName ( Type . IterIterable , i ) }} SetVar(string name, ecs_table_range_t value)
68
75
{
69
- _iterIterable .SetVar(name, value);
76
+ Underlying .SetVar(name, value);
70
77
return ref this;
71
78
}
72
79
73
80
/// <inheritdoc cref="IterIterable.SetVar(string, Table)"/>
74
81
public ref {{ Generator . GetTypeName ( Type . IterIterable , i ) }} SetVar(string name, Table value)
75
82
{
76
- _iterIterable .SetVar(name, value);
83
+ Underlying .SetVar(name, value);
77
84
return ref this;
78
85
}
79
86
80
87
/// <inheritdoc cref="IterIterable.ToJson(in IterToJsonDesc)"/>
81
88
public string ToJson(in IterToJsonDesc desc)
82
89
{
83
- return _iterIterable .ToJson(in desc);
90
+ return Underlying .ToJson(in desc);
84
91
}
85
92
86
93
/// <inheritdoc cref="IterIterable.ToJson()"/>
87
94
public string ToJson()
88
95
{
89
- return _iterIterable .ToJson();
96
+ return Underlying .ToJson();
90
97
}
91
98
92
99
/// <inheritdoc cref="IterIterable.Count()"/>
93
100
public int Count()
94
101
{
95
- return _iterIterable .Count();
102
+ return Underlying .Count();
96
103
}
97
104
98
105
/// <inheritdoc cref="IterIterable.IsTrue()"/>
99
106
public bool IsTrue()
100
107
{
101
- return _iterIterable .IsTrue();
108
+ return Underlying .IsTrue();
102
109
}
103
110
104
111
/// <inheritdoc cref="IterIterable.First()"/>
105
112
public Entity First()
106
113
{
107
- return _iterIterable .First();
114
+ return Underlying .First();
108
115
}
109
116
110
117
/// <inheritdoc cref="IterIterable.SetGroup(ulong)"/>
111
118
public ref {{ Generator . GetTypeName ( Type . IterIterable , i ) }} SetGroup(ulong groupId)
112
119
{
113
- _iterIterable .SetGroup(groupId);
120
+ Underlying .SetGroup(groupId);
114
121
return ref this;
115
122
}
116
123
117
124
/// <inheritdoc cref="IterIterable.SetGroup{T}()"/>
118
125
public ref {{ Generator . GetTypeName ( Type . IterIterable , i ) }} SetGroup<T>()
119
126
{
120
- _iterIterable .SetGroup<T>();
127
+ Underlying .SetGroup<T>();
121
128
return ref this;
122
129
}
123
130
124
131
/// <inheritdoc cref="IterIterable.Equals(IterIterable)"/>
125
132
public bool Equals({{ Generator . GetTypeName ( Type . IterIterable , i ) }} other)
126
133
{
127
- return _iterIterable .Equals(other._iterIterable );
134
+ return Underlying .Equals(other.Underlying );
128
135
}
129
136
130
137
/// <inheritdoc cref="IterIterable.Equals(object)"/>
@@ -136,7 +143,7 @@ public override bool Equals(object? obj)
136
143
/// <inheritdoc cref="IterIterable.GetHashCode()"/>
137
144
public override int GetHashCode()
138
145
{
139
- return _iterIterable .GetHashCode();
146
+ return Underlying .GetHashCode();
140
147
}
141
148
142
149
/// <inheritdoc cref="IterIterable.op_Equality"/>
@@ -151,25 +158,31 @@ public override int GetHashCode()
151
158
return !(left == right);
152
159
}
153
160
}
161
+
162
+ // IIterIterable Interface
163
+ public unsafe partial struct {{ Generator . GetTypeName ( Type . IterIterable , i ) }} : IIterIterable
164
+ {
165
+ ref IterIterable IIterIterable.Underlying => ref Underlying;
166
+ }
154
167
155
168
// IIterableBase Interface
156
169
public unsafe partial struct {{ Generator . GetTypeName ( Type . IterIterable , i ) }} : IIterableBase
157
170
{
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 ;
160
173
161
- /// <inheritdoc cref="IterIterable .GetIter(ecs_world_t*) "/>
174
+ /// <inheritdoc cref="IIterableBase .GetIter"/>
162
175
[MethodImpl(MethodImplOptions.AggressiveInlining)]
163
- public ecs_iter_t GetIter(ecs_world_t* world = null )
176
+ public ecs_iter_t GetIter(World world = default )
164
177
{
165
- return _iterIterable .GetIter(world);
178
+ return Underlying .GetIter(world);
166
179
}
167
180
168
- /// <inheritdoc cref="IterIterable .GetNext(ecs_iter_t*) "/>
181
+ /// <inheritdoc cref="IIterableBase .GetNext"/>
169
182
[MethodImpl(MethodImplOptions.AggressiveInlining)]
170
- public bool GetNext(ecs_iter_t* it)
183
+ public bool GetNext(Iter it)
171
184
{
172
- return _iterIterable .GetNext(it);
185
+ return Underlying .GetNext(it);
173
186
}
174
187
}
175
188
@@ -179,73 +192,73 @@ public unsafe partial struct {{Generator.GetTypeName(Type.IterIterable, i)}} : {
179
192
/// <inheritdoc cref="IterIterable.Page(int, int)"/>
180
193
public {{ Generator . GetTypeName ( Type . PageIterable , i ) }} Page(int offset, int limit)
181
194
{
182
- return new {{ Generator . GetTypeName ( Type . PageIterable , i ) }} (_iterIterable .Page(offset, limit));
195
+ return new {{ Generator . GetTypeName ( Type . PageIterable , i ) }} (Underlying .Page(offset, limit));
183
196
}
184
197
185
198
/// <inheritdoc cref="IterIterable.Worker(int, int)"/>
186
199
public {{ Generator . GetTypeName ( Type . WorkerIterable , i ) }} Worker(int index, int count)
187
200
{
188
- return new {{ Generator . GetTypeName ( Type . WorkerIterable , i ) }} (_iterIterable .Worker(index, count));
201
+ return new {{ Generator . GetTypeName ( Type . WorkerIterable , i ) }} (Underlying .Worker(index, count));
189
202
}
190
203
191
204
/// <inheritdoc cref="IterIterable.Iter(Flecs.NET.Core.World)"/>
192
205
public {{ Generator . GetTypeName ( Type . IterIterable , i ) }} Iter(World world = default)
193
206
{
194
- return new(_iterIterable .Iter(world));
207
+ return new(Underlying .Iter(world));
195
208
}
196
209
197
210
/// <inheritdoc cref="IterIterable.Iter(Flecs.NET.Core.Iter)"/>
198
211
public {{ Generator . GetTypeName ( Type . IterIterable , i ) }} Iter(Iter it)
199
212
{
200
- return new(_iterIterable .Iter(it));
213
+ return new(Underlying .Iter(it));
201
214
}
202
215
203
216
/// <inheritdoc cref="IterIterable.Iter(Flecs.NET.Core.Entity)"/>
204
217
public {{ Generator . GetTypeName ( Type . IterIterable , i ) }} Iter(Entity entity)
205
218
{
206
- return new(_iterIterable .Iter(entity));
219
+ return new(Underlying .Iter(entity));
207
220
}
208
221
209
222
/// <inheritdoc cref="IterIterable.SetVar(int, ulong)"/>
210
223
{{ Generator . GetTypeName ( Type . IterIterable , i ) }} {{ Generator . GetTypeName ( Type . IIterable , i ) }} .SetVar(int varId, ulong value)
211
224
{
212
- return new(_iterIterable .SetVar(varId, value));
225
+ return new(Underlying .SetVar(varId, value));
213
226
}
214
227
215
228
/// <inheritdoc cref="IterIterable.SetVar(string, ulong)"/>
216
229
{{ Generator . GetTypeName ( Type . IterIterable , i ) }} {{ Generator . GetTypeName ( Type . IIterable , i ) }} .SetVar(string name, ulong value)
217
230
{
218
- return new(_iterIterable .SetVar(name, value));
231
+ return new(Underlying .SetVar(name, value));
219
232
}
220
233
221
234
/// <inheritdoc cref="IterIterable.SetVar(string, ecs_table_t*)"/>
222
235
{{ Generator . GetTypeName ( Type . IterIterable , i ) }} {{ Generator . GetTypeName ( Type . IIterable , i ) }} .SetVar(string name, ecs_table_t* value)
223
236
{
224
- return new(_iterIterable .SetVar(name, value));
237
+ return new(Underlying .SetVar(name, value));
225
238
}
226
239
227
240
/// <inheritdoc cref="IterIterable.SetVar(string, ecs_table_range_t)"/>
228
241
{{ Generator . GetTypeName ( Type . IterIterable , i ) }} {{ Generator . GetTypeName ( Type . IIterable , i ) }} .SetVar(string name, ecs_table_range_t value)
229
242
{
230
- return new(_iterIterable .SetVar(name, value));
243
+ return new(Underlying .SetVar(name, value));
231
244
}
232
245
233
246
/// <inheritdoc cref="IterIterable.SetVar(string, Table)"/>
234
247
{{ Generator . GetTypeName ( Type . IterIterable , i ) }} {{ Generator . GetTypeName ( Type . IIterable , i ) }} .SetVar(string name, Table value)
235
248
{
236
- return new(_iterIterable .SetVar(name, value));
249
+ return new(Underlying .SetVar(name, value));
237
250
}
238
251
239
252
/// <inheritdoc cref="IterIterable.SetGroup(ulong)"/>
240
253
{{ Generator . GetTypeName ( Type . IterIterable , i ) }} {{ Generator . GetTypeName ( Type . IIterable , i ) }} .SetGroup(ulong groupId)
241
254
{
242
- return new(_iterIterable .SetGroup(groupId));
255
+ return new(Underlying .SetGroup(groupId));
243
256
}
244
257
245
258
/// <inheritdoc cref="IterIterable.SetGroup{T}()"/>
246
259
{{ Generator . GetTypeName ( Type . IterIterable , i ) }} {{ Generator . GetTypeName ( Type . IIterable , i ) }} .SetGroup<T>()
247
260
{
248
- return new(_iterIterable .SetGroup<T>());
261
+ return new(Underlying .SetGroup<T>());
249
262
}
250
263
}
251
264
""" ;
0 commit comments