capnp 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/bin/capnpc-ruby +15 -0
- data/lib/capnp/generator/generator.rb +568 -0
- data/lib/capnp/generator/schema.capnp.rb +1327 -0
- data/lib/capnp/generator.rb +4 -0
- data/lib/capnp/runtime/buffer/buffer.rb +62 -0
- data/lib/capnp/runtime/buffer/io_buffer.rb +85 -0
- data/lib/capnp/runtime/buffer/sliceable_buffer.rb +16 -0
- data/lib/capnp/runtime/buffer/string_buffer.rb +88 -0
- data/lib/capnp/runtime/list/buffer/data.rb +19 -0
- data/lib/capnp/runtime/list/buffer/list.rb +100 -0
- data/lib/capnp/runtime/list/buffer/numeric.rb +103 -0
- data/lib/capnp/runtime/list/buffer/string.rb +19 -0
- data/lib/capnp/runtime/list/buffer/struct.rb +47 -0
- data/lib/capnp/runtime/list/list.rb +42 -0
- data/lib/capnp/runtime/list/object/list.rb +26 -0
- data/lib/capnp/runtime/list/object/string.rb +26 -0
- data/lib/capnp/runtime/list/string.rb +22 -0
- data/lib/capnp/runtime/message/flat_message.rb +21 -0
- data/lib/capnp/runtime/message/message.rb +62 -0
- data/lib/capnp/runtime/message/stream_message.rb +50 -0
- data/lib/capnp/runtime/reference.rb +100 -0
- data/lib/capnp/runtime/segment.rb +89 -0
- data/lib/capnp/runtime/struct.rb +159 -0
- data/lib/capnp/runtime.rb +3 -0
- data/lib/capnp/version.rb +5 -0
- data/lib/capnp.rb +14 -0
- metadata +200 -0
@@ -0,0 +1,1327 @@
|
|
1
|
+
# typed: strict
|
2
|
+
|
3
|
+
require "capnp"
|
4
|
+
require "sorbet-runtime"
|
5
|
+
module Schema
|
6
|
+
class Node < Capnp::Struct
|
7
|
+
DEFAULT_ID = 0
|
8
|
+
sig { returns(Integer) }
|
9
|
+
def id = read_u64(0, 0)
|
10
|
+
DEFAULT_DISPLAY_NAME = nil
|
11
|
+
sig { returns(T.nilable(Capnp::String)) }
|
12
|
+
def display_name = Capnp::BufferString.from_pointer(read_pointer(0))
|
13
|
+
DEFAULT_DISPLAY_NAME_PREFIX_LENGTH = 0
|
14
|
+
sig { returns(Integer) }
|
15
|
+
def display_name_prefix_length = read_u32(8, 0)
|
16
|
+
DEFAULT_SCOPE_ID = 0
|
17
|
+
sig { returns(Integer) }
|
18
|
+
def scope_id = read_u64(16, 0)
|
19
|
+
sig { returns(T.nilable(Capnp::List[Schema::Node::Parameter])) }
|
20
|
+
def parameters = Schema::Node::Parameter::List.from_pointer(read_pointer(5))
|
21
|
+
DEFAULT_IS_GENERIC = false
|
22
|
+
sig { returns(T::Boolean) }
|
23
|
+
def is_generic = (read_u8(36, 0x00) & 0x1) != 0
|
24
|
+
sig { returns(T.nilable(Capnp::List[Schema::Node::NestedNode])) }
|
25
|
+
def nested_nodes = Schema::Node::NestedNode::List.from_pointer(read_pointer(1))
|
26
|
+
sig { returns(T.nilable(Capnp::List[Schema::Annotation])) }
|
27
|
+
def annotations = Schema::Annotation::List.from_pointer(read_pointer(2))
|
28
|
+
sig { returns(NilClass) }
|
29
|
+
def file = nil
|
30
|
+
sig { returns(T::Boolean) }
|
31
|
+
def is_file? = which? == Which::File
|
32
|
+
sig { returns(GroupStruct) }
|
33
|
+
def struct = GroupStruct.new(@data, @data_size, @pointers, @pointers_size)
|
34
|
+
|
35
|
+
class GroupStruct < Capnp::Struct
|
36
|
+
DEFAULT_DATA_WORD_COUNT = 0
|
37
|
+
sig { returns(Integer) }
|
38
|
+
def data_word_count = read_u16(14, 0)
|
39
|
+
DEFAULT_POINTER_COUNT = 0
|
40
|
+
sig { returns(Integer) }
|
41
|
+
def pointer_count = read_u16(24, 0)
|
42
|
+
# DEFAULT_PREFERRED_LIST_ENCODING = Schema::ElementSize::Empty
|
43
|
+
sig { returns(Schema::ElementSize) }
|
44
|
+
def preferred_list_encoding = Schema::ElementSize.from_integer(read_u16(26, 0))
|
45
|
+
DEFAULT_IS_GROUP = false
|
46
|
+
sig { returns(T::Boolean) }
|
47
|
+
def is_group = (read_u8(28, 0x00) & 0x1) != 0
|
48
|
+
DEFAULT_DISCRIMINANT_COUNT = 0
|
49
|
+
sig { returns(Integer) }
|
50
|
+
def discriminant_count = read_u16(30, 0)
|
51
|
+
DEFAULT_DISCRIMINANT_OFFSET = 0
|
52
|
+
sig { returns(Integer) }
|
53
|
+
def discriminant_offset = read_u32(32, 0)
|
54
|
+
sig { returns(T.nilable(Capnp::List[Schema::Field])) }
|
55
|
+
def fields = Schema::Field::List.from_pointer(read_pointer(3))
|
56
|
+
sig { override.returns(Object) }
|
57
|
+
def to_obj
|
58
|
+
res = {}
|
59
|
+
res["data_word_count"] = data_word_count
|
60
|
+
res["pointer_count"] = pointer_count
|
61
|
+
res["preferred_list_encoding"] = preferred_list_encoding
|
62
|
+
res["is_group"] = is_group
|
63
|
+
res["discriminant_count"] = discriminant_count
|
64
|
+
res["discriminant_offset"] = discriminant_offset
|
65
|
+
res["fields"] = fields&.to_obj
|
66
|
+
res
|
67
|
+
end
|
68
|
+
end
|
69
|
+
sig { returns(T::Boolean) }
|
70
|
+
def is_struct? = which? == Which::Struct
|
71
|
+
sig { returns(GroupEnum) }
|
72
|
+
def enum = GroupEnum.new(@data, @data_size, @pointers, @pointers_size)
|
73
|
+
|
74
|
+
class GroupEnum < Capnp::Struct
|
75
|
+
sig { returns(T.nilable(Capnp::List[Schema::Enumerant])) }
|
76
|
+
def enumerants = Schema::Enumerant::List.from_pointer(read_pointer(3))
|
77
|
+
sig { override.returns(Object) }
|
78
|
+
def to_obj
|
79
|
+
res = {}
|
80
|
+
res["enumerants"] = enumerants&.to_obj
|
81
|
+
res
|
82
|
+
end
|
83
|
+
end
|
84
|
+
sig { returns(T::Boolean) }
|
85
|
+
def is_enum? = which? == Which::Enum
|
86
|
+
sig { returns(GroupInterface) }
|
87
|
+
def interface = GroupInterface.new(@data, @data_size, @pointers, @pointers_size)
|
88
|
+
|
89
|
+
class GroupInterface < Capnp::Struct
|
90
|
+
sig { returns(T.nilable(Capnp::List[Schema::Method])) }
|
91
|
+
def methods = Schema::Method::List.from_pointer(read_pointer(3))
|
92
|
+
sig { returns(T.nilable(Capnp::List[Schema::Superclass])) }
|
93
|
+
def superclasses = Schema::Superclass::List.from_pointer(read_pointer(4))
|
94
|
+
sig { override.returns(Object) }
|
95
|
+
def to_obj
|
96
|
+
res = {}
|
97
|
+
res["methods"] = methods&.to_obj
|
98
|
+
res["superclasses"] = superclasses&.to_obj
|
99
|
+
res
|
100
|
+
end
|
101
|
+
end
|
102
|
+
sig { returns(T::Boolean) }
|
103
|
+
def is_interface? = which? == Which::Interface
|
104
|
+
sig { returns(GroupConst) }
|
105
|
+
def const = GroupConst.new(@data, @data_size, @pointers, @pointers_size)
|
106
|
+
|
107
|
+
class GroupConst < Capnp::Struct
|
108
|
+
sig { returns(T.nilable(Schema::Type)) }
|
109
|
+
def type = Schema::Type.from_pointer(read_pointer(3))
|
110
|
+
sig { returns(T.nilable(Schema::Value)) }
|
111
|
+
def value = Schema::Value.from_pointer(read_pointer(4))
|
112
|
+
sig { override.returns(Object) }
|
113
|
+
def to_obj
|
114
|
+
res = {}
|
115
|
+
res["type"] = type&.to_obj
|
116
|
+
res["value"] = value&.to_obj
|
117
|
+
res
|
118
|
+
end
|
119
|
+
end
|
120
|
+
sig { returns(T::Boolean) }
|
121
|
+
def is_const? = which? == Which::Const
|
122
|
+
sig { returns(GroupAnnotation) }
|
123
|
+
def annotation = GroupAnnotation.new(@data, @data_size, @pointers, @pointers_size)
|
124
|
+
|
125
|
+
class GroupAnnotation < Capnp::Struct
|
126
|
+
sig { returns(T.nilable(Schema::Type)) }
|
127
|
+
def type = Schema::Type.from_pointer(read_pointer(3))
|
128
|
+
DEFAULT_TARGETS_FILE = false
|
129
|
+
sig { returns(T::Boolean) }
|
130
|
+
def targets_file = (read_u8(14, 0x00) & 0x1) != 0
|
131
|
+
DEFAULT_TARGETS_CONST = false
|
132
|
+
sig { returns(T::Boolean) }
|
133
|
+
def targets_const = (read_u8(14, 0x00) & 0x2) != 0
|
134
|
+
DEFAULT_TARGETS_ENUM = false
|
135
|
+
sig { returns(T::Boolean) }
|
136
|
+
def targets_enum = (read_u8(14, 0x00) & 0x4) != 0
|
137
|
+
DEFAULT_TARGETS_ENUMERANT = false
|
138
|
+
sig { returns(T::Boolean) }
|
139
|
+
def targets_enumerant = (read_u8(14, 0x00) & 0x8) != 0
|
140
|
+
DEFAULT_TARGETS_STRUCT = false
|
141
|
+
sig { returns(T::Boolean) }
|
142
|
+
def targets_struct = (read_u8(14, 0x00) & 0x10) != 0
|
143
|
+
DEFAULT_TARGETS_FIELD = false
|
144
|
+
sig { returns(T::Boolean) }
|
145
|
+
def targets_field = (read_u8(14, 0x00) & 0x20) != 0
|
146
|
+
DEFAULT_TARGETS_UNION = false
|
147
|
+
sig { returns(T::Boolean) }
|
148
|
+
def targets_union = (read_u8(14, 0x00) & 0x40) != 0
|
149
|
+
DEFAULT_TARGETS_GROUP = false
|
150
|
+
sig { returns(T::Boolean) }
|
151
|
+
def targets_group = (read_u8(14, 0x00) & 0x80) != 0
|
152
|
+
DEFAULT_TARGETS_INTERFACE = false
|
153
|
+
sig { returns(T::Boolean) }
|
154
|
+
def targets_interface = (read_u8(15, 0x00) & 0x1) != 0
|
155
|
+
DEFAULT_TARGETS_METHOD = false
|
156
|
+
sig { returns(T::Boolean) }
|
157
|
+
def targets_method = (read_u8(15, 0x00) & 0x2) != 0
|
158
|
+
DEFAULT_TARGETS_PARAM = false
|
159
|
+
sig { returns(T::Boolean) }
|
160
|
+
def targets_param = (read_u8(15, 0x00) & 0x4) != 0
|
161
|
+
DEFAULT_TARGETS_ANNOTATION = false
|
162
|
+
sig { returns(T::Boolean) }
|
163
|
+
def targets_annotation = (read_u8(15, 0x00) & 0x8) != 0
|
164
|
+
sig { override.returns(Object) }
|
165
|
+
def to_obj
|
166
|
+
res = {}
|
167
|
+
res["type"] = type&.to_obj
|
168
|
+
res["targets_file"] = targets_file
|
169
|
+
res["targets_const"] = targets_const
|
170
|
+
res["targets_enum"] = targets_enum
|
171
|
+
res["targets_enumerant"] = targets_enumerant
|
172
|
+
res["targets_struct"] = targets_struct
|
173
|
+
res["targets_field"] = targets_field
|
174
|
+
res["targets_union"] = targets_union
|
175
|
+
res["targets_group"] = targets_group
|
176
|
+
res["targets_interface"] = targets_interface
|
177
|
+
res["targets_method"] = targets_method
|
178
|
+
res["targets_param"] = targets_param
|
179
|
+
res["targets_annotation"] = targets_annotation
|
180
|
+
res
|
181
|
+
end
|
182
|
+
end
|
183
|
+
sig { returns(T::Boolean) }
|
184
|
+
def is_annotation? = which? == Which::Annotation
|
185
|
+
|
186
|
+
class Parameter < Capnp::Struct
|
187
|
+
DEFAULT_NAME = nil
|
188
|
+
sig { returns(T.nilable(Capnp::String)) }
|
189
|
+
def name = Capnp::BufferString.from_pointer(read_pointer(0))
|
190
|
+
|
191
|
+
class List < Capnp::StructList
|
192
|
+
Elem = type_member { {fixed: Parameter} }
|
193
|
+
sig { override.returns(T.class_of(Parameter)) }
|
194
|
+
def element_class = Parameter
|
195
|
+
end
|
196
|
+
sig { override.returns(Object) }
|
197
|
+
def to_obj
|
198
|
+
res = {}
|
199
|
+
res["name"] = name&.to_obj
|
200
|
+
res
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
class NestedNode < Capnp::Struct
|
205
|
+
DEFAULT_NAME = nil
|
206
|
+
sig { returns(T.nilable(Capnp::String)) }
|
207
|
+
def name = Capnp::BufferString.from_pointer(read_pointer(0))
|
208
|
+
DEFAULT_ID = 0
|
209
|
+
sig { returns(Integer) }
|
210
|
+
def id = read_u64(0, 0)
|
211
|
+
|
212
|
+
class List < Capnp::StructList
|
213
|
+
Elem = type_member { {fixed: NestedNode} }
|
214
|
+
sig { override.returns(T.class_of(NestedNode)) }
|
215
|
+
def element_class = NestedNode
|
216
|
+
end
|
217
|
+
sig { override.returns(Object) }
|
218
|
+
def to_obj
|
219
|
+
res = {}
|
220
|
+
res["name"] = name&.to_obj
|
221
|
+
res["id"] = id
|
222
|
+
res
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
class SourceInfo < Capnp::Struct
|
227
|
+
DEFAULT_ID = 0
|
228
|
+
sig { returns(Integer) }
|
229
|
+
def id = read_u64(0, 0)
|
230
|
+
DEFAULT_DOC_COMMENT = nil
|
231
|
+
sig { returns(T.nilable(Capnp::String)) }
|
232
|
+
def doc_comment = Capnp::BufferString.from_pointer(read_pointer(0))
|
233
|
+
sig { returns(T.nilable(Capnp::List[Schema::Node::SourceInfo::Member])) }
|
234
|
+
def members = Schema::Node::SourceInfo::Member::List.from_pointer(read_pointer(1))
|
235
|
+
|
236
|
+
class Member < Capnp::Struct
|
237
|
+
DEFAULT_DOC_COMMENT = nil
|
238
|
+
sig { returns(T.nilable(Capnp::String)) }
|
239
|
+
def doc_comment = Capnp::BufferString.from_pointer(read_pointer(0))
|
240
|
+
|
241
|
+
class List < Capnp::StructList
|
242
|
+
Elem = type_member { {fixed: Member} }
|
243
|
+
sig { override.returns(T.class_of(Member)) }
|
244
|
+
def element_class = Member
|
245
|
+
end
|
246
|
+
sig { override.returns(Object) }
|
247
|
+
def to_obj
|
248
|
+
res = {}
|
249
|
+
res["doc_comment"] = doc_comment&.to_obj
|
250
|
+
res
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
class List < Capnp::StructList
|
255
|
+
Elem = type_member { {fixed: SourceInfo} }
|
256
|
+
sig { override.returns(T.class_of(SourceInfo)) }
|
257
|
+
def element_class = SourceInfo
|
258
|
+
end
|
259
|
+
sig { override.returns(Object) }
|
260
|
+
def to_obj
|
261
|
+
res = {}
|
262
|
+
res["id"] = id
|
263
|
+
res["doc_comment"] = doc_comment&.to_obj
|
264
|
+
res["members"] = members&.to_obj
|
265
|
+
res
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
269
|
+
class List < Capnp::StructList
|
270
|
+
Elem = type_member { {fixed: Node} }
|
271
|
+
sig { override.returns(T.class_of(Node)) }
|
272
|
+
def element_class = Node
|
273
|
+
end
|
274
|
+
sig { returns(Which) }
|
275
|
+
def which? = Which.from_integer(read_u16(12, 0))
|
276
|
+
|
277
|
+
class Which < T::Enum
|
278
|
+
extend T::Sig
|
279
|
+
enums do
|
280
|
+
File = new("file")
|
281
|
+
Struct = new("struct")
|
282
|
+
Enum = new("enum")
|
283
|
+
Interface = new("interface")
|
284
|
+
Const = new("const")
|
285
|
+
Annotation = new("annotation")
|
286
|
+
end
|
287
|
+
sig { params(value: Integer).returns(Which) }
|
288
|
+
def self.from_integer(value)
|
289
|
+
case value
|
290
|
+
when 0 then File
|
291
|
+
when 1 then Struct
|
292
|
+
when 2 then Enum
|
293
|
+
when 3 then Interface
|
294
|
+
when 4 then Const
|
295
|
+
when 5 then Annotation
|
296
|
+
else raise "Unknown Which value: #{value}"
|
297
|
+
end
|
298
|
+
end
|
299
|
+
end
|
300
|
+
sig { override.returns(Object) }
|
301
|
+
def to_obj
|
302
|
+
res = {}
|
303
|
+
res["id"] = id
|
304
|
+
res["display_name"] = display_name&.to_obj
|
305
|
+
res["display_name_prefix_length"] = display_name_prefix_length
|
306
|
+
res["scope_id"] = scope_id
|
307
|
+
res["parameters"] = parameters&.to_obj
|
308
|
+
res["is_generic"] = is_generic
|
309
|
+
res["nested_nodes"] = nested_nodes&.to_obj
|
310
|
+
res["annotations"] = annotations&.to_obj
|
311
|
+
case which?
|
312
|
+
when Which::File then res["file"] = file
|
313
|
+
when Which::Struct then res["struct"] = struct.to_obj
|
314
|
+
when Which::Enum then res["enum"] = enum.to_obj
|
315
|
+
when Which::Interface then res["interface"] = interface.to_obj
|
316
|
+
when Which::Const then res["const"] = const.to_obj
|
317
|
+
when Which::Annotation then res["annotation"] = annotation.to_obj
|
318
|
+
end
|
319
|
+
res
|
320
|
+
end
|
321
|
+
end
|
322
|
+
|
323
|
+
class Field < Capnp::Struct
|
324
|
+
DEFAULT_NAME = nil
|
325
|
+
sig { returns(T.nilable(Capnp::String)) }
|
326
|
+
def name = Capnp::BufferString.from_pointer(read_pointer(0))
|
327
|
+
DEFAULT_CODE_ORDER = 0
|
328
|
+
sig { returns(Integer) }
|
329
|
+
def code_order = read_u16(0, 0)
|
330
|
+
sig { returns(T.nilable(Capnp::List[Schema::Annotation])) }
|
331
|
+
def annotations = Schema::Annotation::List.from_pointer(read_pointer(1))
|
332
|
+
DEFAULT_DISCRIMINANT_VALUE = 65535
|
333
|
+
sig { returns(Integer) }
|
334
|
+
def discriminant_value = read_u16(2, 65535)
|
335
|
+
sig { returns(GroupSlot) }
|
336
|
+
def slot = GroupSlot.new(@data, @data_size, @pointers, @pointers_size)
|
337
|
+
|
338
|
+
class GroupSlot < Capnp::Struct
|
339
|
+
DEFAULT_OFFSET = 0
|
340
|
+
sig { returns(Integer) }
|
341
|
+
def offset = read_u32(4, 0)
|
342
|
+
sig { returns(T.nilable(Schema::Type)) }
|
343
|
+
def type = Schema::Type.from_pointer(read_pointer(2))
|
344
|
+
sig { returns(T.nilable(Schema::Value)) }
|
345
|
+
def default_value = Schema::Value.from_pointer(read_pointer(3))
|
346
|
+
DEFAULT_HAD_EXPLICIT_DEFAULT = false
|
347
|
+
sig { returns(T::Boolean) }
|
348
|
+
def had_explicit_default = (read_u8(16, 0x00) & 0x1) != 0
|
349
|
+
sig { override.returns(Object) }
|
350
|
+
def to_obj
|
351
|
+
res = {}
|
352
|
+
res["offset"] = offset
|
353
|
+
res["type"] = type&.to_obj
|
354
|
+
res["default_value"] = default_value&.to_obj
|
355
|
+
res["had_explicit_default"] = had_explicit_default
|
356
|
+
res
|
357
|
+
end
|
358
|
+
end
|
359
|
+
sig { returns(T::Boolean) }
|
360
|
+
def is_slot? = which? == Which::Slot
|
361
|
+
sig { returns(GroupGroup) }
|
362
|
+
def group = GroupGroup.new(@data, @data_size, @pointers, @pointers_size)
|
363
|
+
|
364
|
+
class GroupGroup < Capnp::Struct
|
365
|
+
DEFAULT_TYPE_ID = 0
|
366
|
+
sig { returns(Integer) }
|
367
|
+
def type_id = read_u64(16, 0)
|
368
|
+
sig { override.returns(Object) }
|
369
|
+
def to_obj
|
370
|
+
res = {}
|
371
|
+
res["type_id"] = type_id
|
372
|
+
res
|
373
|
+
end
|
374
|
+
end
|
375
|
+
sig { returns(T::Boolean) }
|
376
|
+
def is_group? = which? == Which::Group
|
377
|
+
sig { returns(GroupOrdinal) }
|
378
|
+
def ordinal = GroupOrdinal.new(@data, @data_size, @pointers, @pointers_size)
|
379
|
+
|
380
|
+
class GroupOrdinal < Capnp::Struct
|
381
|
+
sig { returns(NilClass) }
|
382
|
+
def implicit = nil
|
383
|
+
sig { returns(T::Boolean) }
|
384
|
+
def is_implicit? = which? == Which::Implicit
|
385
|
+
DEFAULT_EXPLICIT = 0
|
386
|
+
sig { returns(Integer) }
|
387
|
+
def explicit = read_u16(12, 0)
|
388
|
+
sig { returns(T::Boolean) }
|
389
|
+
def is_explicit? = which? == Which::Explicit
|
390
|
+
sig { returns(Which) }
|
391
|
+
def which? = Which.from_integer(read_u16(10, 0))
|
392
|
+
|
393
|
+
class Which < T::Enum
|
394
|
+
extend T::Sig
|
395
|
+
enums do
|
396
|
+
Implicit = new("implicit")
|
397
|
+
Explicit = new("explicit")
|
398
|
+
end
|
399
|
+
sig { params(value: Integer).returns(Which) }
|
400
|
+
def self.from_integer(value)
|
401
|
+
case value
|
402
|
+
when 0 then Implicit
|
403
|
+
when 1 then Explicit
|
404
|
+
else raise "Unknown Which value: #{value}"
|
405
|
+
end
|
406
|
+
end
|
407
|
+
end
|
408
|
+
sig { override.returns(Object) }
|
409
|
+
def to_obj
|
410
|
+
res = {}
|
411
|
+
case which?
|
412
|
+
when Which::Implicit then res["implicit"] = implicit
|
413
|
+
when Which::Explicit then res["explicit"] = explicit
|
414
|
+
end
|
415
|
+
res
|
416
|
+
end
|
417
|
+
end
|
418
|
+
NO_DISCRIMINANT = 65535
|
419
|
+
|
420
|
+
class List < Capnp::StructList
|
421
|
+
Elem = type_member { {fixed: Field} }
|
422
|
+
sig { override.returns(T.class_of(Field)) }
|
423
|
+
def element_class = Field
|
424
|
+
end
|
425
|
+
sig { returns(Which) }
|
426
|
+
def which? = Which.from_integer(read_u16(8, 0))
|
427
|
+
|
428
|
+
class Which < T::Enum
|
429
|
+
extend T::Sig
|
430
|
+
enums do
|
431
|
+
Slot = new("slot")
|
432
|
+
Group = new("group")
|
433
|
+
end
|
434
|
+
sig { params(value: Integer).returns(Which) }
|
435
|
+
def self.from_integer(value)
|
436
|
+
case value
|
437
|
+
when 0 then Slot
|
438
|
+
when 1 then Group
|
439
|
+
else raise "Unknown Which value: #{value}"
|
440
|
+
end
|
441
|
+
end
|
442
|
+
end
|
443
|
+
sig { override.returns(Object) }
|
444
|
+
def to_obj
|
445
|
+
res = {}
|
446
|
+
res["name"] = name&.to_obj
|
447
|
+
res["code_order"] = code_order
|
448
|
+
res["annotations"] = annotations&.to_obj
|
449
|
+
res["discriminant_value"] = discriminant_value
|
450
|
+
res["ordinal"] = ordinal.to_obj
|
451
|
+
case which?
|
452
|
+
when Which::Slot then res["slot"] = slot.to_obj
|
453
|
+
when Which::Group then res["group"] = group.to_obj
|
454
|
+
end
|
455
|
+
res
|
456
|
+
end
|
457
|
+
end
|
458
|
+
|
459
|
+
class Enumerant < Capnp::Struct
|
460
|
+
DEFAULT_NAME = nil
|
461
|
+
sig { returns(T.nilable(Capnp::String)) }
|
462
|
+
def name = Capnp::BufferString.from_pointer(read_pointer(0))
|
463
|
+
DEFAULT_CODE_ORDER = 0
|
464
|
+
sig { returns(Integer) }
|
465
|
+
def code_order = read_u16(0, 0)
|
466
|
+
sig { returns(T.nilable(Capnp::List[Schema::Annotation])) }
|
467
|
+
def annotations = Schema::Annotation::List.from_pointer(read_pointer(1))
|
468
|
+
|
469
|
+
class List < Capnp::StructList
|
470
|
+
Elem = type_member { {fixed: Enumerant} }
|
471
|
+
sig { override.returns(T.class_of(Enumerant)) }
|
472
|
+
def element_class = Enumerant
|
473
|
+
end
|
474
|
+
sig { override.returns(Object) }
|
475
|
+
def to_obj
|
476
|
+
res = {}
|
477
|
+
res["name"] = name&.to_obj
|
478
|
+
res["code_order"] = code_order
|
479
|
+
res["annotations"] = annotations&.to_obj
|
480
|
+
res
|
481
|
+
end
|
482
|
+
end
|
483
|
+
|
484
|
+
class Superclass < Capnp::Struct
|
485
|
+
DEFAULT_ID = 0
|
486
|
+
sig { returns(Integer) }
|
487
|
+
def id = read_u64(0, 0)
|
488
|
+
sig { returns(T.nilable(Schema::Brand)) }
|
489
|
+
def brand = Schema::Brand.from_pointer(read_pointer(0))
|
490
|
+
|
491
|
+
class List < Capnp::StructList
|
492
|
+
Elem = type_member { {fixed: Superclass} }
|
493
|
+
sig { override.returns(T.class_of(Superclass)) }
|
494
|
+
def element_class = Superclass
|
495
|
+
end
|
496
|
+
sig { override.returns(Object) }
|
497
|
+
def to_obj
|
498
|
+
res = {}
|
499
|
+
res["id"] = id
|
500
|
+
res["brand"] = brand&.to_obj
|
501
|
+
res
|
502
|
+
end
|
503
|
+
end
|
504
|
+
|
505
|
+
class Method < Capnp::Struct
|
506
|
+
DEFAULT_NAME = nil
|
507
|
+
sig { returns(T.nilable(Capnp::String)) }
|
508
|
+
def name = Capnp::BufferString.from_pointer(read_pointer(0))
|
509
|
+
DEFAULT_CODE_ORDER = 0
|
510
|
+
sig { returns(Integer) }
|
511
|
+
def code_order = read_u16(0, 0)
|
512
|
+
sig { returns(T.nilable(Capnp::List[Schema::Node::Parameter])) }
|
513
|
+
def implicit_parameters = Schema::Node::Parameter::List.from_pointer(read_pointer(4))
|
514
|
+
DEFAULT_PARAM_STRUCT_TYPE = 0
|
515
|
+
sig { returns(Integer) }
|
516
|
+
def param_struct_type = read_u64(8, 0)
|
517
|
+
sig { returns(T.nilable(Schema::Brand)) }
|
518
|
+
def param_brand = Schema::Brand.from_pointer(read_pointer(2))
|
519
|
+
DEFAULT_RESULT_STRUCT_TYPE = 0
|
520
|
+
sig { returns(Integer) }
|
521
|
+
def result_struct_type = read_u64(16, 0)
|
522
|
+
sig { returns(T.nilable(Schema::Brand)) }
|
523
|
+
def result_brand = Schema::Brand.from_pointer(read_pointer(3))
|
524
|
+
sig { returns(T.nilable(Capnp::List[Schema::Annotation])) }
|
525
|
+
def annotations = Schema::Annotation::List.from_pointer(read_pointer(1))
|
526
|
+
|
527
|
+
class List < Capnp::StructList
|
528
|
+
Elem = type_member { {fixed: Method} }
|
529
|
+
sig { override.returns(T.class_of(Method)) }
|
530
|
+
def element_class = Method
|
531
|
+
end
|
532
|
+
sig { override.returns(Object) }
|
533
|
+
def to_obj
|
534
|
+
res = {}
|
535
|
+
res["name"] = name&.to_obj
|
536
|
+
res["code_order"] = code_order
|
537
|
+
res["implicit_parameters"] = implicit_parameters&.to_obj
|
538
|
+
res["param_struct_type"] = param_struct_type
|
539
|
+
res["param_brand"] = param_brand&.to_obj
|
540
|
+
res["result_struct_type"] = result_struct_type
|
541
|
+
res["result_brand"] = result_brand&.to_obj
|
542
|
+
res["annotations"] = annotations&.to_obj
|
543
|
+
res
|
544
|
+
end
|
545
|
+
end
|
546
|
+
|
547
|
+
class Type < Capnp::Struct
|
548
|
+
sig { returns(NilClass) }
|
549
|
+
def void = nil
|
550
|
+
sig { returns(T::Boolean) }
|
551
|
+
def is_void? = which? == Which::Void
|
552
|
+
sig { returns(NilClass) }
|
553
|
+
def bool = nil
|
554
|
+
sig { returns(T::Boolean) }
|
555
|
+
def is_bool? = which? == Which::Bool
|
556
|
+
sig { returns(NilClass) }
|
557
|
+
def int8 = nil
|
558
|
+
sig { returns(T::Boolean) }
|
559
|
+
def is_int8? = which? == Which::Int8
|
560
|
+
sig { returns(NilClass) }
|
561
|
+
def int16 = nil
|
562
|
+
sig { returns(T::Boolean) }
|
563
|
+
def is_int16? = which? == Which::Int16
|
564
|
+
sig { returns(NilClass) }
|
565
|
+
def int32 = nil
|
566
|
+
sig { returns(T::Boolean) }
|
567
|
+
def is_int32? = which? == Which::Int32
|
568
|
+
sig { returns(NilClass) }
|
569
|
+
def int64 = nil
|
570
|
+
sig { returns(T::Boolean) }
|
571
|
+
def is_int64? = which? == Which::Int64
|
572
|
+
sig { returns(NilClass) }
|
573
|
+
def uint8 = nil
|
574
|
+
sig { returns(T::Boolean) }
|
575
|
+
def is_uint8? = which? == Which::Uint8
|
576
|
+
sig { returns(NilClass) }
|
577
|
+
def uint16 = nil
|
578
|
+
sig { returns(T::Boolean) }
|
579
|
+
def is_uint16? = which? == Which::Uint16
|
580
|
+
sig { returns(NilClass) }
|
581
|
+
def uint32 = nil
|
582
|
+
sig { returns(T::Boolean) }
|
583
|
+
def is_uint32? = which? == Which::Uint32
|
584
|
+
sig { returns(NilClass) }
|
585
|
+
def uint64 = nil
|
586
|
+
sig { returns(T::Boolean) }
|
587
|
+
def is_uint64? = which? == Which::Uint64
|
588
|
+
sig { returns(NilClass) }
|
589
|
+
def float32 = nil
|
590
|
+
sig { returns(T::Boolean) }
|
591
|
+
def is_float32? = which? == Which::Float32
|
592
|
+
sig { returns(NilClass) }
|
593
|
+
def float64 = nil
|
594
|
+
sig { returns(T::Boolean) }
|
595
|
+
def is_float64? = which? == Which::Float64
|
596
|
+
sig { returns(NilClass) }
|
597
|
+
def text = nil
|
598
|
+
sig { returns(T::Boolean) }
|
599
|
+
def is_text? = which? == Which::Text
|
600
|
+
sig { returns(NilClass) }
|
601
|
+
def data = nil
|
602
|
+
sig { returns(T::Boolean) }
|
603
|
+
def is_data? = which? == Which::Data
|
604
|
+
sig { returns(GroupList) }
|
605
|
+
def list = GroupList.new(@data, @data_size, @pointers, @pointers_size)
|
606
|
+
|
607
|
+
class GroupList < Capnp::Struct
|
608
|
+
sig { returns(T.nilable(Schema::Type)) }
|
609
|
+
def element_type = Schema::Type.from_pointer(read_pointer(0))
|
610
|
+
sig { override.returns(Object) }
|
611
|
+
def to_obj
|
612
|
+
res = {}
|
613
|
+
res["element_type"] = element_type&.to_obj
|
614
|
+
res
|
615
|
+
end
|
616
|
+
end
|
617
|
+
sig { returns(T::Boolean) }
|
618
|
+
def is_list? = which? == Which::List
|
619
|
+
sig { returns(GroupEnum) }
|
620
|
+
def enum = GroupEnum.new(@data, @data_size, @pointers, @pointers_size)
|
621
|
+
|
622
|
+
class GroupEnum < Capnp::Struct
|
623
|
+
DEFAULT_TYPE_ID = 0
|
624
|
+
sig { returns(Integer) }
|
625
|
+
def type_id = read_u64(8, 0)
|
626
|
+
sig { returns(T.nilable(Schema::Brand)) }
|
627
|
+
def brand = Schema::Brand.from_pointer(read_pointer(0))
|
628
|
+
sig { override.returns(Object) }
|
629
|
+
def to_obj
|
630
|
+
res = {}
|
631
|
+
res["type_id"] = type_id
|
632
|
+
res["brand"] = brand&.to_obj
|
633
|
+
res
|
634
|
+
end
|
635
|
+
end
|
636
|
+
sig { returns(T::Boolean) }
|
637
|
+
def is_enum? = which? == Which::Enum
|
638
|
+
sig { returns(GroupStruct) }
|
639
|
+
def struct = GroupStruct.new(@data, @data_size, @pointers, @pointers_size)
|
640
|
+
|
641
|
+
class GroupStruct < Capnp::Struct
|
642
|
+
DEFAULT_TYPE_ID = 0
|
643
|
+
sig { returns(Integer) }
|
644
|
+
def type_id = read_u64(8, 0)
|
645
|
+
sig { returns(T.nilable(Schema::Brand)) }
|
646
|
+
def brand = Schema::Brand.from_pointer(read_pointer(0))
|
647
|
+
sig { override.returns(Object) }
|
648
|
+
def to_obj
|
649
|
+
res = {}
|
650
|
+
res["type_id"] = type_id
|
651
|
+
res["brand"] = brand&.to_obj
|
652
|
+
res
|
653
|
+
end
|
654
|
+
end
|
655
|
+
sig { returns(T::Boolean) }
|
656
|
+
def is_struct? = which? == Which::Struct
|
657
|
+
sig { returns(GroupInterface) }
|
658
|
+
def interface = GroupInterface.new(@data, @data_size, @pointers, @pointers_size)
|
659
|
+
|
660
|
+
class GroupInterface < Capnp::Struct
|
661
|
+
DEFAULT_TYPE_ID = 0
|
662
|
+
sig { returns(Integer) }
|
663
|
+
def type_id = read_u64(8, 0)
|
664
|
+
sig { returns(T.nilable(Schema::Brand)) }
|
665
|
+
def brand = Schema::Brand.from_pointer(read_pointer(0))
|
666
|
+
sig { override.returns(Object) }
|
667
|
+
def to_obj
|
668
|
+
res = {}
|
669
|
+
res["type_id"] = type_id
|
670
|
+
res["brand"] = brand&.to_obj
|
671
|
+
res
|
672
|
+
end
|
673
|
+
end
|
674
|
+
sig { returns(T::Boolean) }
|
675
|
+
def is_interface? = which? == Which::Interface
|
676
|
+
sig { returns(GroupAnyPointer) }
|
677
|
+
def any_pointer = GroupAnyPointer.new(@data, @data_size, @pointers, @pointers_size)
|
678
|
+
|
679
|
+
class GroupAnyPointer < Capnp::Struct
|
680
|
+
sig { returns(GroupUnconstrained) }
|
681
|
+
def unconstrained = GroupUnconstrained.new(@data, @data_size, @pointers, @pointers_size)
|
682
|
+
|
683
|
+
class GroupUnconstrained < Capnp::Struct
|
684
|
+
sig { returns(NilClass) }
|
685
|
+
def any_kind = nil
|
686
|
+
sig { returns(T::Boolean) }
|
687
|
+
def is_any_kind? = which? == Which::AnyKind
|
688
|
+
sig { returns(NilClass) }
|
689
|
+
def struct = nil
|
690
|
+
sig { returns(T::Boolean) }
|
691
|
+
def is_struct? = which? == Which::Struct
|
692
|
+
sig { returns(NilClass) }
|
693
|
+
def list = nil
|
694
|
+
sig { returns(T::Boolean) }
|
695
|
+
def is_list? = which? == Which::List
|
696
|
+
sig { returns(NilClass) }
|
697
|
+
def capability = nil
|
698
|
+
sig { returns(T::Boolean) }
|
699
|
+
def is_capability? = which? == Which::Capability
|
700
|
+
sig { returns(Which) }
|
701
|
+
def which? = Which.from_integer(read_u16(10, 0))
|
702
|
+
|
703
|
+
class Which < T::Enum
|
704
|
+
extend T::Sig
|
705
|
+
enums do
|
706
|
+
AnyKind = new("anyKind")
|
707
|
+
Struct = new("struct")
|
708
|
+
List = new("list")
|
709
|
+
Capability = new("capability")
|
710
|
+
end
|
711
|
+
sig { params(value: Integer).returns(Which) }
|
712
|
+
def self.from_integer(value)
|
713
|
+
case value
|
714
|
+
when 0 then AnyKind
|
715
|
+
when 1 then Struct
|
716
|
+
when 2 then List
|
717
|
+
when 3 then Capability
|
718
|
+
else raise "Unknown Which value: #{value}"
|
719
|
+
end
|
720
|
+
end
|
721
|
+
end
|
722
|
+
sig { override.returns(Object) }
|
723
|
+
def to_obj
|
724
|
+
res = {}
|
725
|
+
case which?
|
726
|
+
when Which::AnyKind then res["any_kind"] = any_kind
|
727
|
+
when Which::Struct then res["struct"] = struct
|
728
|
+
when Which::List then res["list"] = list
|
729
|
+
when Which::Capability then res["capability"] = capability
|
730
|
+
end
|
731
|
+
res
|
732
|
+
end
|
733
|
+
end
|
734
|
+
sig { returns(T::Boolean) }
|
735
|
+
def is_unconstrained? = which? == Which::Unconstrained
|
736
|
+
sig { returns(GroupParameter) }
|
737
|
+
def parameter = GroupParameter.new(@data, @data_size, @pointers, @pointers_size)
|
738
|
+
|
739
|
+
class GroupParameter < Capnp::Struct
|
740
|
+
DEFAULT_SCOPE_ID = 0
|
741
|
+
sig { returns(Integer) }
|
742
|
+
def scope_id = read_u64(16, 0)
|
743
|
+
DEFAULT_PARAMETER_INDEX = 0
|
744
|
+
sig { returns(Integer) }
|
745
|
+
def parameter_index = read_u16(10, 0)
|
746
|
+
sig { override.returns(Object) }
|
747
|
+
def to_obj
|
748
|
+
res = {}
|
749
|
+
res["scope_id"] = scope_id
|
750
|
+
res["parameter_index"] = parameter_index
|
751
|
+
res
|
752
|
+
end
|
753
|
+
end
|
754
|
+
sig { returns(T::Boolean) }
|
755
|
+
def is_parameter? = which? == Which::Parameter
|
756
|
+
sig { returns(GroupImplicitMethodParameter) }
|
757
|
+
def implicit_method_parameter = GroupImplicitMethodParameter.new(@data, @data_size, @pointers, @pointers_size)
|
758
|
+
|
759
|
+
class GroupImplicitMethodParameter < Capnp::Struct
|
760
|
+
DEFAULT_PARAMETER_INDEX = 0
|
761
|
+
sig { returns(Integer) }
|
762
|
+
def parameter_index = read_u16(10, 0)
|
763
|
+
sig { override.returns(Object) }
|
764
|
+
def to_obj
|
765
|
+
res = {}
|
766
|
+
res["parameter_index"] = parameter_index
|
767
|
+
res
|
768
|
+
end
|
769
|
+
end
|
770
|
+
sig { returns(T::Boolean) }
|
771
|
+
def is_implicit_method_parameter? = which? == Which::ImplicitMethodParameter
|
772
|
+
sig { returns(Which) }
|
773
|
+
def which? = Which.from_integer(read_u16(8, 0))
|
774
|
+
|
775
|
+
class Which < T::Enum
|
776
|
+
extend T::Sig
|
777
|
+
enums do
|
778
|
+
Unconstrained = new("unconstrained")
|
779
|
+
Parameter = new("parameter")
|
780
|
+
ImplicitMethodParameter = new("implicitMethodParameter")
|
781
|
+
end
|
782
|
+
sig { params(value: Integer).returns(Which) }
|
783
|
+
def self.from_integer(value)
|
784
|
+
case value
|
785
|
+
when 0 then Unconstrained
|
786
|
+
when 1 then Parameter
|
787
|
+
when 2 then ImplicitMethodParameter
|
788
|
+
else raise "Unknown Which value: #{value}"
|
789
|
+
end
|
790
|
+
end
|
791
|
+
end
|
792
|
+
sig { override.returns(Object) }
|
793
|
+
def to_obj
|
794
|
+
res = {}
|
795
|
+
case which?
|
796
|
+
when Which::Unconstrained then res["unconstrained"] = unconstrained.to_obj
|
797
|
+
when Which::Parameter then res["parameter"] = parameter.to_obj
|
798
|
+
when Which::ImplicitMethodParameter then res["implicit_method_parameter"] = implicit_method_parameter.to_obj
|
799
|
+
end
|
800
|
+
res
|
801
|
+
end
|
802
|
+
end
|
803
|
+
sig { returns(T::Boolean) }
|
804
|
+
def is_any_pointer? = which? == Which::AnyPointer
|
805
|
+
|
806
|
+
class List < Capnp::StructList
|
807
|
+
Elem = type_member { {fixed: Type} }
|
808
|
+
sig { override.returns(T.class_of(Type)) }
|
809
|
+
def element_class = Type
|
810
|
+
end
|
811
|
+
sig { returns(Which) }
|
812
|
+
def which? = Which.from_integer(read_u16(0, 0))
|
813
|
+
|
814
|
+
class Which < T::Enum
|
815
|
+
extend T::Sig
|
816
|
+
enums do
|
817
|
+
Void = new("void")
|
818
|
+
Bool = new("bool")
|
819
|
+
Int8 = new("int8")
|
820
|
+
Int16 = new("int16")
|
821
|
+
Int32 = new("int32")
|
822
|
+
Int64 = new("int64")
|
823
|
+
Uint8 = new("uint8")
|
824
|
+
Uint16 = new("uint16")
|
825
|
+
Uint32 = new("uint32")
|
826
|
+
Uint64 = new("uint64")
|
827
|
+
Float32 = new("float32")
|
828
|
+
Float64 = new("float64")
|
829
|
+
Text = new("text")
|
830
|
+
Data = new("data")
|
831
|
+
List = new("list")
|
832
|
+
Enum = new("enum")
|
833
|
+
Struct = new("struct")
|
834
|
+
Interface = new("interface")
|
835
|
+
AnyPointer = new("anyPointer")
|
836
|
+
end
|
837
|
+
sig { params(value: Integer).returns(Which) }
|
838
|
+
def self.from_integer(value)
|
839
|
+
case value
|
840
|
+
when 0 then Void
|
841
|
+
when 1 then Bool
|
842
|
+
when 2 then Int8
|
843
|
+
when 3 then Int16
|
844
|
+
when 4 then Int32
|
845
|
+
when 5 then Int64
|
846
|
+
when 6 then Uint8
|
847
|
+
when 7 then Uint16
|
848
|
+
when 8 then Uint32
|
849
|
+
when 9 then Uint64
|
850
|
+
when 10 then Float32
|
851
|
+
when 11 then Float64
|
852
|
+
when 12 then Text
|
853
|
+
when 13 then Data
|
854
|
+
when 14 then List
|
855
|
+
when 15 then Enum
|
856
|
+
when 16 then Struct
|
857
|
+
when 17 then Interface
|
858
|
+
when 18 then AnyPointer
|
859
|
+
else raise "Unknown Which value: #{value}"
|
860
|
+
end
|
861
|
+
end
|
862
|
+
end
|
863
|
+
sig { override.returns(Object) }
|
864
|
+
def to_obj
|
865
|
+
res = {}
|
866
|
+
case which?
|
867
|
+
when Which::Void then res["void"] = void
|
868
|
+
when Which::Bool then res["bool"] = bool
|
869
|
+
when Which::Int8 then res["int8"] = int8
|
870
|
+
when Which::Int16 then res["int16"] = int16
|
871
|
+
when Which::Int32 then res["int32"] = int32
|
872
|
+
when Which::Int64 then res["int64"] = int64
|
873
|
+
when Which::Uint8 then res["uint8"] = uint8
|
874
|
+
when Which::Uint16 then res["uint16"] = uint16
|
875
|
+
when Which::Uint32 then res["uint32"] = uint32
|
876
|
+
when Which::Uint64 then res["uint64"] = uint64
|
877
|
+
when Which::Float32 then res["float32"] = float32
|
878
|
+
when Which::Float64 then res["float64"] = float64
|
879
|
+
when Which::Text then res["text"] = text
|
880
|
+
when Which::Data then res["data"] = data
|
881
|
+
when Which::List then res["list"] = list.to_obj
|
882
|
+
when Which::Enum then res["enum"] = enum.to_obj
|
883
|
+
when Which::Struct then res["struct"] = struct.to_obj
|
884
|
+
when Which::Interface then res["interface"] = interface.to_obj
|
885
|
+
when Which::AnyPointer then res["any_pointer"] = any_pointer.to_obj
|
886
|
+
end
|
887
|
+
res
|
888
|
+
end
|
889
|
+
end
|
890
|
+
|
891
|
+
class Brand < Capnp::Struct
|
892
|
+
sig { returns(T.nilable(Capnp::List[Schema::Brand::Scope])) }
|
893
|
+
def scopes = Schema::Brand::Scope::List.from_pointer(read_pointer(0))
|
894
|
+
|
895
|
+
class Scope < Capnp::Struct
|
896
|
+
DEFAULT_SCOPE_ID = 0
|
897
|
+
sig { returns(Integer) }
|
898
|
+
def scope_id = read_u64(0, 0)
|
899
|
+
sig { returns(T.nilable(Capnp::List[Schema::Brand::Binding])) }
|
900
|
+
def bind = Schema::Brand::Binding::List.from_pointer(read_pointer(0))
|
901
|
+
sig { returns(T::Boolean) }
|
902
|
+
def is_bind? = which? == Which::Bind
|
903
|
+
sig { returns(NilClass) }
|
904
|
+
def inherit = nil
|
905
|
+
sig { returns(T::Boolean) }
|
906
|
+
def is_inherit? = which? == Which::Inherit
|
907
|
+
|
908
|
+
class List < Capnp::StructList
|
909
|
+
Elem = type_member { {fixed: Scope} }
|
910
|
+
sig { override.returns(T.class_of(Scope)) }
|
911
|
+
def element_class = Scope
|
912
|
+
end
|
913
|
+
sig { returns(Which) }
|
914
|
+
def which? = Which.from_integer(read_u16(8, 0))
|
915
|
+
|
916
|
+
class Which < T::Enum
|
917
|
+
extend T::Sig
|
918
|
+
enums do
|
919
|
+
Bind = new("bind")
|
920
|
+
Inherit = new("inherit")
|
921
|
+
end
|
922
|
+
sig { params(value: Integer).returns(Which) }
|
923
|
+
def self.from_integer(value)
|
924
|
+
case value
|
925
|
+
when 0 then Bind
|
926
|
+
when 1 then Inherit
|
927
|
+
else raise "Unknown Which value: #{value}"
|
928
|
+
end
|
929
|
+
end
|
930
|
+
end
|
931
|
+
sig { override.returns(Object) }
|
932
|
+
def to_obj
|
933
|
+
res = {}
|
934
|
+
res["scope_id"] = scope_id
|
935
|
+
case which?
|
936
|
+
when Which::Bind then res["bind"] = bind&.to_obj
|
937
|
+
when Which::Inherit then res["inherit"] = inherit
|
938
|
+
end
|
939
|
+
res
|
940
|
+
end
|
941
|
+
end
|
942
|
+
|
943
|
+
class Binding < Capnp::Struct
|
944
|
+
sig { returns(NilClass) }
|
945
|
+
def unbound = nil
|
946
|
+
sig { returns(T::Boolean) }
|
947
|
+
def is_unbound? = which? == Which::Unbound
|
948
|
+
sig { returns(T.nilable(Schema::Type)) }
|
949
|
+
def type = Schema::Type.from_pointer(read_pointer(0))
|
950
|
+
sig { returns(T::Boolean) }
|
951
|
+
def is_type? = which? == Which::Type
|
952
|
+
|
953
|
+
class List < Capnp::StructList
|
954
|
+
Elem = type_member { {fixed: Binding} }
|
955
|
+
sig { override.returns(T.class_of(Binding)) }
|
956
|
+
def element_class = Binding
|
957
|
+
end
|
958
|
+
sig { returns(Which) }
|
959
|
+
def which? = Which.from_integer(read_u16(0, 0))
|
960
|
+
|
961
|
+
class Which < T::Enum
|
962
|
+
extend T::Sig
|
963
|
+
enums do
|
964
|
+
Unbound = new("unbound")
|
965
|
+
Type = new("type")
|
966
|
+
end
|
967
|
+
sig { params(value: Integer).returns(Which) }
|
968
|
+
def self.from_integer(value)
|
969
|
+
case value
|
970
|
+
when 0 then Unbound
|
971
|
+
when 1 then Type
|
972
|
+
else raise "Unknown Which value: #{value}"
|
973
|
+
end
|
974
|
+
end
|
975
|
+
end
|
976
|
+
sig { override.returns(Object) }
|
977
|
+
def to_obj
|
978
|
+
res = {}
|
979
|
+
case which?
|
980
|
+
when Which::Unbound then res["unbound"] = unbound
|
981
|
+
when Which::Type then res["type"] = type&.to_obj
|
982
|
+
end
|
983
|
+
res
|
984
|
+
end
|
985
|
+
end
|
986
|
+
|
987
|
+
class List < Capnp::StructList
|
988
|
+
Elem = type_member { {fixed: Brand} }
|
989
|
+
sig { override.returns(T.class_of(Brand)) }
|
990
|
+
def element_class = Brand
|
991
|
+
end
|
992
|
+
sig { override.returns(Object) }
|
993
|
+
def to_obj
|
994
|
+
res = {}
|
995
|
+
res["scopes"] = scopes&.to_obj
|
996
|
+
res
|
997
|
+
end
|
998
|
+
end
|
999
|
+
|
1000
|
+
class Value < Capnp::Struct
|
1001
|
+
sig { returns(NilClass) }
|
1002
|
+
def void = nil
|
1003
|
+
sig { returns(T::Boolean) }
|
1004
|
+
def is_void? = which? == Which::Void
|
1005
|
+
DEFAULT_BOOL = false
|
1006
|
+
sig { returns(T::Boolean) }
|
1007
|
+
def bool = (read_u8(2, 0x00) & 0x1) != 0
|
1008
|
+
sig { returns(T::Boolean) }
|
1009
|
+
def is_bool? = which? == Which::Bool
|
1010
|
+
DEFAULT_INT8 = 0
|
1011
|
+
sig { returns(Integer) }
|
1012
|
+
def int8 = read_s8(2, 0)
|
1013
|
+
sig { returns(T::Boolean) }
|
1014
|
+
def is_int8? = which? == Which::Int8
|
1015
|
+
DEFAULT_INT16 = 0
|
1016
|
+
sig { returns(Integer) }
|
1017
|
+
def int16 = read_s16(2, 0)
|
1018
|
+
sig { returns(T::Boolean) }
|
1019
|
+
def is_int16? = which? == Which::Int16
|
1020
|
+
DEFAULT_INT32 = 0
|
1021
|
+
sig { returns(Integer) }
|
1022
|
+
def int32 = read_s32(4, 0)
|
1023
|
+
sig { returns(T::Boolean) }
|
1024
|
+
def is_int32? = which? == Which::Int32
|
1025
|
+
DEFAULT_INT64 = 0
|
1026
|
+
sig { returns(Integer) }
|
1027
|
+
def int64 = read_s64(8, 0)
|
1028
|
+
sig { returns(T::Boolean) }
|
1029
|
+
def is_int64? = which? == Which::Int64
|
1030
|
+
DEFAULT_UINT8 = 0
|
1031
|
+
sig { returns(Integer) }
|
1032
|
+
def uint8 = read_u8(2, 0)
|
1033
|
+
sig { returns(T::Boolean) }
|
1034
|
+
def is_uint8? = which? == Which::Uint8
|
1035
|
+
DEFAULT_UINT16 = 0
|
1036
|
+
sig { returns(Integer) }
|
1037
|
+
def uint16 = read_u16(2, 0)
|
1038
|
+
sig { returns(T::Boolean) }
|
1039
|
+
def is_uint16? = which? == Which::Uint16
|
1040
|
+
DEFAULT_UINT32 = 0
|
1041
|
+
sig { returns(Integer) }
|
1042
|
+
def uint32 = read_u32(4, 0)
|
1043
|
+
sig { returns(T::Boolean) }
|
1044
|
+
def is_uint32? = which? == Which::Uint32
|
1045
|
+
DEFAULT_UINT64 = 0
|
1046
|
+
sig { returns(Integer) }
|
1047
|
+
def uint64 = read_u64(8, 0)
|
1048
|
+
sig { returns(T::Boolean) }
|
1049
|
+
def is_uint64? = which? == Which::Uint64
|
1050
|
+
DEFAULT_FLOAT32 = 0.0
|
1051
|
+
sig { returns(Float) }
|
1052
|
+
def float32 = read_f32(4, 0.0)
|
1053
|
+
sig { returns(T::Boolean) }
|
1054
|
+
def is_float32? = which? == Which::Float32
|
1055
|
+
DEFAULT_FLOAT64 = 0.0
|
1056
|
+
sig { returns(Float) }
|
1057
|
+
def float64 = read_f64(8, 0.0)
|
1058
|
+
sig { returns(T::Boolean) }
|
1059
|
+
def is_float64? = which? == Which::Float64
|
1060
|
+
DEFAULT_TEXT = nil
|
1061
|
+
sig { returns(T.nilable(Capnp::String)) }
|
1062
|
+
def text = Capnp::BufferString.from_pointer(read_pointer(0))
|
1063
|
+
sig { returns(T::Boolean) }
|
1064
|
+
def is_text? = which? == Which::Text
|
1065
|
+
DEFAULT_DATA = nil
|
1066
|
+
sig { returns(T.nilable(Capnp::Data)) }
|
1067
|
+
def data = Capnp::Data.from_pointer(read_pointer(0))
|
1068
|
+
sig { returns(T::Boolean) }
|
1069
|
+
def is_data? = which? == Which::Data
|
1070
|
+
sig { returns(Capnp::Reference) }
|
1071
|
+
def list = read_pointer(0)
|
1072
|
+
sig { returns(T::Boolean) }
|
1073
|
+
def is_list? = which? == Which::List
|
1074
|
+
DEFAULT_ENUM = 0
|
1075
|
+
sig { returns(Integer) }
|
1076
|
+
def enum = read_u16(2, 0)
|
1077
|
+
sig { returns(T::Boolean) }
|
1078
|
+
def is_enum? = which? == Which::Enum
|
1079
|
+
sig { returns(Capnp::Reference) }
|
1080
|
+
def struct = read_pointer(0)
|
1081
|
+
sig { returns(T::Boolean) }
|
1082
|
+
def is_struct? = which? == Which::Struct
|
1083
|
+
sig { returns(NilClass) }
|
1084
|
+
def interface = nil
|
1085
|
+
sig { returns(T::Boolean) }
|
1086
|
+
def is_interface? = which? == Which::Interface
|
1087
|
+
sig { returns(Capnp::Reference) }
|
1088
|
+
def any_pointer = read_pointer(0)
|
1089
|
+
sig { returns(T::Boolean) }
|
1090
|
+
def is_any_pointer? = which? == Which::AnyPointer
|
1091
|
+
|
1092
|
+
class List < Capnp::StructList
|
1093
|
+
Elem = type_member { {fixed: Value} }
|
1094
|
+
sig { override.returns(T.class_of(Value)) }
|
1095
|
+
def element_class = Value
|
1096
|
+
end
|
1097
|
+
sig { returns(Which) }
|
1098
|
+
def which? = Which.from_integer(read_u16(0, 0))
|
1099
|
+
|
1100
|
+
class Which < T::Enum
|
1101
|
+
extend T::Sig
|
1102
|
+
enums do
|
1103
|
+
Void = new("void")
|
1104
|
+
Bool = new("bool")
|
1105
|
+
Int8 = new("int8")
|
1106
|
+
Int16 = new("int16")
|
1107
|
+
Int32 = new("int32")
|
1108
|
+
Int64 = new("int64")
|
1109
|
+
Uint8 = new("uint8")
|
1110
|
+
Uint16 = new("uint16")
|
1111
|
+
Uint32 = new("uint32")
|
1112
|
+
Uint64 = new("uint64")
|
1113
|
+
Float32 = new("float32")
|
1114
|
+
Float64 = new("float64")
|
1115
|
+
Text = new("text")
|
1116
|
+
Data = new("data")
|
1117
|
+
List = new("list")
|
1118
|
+
Enum = new("enum")
|
1119
|
+
Struct = new("struct")
|
1120
|
+
Interface = new("interface")
|
1121
|
+
AnyPointer = new("anyPointer")
|
1122
|
+
end
|
1123
|
+
sig { params(value: Integer).returns(Which) }
|
1124
|
+
def self.from_integer(value)
|
1125
|
+
case value
|
1126
|
+
when 0 then Void
|
1127
|
+
when 1 then Bool
|
1128
|
+
when 2 then Int8
|
1129
|
+
when 3 then Int16
|
1130
|
+
when 4 then Int32
|
1131
|
+
when 5 then Int64
|
1132
|
+
when 6 then Uint8
|
1133
|
+
when 7 then Uint16
|
1134
|
+
when 8 then Uint32
|
1135
|
+
when 9 then Uint64
|
1136
|
+
when 10 then Float32
|
1137
|
+
when 11 then Float64
|
1138
|
+
when 12 then Text
|
1139
|
+
when 13 then Data
|
1140
|
+
when 14 then List
|
1141
|
+
when 15 then Enum
|
1142
|
+
when 16 then Struct
|
1143
|
+
when 17 then Interface
|
1144
|
+
when 18 then AnyPointer
|
1145
|
+
else raise "Unknown Which value: #{value}"
|
1146
|
+
end
|
1147
|
+
end
|
1148
|
+
end
|
1149
|
+
sig { override.returns(Object) }
|
1150
|
+
def to_obj
|
1151
|
+
res = {}
|
1152
|
+
case which?
|
1153
|
+
when Which::Void then res["void"] = void
|
1154
|
+
when Which::Bool then res["bool"] = bool
|
1155
|
+
when Which::Int8 then res["int8"] = int8
|
1156
|
+
when Which::Int16 then res["int16"] = int16
|
1157
|
+
when Which::Int32 then res["int32"] = int32
|
1158
|
+
when Which::Int64 then res["int64"] = int64
|
1159
|
+
when Which::Uint8 then res["uint8"] = uint8
|
1160
|
+
when Which::Uint16 then res["uint16"] = uint16
|
1161
|
+
when Which::Uint32 then res["uint32"] = uint32
|
1162
|
+
when Which::Uint64 then res["uint64"] = uint64
|
1163
|
+
when Which::Float32 then res["float32"] = float32
|
1164
|
+
when Which::Float64 then res["float64"] = float64
|
1165
|
+
when Which::Text then res["text"] = text&.to_obj
|
1166
|
+
when Which::Data then res["data"] = data&.to_obj
|
1167
|
+
when Which::List then res["list"] = list
|
1168
|
+
when Which::Enum then res["enum"] = enum
|
1169
|
+
when Which::Struct then res["struct"] = struct
|
1170
|
+
when Which::Interface then res["interface"] = interface
|
1171
|
+
when Which::AnyPointer then res["any_pointer"] = any_pointer
|
1172
|
+
end
|
1173
|
+
res
|
1174
|
+
end
|
1175
|
+
end
|
1176
|
+
|
1177
|
+
class Annotation < Capnp::Struct
|
1178
|
+
DEFAULT_ID = 0
|
1179
|
+
sig { returns(Integer) }
|
1180
|
+
def id = read_u64(0, 0)
|
1181
|
+
sig { returns(T.nilable(Schema::Brand)) }
|
1182
|
+
def brand = Schema::Brand.from_pointer(read_pointer(1))
|
1183
|
+
sig { returns(T.nilable(Schema::Value)) }
|
1184
|
+
def value = Schema::Value.from_pointer(read_pointer(0))
|
1185
|
+
|
1186
|
+
class List < Capnp::StructList
|
1187
|
+
Elem = type_member { {fixed: Annotation} }
|
1188
|
+
sig { override.returns(T.class_of(Annotation)) }
|
1189
|
+
def element_class = Annotation
|
1190
|
+
end
|
1191
|
+
sig { override.returns(Object) }
|
1192
|
+
def to_obj
|
1193
|
+
res = {}
|
1194
|
+
res["id"] = id
|
1195
|
+
res["brand"] = brand&.to_obj
|
1196
|
+
res["value"] = value&.to_obj
|
1197
|
+
res
|
1198
|
+
end
|
1199
|
+
end
|
1200
|
+
|
1201
|
+
class ElementSize < T::Enum
|
1202
|
+
extend T::Sig
|
1203
|
+
enums do
|
1204
|
+
Empty = new("empty")
|
1205
|
+
Bit = new("bit")
|
1206
|
+
Byte = new("byte")
|
1207
|
+
TwoBytes = new("twoBytes")
|
1208
|
+
FourBytes = new("fourBytes")
|
1209
|
+
EightBytes = new("eightBytes")
|
1210
|
+
Pointer = new("pointer")
|
1211
|
+
InlineComposite = new("inlineComposite")
|
1212
|
+
end
|
1213
|
+
sig { params(value: Integer).returns(ElementSize) }
|
1214
|
+
def self.from_integer(value)
|
1215
|
+
case value
|
1216
|
+
when 0 then Empty
|
1217
|
+
when 1 then Bit
|
1218
|
+
when 2 then Byte
|
1219
|
+
when 3 then TwoBytes
|
1220
|
+
when 4 then FourBytes
|
1221
|
+
when 5 then EightBytes
|
1222
|
+
when 6 then Pointer
|
1223
|
+
when 7 then InlineComposite
|
1224
|
+
else raise "Unknown ElementSize value: #{value}"
|
1225
|
+
end
|
1226
|
+
end
|
1227
|
+
end
|
1228
|
+
|
1229
|
+
class CapnpVersion < Capnp::Struct
|
1230
|
+
DEFAULT_MAJOR = 0
|
1231
|
+
sig { returns(Integer) }
|
1232
|
+
def major = read_u16(0, 0)
|
1233
|
+
DEFAULT_MINOR = 0
|
1234
|
+
sig { returns(Integer) }
|
1235
|
+
def minor = read_u8(2, 0)
|
1236
|
+
DEFAULT_MICRO = 0
|
1237
|
+
sig { returns(Integer) }
|
1238
|
+
def micro = read_u8(3, 0)
|
1239
|
+
|
1240
|
+
class List < Capnp::StructList
|
1241
|
+
Elem = type_member { {fixed: CapnpVersion} }
|
1242
|
+
sig { override.returns(T.class_of(CapnpVersion)) }
|
1243
|
+
def element_class = CapnpVersion
|
1244
|
+
end
|
1245
|
+
sig { override.returns(Object) }
|
1246
|
+
def to_obj
|
1247
|
+
res = {}
|
1248
|
+
res["major"] = major
|
1249
|
+
res["minor"] = minor
|
1250
|
+
res["micro"] = micro
|
1251
|
+
res
|
1252
|
+
end
|
1253
|
+
end
|
1254
|
+
|
1255
|
+
class CodeGeneratorRequest < Capnp::Struct
|
1256
|
+
sig { returns(T.nilable(Schema::CapnpVersion)) }
|
1257
|
+
def capnp_version = Schema::CapnpVersion.from_pointer(read_pointer(2))
|
1258
|
+
sig { returns(T.nilable(Capnp::List[Schema::Node])) }
|
1259
|
+
def nodes = Schema::Node::List.from_pointer(read_pointer(0))
|
1260
|
+
sig { returns(T.nilable(Capnp::List[Schema::Node::SourceInfo])) }
|
1261
|
+
def source_info = Schema::Node::SourceInfo::List.from_pointer(read_pointer(3))
|
1262
|
+
sig { returns(T.nilable(Capnp::List[Schema::CodeGeneratorRequest::RequestedFile])) }
|
1263
|
+
def requested_files = Schema::CodeGeneratorRequest::RequestedFile::List.from_pointer(read_pointer(1))
|
1264
|
+
|
1265
|
+
class RequestedFile < Capnp::Struct
|
1266
|
+
DEFAULT_ID = 0
|
1267
|
+
sig { returns(Integer) }
|
1268
|
+
def id = read_u64(0, 0)
|
1269
|
+
DEFAULT_FILENAME = nil
|
1270
|
+
sig { returns(T.nilable(Capnp::String)) }
|
1271
|
+
def filename = Capnp::BufferString.from_pointer(read_pointer(0))
|
1272
|
+
sig { returns(T.nilable(Capnp::List[Schema::CodeGeneratorRequest::RequestedFile::Import])) }
|
1273
|
+
def imports = Schema::CodeGeneratorRequest::RequestedFile::Import::List.from_pointer(read_pointer(1))
|
1274
|
+
|
1275
|
+
class Import < Capnp::Struct
|
1276
|
+
DEFAULT_ID = 0
|
1277
|
+
sig { returns(Integer) }
|
1278
|
+
def id = read_u64(0, 0)
|
1279
|
+
DEFAULT_NAME = nil
|
1280
|
+
sig { returns(T.nilable(Capnp::String)) }
|
1281
|
+
def name = Capnp::BufferString.from_pointer(read_pointer(0))
|
1282
|
+
|
1283
|
+
class List < Capnp::StructList
|
1284
|
+
Elem = type_member { {fixed: Import} }
|
1285
|
+
sig { override.returns(T.class_of(Import)) }
|
1286
|
+
def element_class = Import
|
1287
|
+
end
|
1288
|
+
sig { override.returns(Object) }
|
1289
|
+
def to_obj
|
1290
|
+
res = {}
|
1291
|
+
res["id"] = id
|
1292
|
+
res["name"] = name&.to_obj
|
1293
|
+
res
|
1294
|
+
end
|
1295
|
+
end
|
1296
|
+
|
1297
|
+
class List < Capnp::StructList
|
1298
|
+
Elem = type_member { {fixed: RequestedFile} }
|
1299
|
+
sig { override.returns(T.class_of(RequestedFile)) }
|
1300
|
+
def element_class = RequestedFile
|
1301
|
+
end
|
1302
|
+
sig { override.returns(Object) }
|
1303
|
+
def to_obj
|
1304
|
+
res = {}
|
1305
|
+
res["id"] = id
|
1306
|
+
res["filename"] = filename&.to_obj
|
1307
|
+
res["imports"] = imports&.to_obj
|
1308
|
+
res
|
1309
|
+
end
|
1310
|
+
end
|
1311
|
+
|
1312
|
+
class List < Capnp::StructList
|
1313
|
+
Elem = type_member { {fixed: CodeGeneratorRequest} }
|
1314
|
+
sig { override.returns(T.class_of(CodeGeneratorRequest)) }
|
1315
|
+
def element_class = CodeGeneratorRequest
|
1316
|
+
end
|
1317
|
+
sig { override.returns(Object) }
|
1318
|
+
def to_obj
|
1319
|
+
res = {}
|
1320
|
+
res["capnp_version"] = capnp_version&.to_obj
|
1321
|
+
res["nodes"] = nodes&.to_obj
|
1322
|
+
res["source_info"] = source_info&.to_obj
|
1323
|
+
res["requested_files"] = requested_files&.to_obj
|
1324
|
+
res
|
1325
|
+
end
|
1326
|
+
end
|
1327
|
+
end
|