blob: d2885455a7b897cfb882350bd372c6f193edcefd [file] [log] [blame]
Austin Schuh2dd86a92022-09-14 21:19:23 -07001// automatically generated by the FlatBuffers compiler, do not modify
2import * as flatbuffers from 'flatbuffers';
3import { Field } from '../reflection/field.js';
4import { KeyValue } from '../reflection/key-value.js';
5export class Object_ {
6 constructor() {
7 this.bb = null;
8 this.bb_pos = 0;
9 }
10 __init(i, bb) {
11 this.bb_pos = i;
12 this.bb = bb;
13 return this;
14 }
15 static getRootAsObject(bb, obj) {
16 return (obj || new Object_()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
17 }
18 static getSizePrefixedRootAsObject(bb, obj) {
19 bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
20 return (obj || new Object_()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
21 }
22 name(optionalEncoding) {
23 const offset = this.bb.__offset(this.bb_pos, 4);
24 return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
25 }
26 fields(index, obj) {
27 const offset = this.bb.__offset(this.bb_pos, 6);
28 return offset ? (obj || new Field()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
29 }
30 fieldsLength() {
31 const offset = this.bb.__offset(this.bb_pos, 6);
32 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
33 }
34 isStruct() {
35 const offset = this.bb.__offset(this.bb_pos, 8);
36 return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
37 }
38 mutate_is_struct(value) {
39 const offset = this.bb.__offset(this.bb_pos, 8);
40 if (offset === 0) {
41 return false;
42 }
43 this.bb.writeInt8(this.bb_pos + offset, +value);
44 return true;
45 }
46 minalign() {
47 const offset = this.bb.__offset(this.bb_pos, 10);
48 return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
49 }
50 mutate_minalign(value) {
51 const offset = this.bb.__offset(this.bb_pos, 10);
52 if (offset === 0) {
53 return false;
54 }
55 this.bb.writeInt32(this.bb_pos + offset, value);
56 return true;
57 }
58 bytesize() {
59 const offset = this.bb.__offset(this.bb_pos, 12);
60 return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
61 }
62 mutate_bytesize(value) {
63 const offset = this.bb.__offset(this.bb_pos, 12);
64 if (offset === 0) {
65 return false;
66 }
67 this.bb.writeInt32(this.bb_pos + offset, value);
68 return true;
69 }
70 attributes(index, obj) {
71 const offset = this.bb.__offset(this.bb_pos, 14);
72 return offset ? (obj || new KeyValue()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
73 }
74 attributesLength() {
75 const offset = this.bb.__offset(this.bb_pos, 14);
76 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
77 }
78 documentation(index, optionalEncoding) {
79 const offset = this.bb.__offset(this.bb_pos, 16);
80 return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
81 }
82 documentationLength() {
83 const offset = this.bb.__offset(this.bb_pos, 16);
84 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
85 }
86 declarationFile(optionalEncoding) {
87 const offset = this.bb.__offset(this.bb_pos, 18);
88 return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
89 }
90 static getFullyQualifiedName() {
91 return 'reflection_Object';
92 }
93 static startObject(builder) {
94 builder.startObject(8);
95 }
96 static addName(builder, nameOffset) {
97 builder.addFieldOffset(0, nameOffset, 0);
98 }
99 static addFields(builder, fieldsOffset) {
100 builder.addFieldOffset(1, fieldsOffset, 0);
101 }
102 static createFieldsVector(builder, data) {
103 builder.startVector(4, data.length, 4);
104 for (let i = data.length - 1; i >= 0; i--) {
105 builder.addOffset(data[i]);
106 }
107 return builder.endVector();
108 }
109 static startFieldsVector(builder, numElems) {
110 builder.startVector(4, numElems, 4);
111 }
112 static addIsStruct(builder, isStruct) {
113 builder.addFieldInt8(2, +isStruct, +false);
114 }
115 static addMinalign(builder, minalign) {
116 builder.addFieldInt32(3, minalign, 0);
117 }
118 static addBytesize(builder, bytesize) {
119 builder.addFieldInt32(4, bytesize, 0);
120 }
121 static addAttributes(builder, attributesOffset) {
122 builder.addFieldOffset(5, attributesOffset, 0);
123 }
124 static createAttributesVector(builder, data) {
125 builder.startVector(4, data.length, 4);
126 for (let i = data.length - 1; i >= 0; i--) {
127 builder.addOffset(data[i]);
128 }
129 return builder.endVector();
130 }
131 static startAttributesVector(builder, numElems) {
132 builder.startVector(4, numElems, 4);
133 }
134 static addDocumentation(builder, documentationOffset) {
135 builder.addFieldOffset(6, documentationOffset, 0);
136 }
137 static createDocumentationVector(builder, data) {
138 builder.startVector(4, data.length, 4);
139 for (let i = data.length - 1; i >= 0; i--) {
140 builder.addOffset(data[i]);
141 }
142 return builder.endVector();
143 }
144 static startDocumentationVector(builder, numElems) {
145 builder.startVector(4, numElems, 4);
146 }
147 static addDeclarationFile(builder, declarationFileOffset) {
148 builder.addFieldOffset(7, declarationFileOffset, 0);
149 }
150 static endObject(builder) {
151 const offset = builder.endObject();
152 builder.requiredField(offset, 4); // name
153 builder.requiredField(offset, 6); // fields
154 return offset;
155 }
156 static createObject(builder, nameOffset, fieldsOffset, isStruct, minalign, bytesize, attributesOffset, documentationOffset, declarationFileOffset) {
157 Object_.startObject(builder);
158 Object_.addName(builder, nameOffset);
159 Object_.addFields(builder, fieldsOffset);
160 Object_.addIsStruct(builder, isStruct);
161 Object_.addMinalign(builder, minalign);
162 Object_.addBytesize(builder, bytesize);
163 Object_.addAttributes(builder, attributesOffset);
164 Object_.addDocumentation(builder, documentationOffset);
165 Object_.addDeclarationFile(builder, declarationFileOffset);
166 return Object_.endObject(builder);
167 }
168 unpack() {
169 return new Object_T(this.name(), this.bb.createObjList(this.fields.bind(this), this.fieldsLength()), this.isStruct(), this.minalign(), this.bytesize(), this.bb.createObjList(this.attributes.bind(this), this.attributesLength()), this.bb.createScalarList(this.documentation.bind(this), this.documentationLength()), this.declarationFile());
170 }
171 unpackTo(_o) {
172 _o.name = this.name();
173 _o.fields = this.bb.createObjList(this.fields.bind(this), this.fieldsLength());
174 _o.isStruct = this.isStruct();
175 _o.minalign = this.minalign();
176 _o.bytesize = this.bytesize();
177 _o.attributes = this.bb.createObjList(this.attributes.bind(this), this.attributesLength());
178 _o.documentation = this.bb.createScalarList(this.documentation.bind(this), this.documentationLength());
179 _o.declarationFile = this.declarationFile();
180 }
181}
182export class Object_T {
183 constructor(name = null, fields = [], isStruct = false, minalign = 0, bytesize = 0, attributes = [], documentation = [], declarationFile = null) {
184 this.name = name;
185 this.fields = fields;
186 this.isStruct = isStruct;
187 this.minalign = minalign;
188 this.bytesize = bytesize;
189 this.attributes = attributes;
190 this.documentation = documentation;
191 this.declarationFile = declarationFile;
192 }
193 pack(builder) {
194 const name = (this.name !== null ? builder.createString(this.name) : 0);
195 const fields = Object_.createFieldsVector(builder, builder.createObjectOffsetList(this.fields));
196 const attributes = Object_.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
197 const documentation = Object_.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
198 const declarationFile = (this.declarationFile !== null ? builder.createString(this.declarationFile) : 0);
199 return Object_.createObject(builder, name, fields, this.isStruct, this.minalign, this.bytesize, attributes, documentation, declarationFile);
200 }
201}