1// automatically generated by the FlatBuffers compiler, do not modify 2 3/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ 4 5import * as flatbuffers from 'flatbuffers'; 6 7import { KeyValue, KeyValueT } from '../reflection/key-value.js'; 8import { Type, TypeT } from '../reflection/type.js'; 9 10 11export class Field implements flatbuffers.IUnpackableObject<FieldT> { 12 bb: flatbuffers.ByteBuffer|null = null; 13 bb_pos = 0; 14 __init(i:number, bb:flatbuffers.ByteBuffer):Field { 15 this.bb_pos = i; 16 this.bb = bb; 17 return this; 18} 19 20static getRootAsField(bb:flatbuffers.ByteBuffer, obj?:Field):Field { 21 return (obj || new Field()).__init(bb.readInt32(bb.position()) + bb.position(), bb); 22} 23 24static getSizePrefixedRootAsField(bb:flatbuffers.ByteBuffer, obj?:Field):Field { 25 bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); 26 return (obj || new Field()).__init(bb.readInt32(bb.position()) + bb.position(), bb); 27} 28 29name():string|null 30name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null 31name(optionalEncoding?:any):string|Uint8Array|null { 32 const offset = this.bb!.__offset(this.bb_pos, 4); 33 return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; 34} 35 36type(obj?:Type):Type|null { 37 const offset = this.bb!.__offset(this.bb_pos, 6); 38 return offset ? (obj || new Type()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; 39} 40 41id():number { 42 const offset = this.bb!.__offset(this.bb_pos, 8); 43 return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0; 44} 45 46mutate_id(value:number):boolean { 47 const offset = this.bb!.__offset(this.bb_pos, 8); 48 49 if (offset === 0) { 50 return false; 51 } 52 53 this.bb!.writeUint16(this.bb_pos + offset, value); 54 return true; 55} 56 57offset():number { 58 const offset = this.bb!.__offset(this.bb_pos, 10); 59 return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0; 60} 61 62mutate_offset(value:number):boolean { 63 const offset = this.bb!.__offset(this.bb_pos, 10); 64 65 if (offset === 0) { 66 return false; 67 } 68 69 this.bb!.writeUint16(this.bb_pos + offset, value); 70 return true; 71} 72 73defaultInteger():bigint { 74 const offset = this.bb!.__offset(this.bb_pos, 12); 75 return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0'); 76} 77 78mutate_default_integer(value:bigint):boolean { 79 const offset = this.bb!.__offset(this.bb_pos, 12); 80 81 if (offset === 0) { 82 return false; 83 } 84 85 this.bb!.writeInt64(this.bb_pos + offset, value); 86 return true; 87} 88 89defaultReal():number { 90 const offset = this.bb!.__offset(this.bb_pos, 14); 91 return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; 92} 93 94mutate_default_real(value:number):boolean { 95 const offset = this.bb!.__offset(this.bb_pos, 14); 96 97 if (offset === 0) { 98 return false; 99 } 100 101 this.bb!.writeFloat64(this.bb_pos + offset, value); 102 return true; 103} 104 105deprecated():boolean { 106 const offset = this.bb!.__offset(this.bb_pos, 16); 107 return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; 108} 109 110mutate_deprecated(value:boolean):boolean { 111 const offset = this.bb!.__offset(this.bb_pos, 16); 112 113 if (offset === 0) { 114 return false; 115 } 116 117 this.bb!.writeInt8(this.bb_pos + offset, +value); 118 return true; 119} 120 121required():boolean { 122 const offset = this.bb!.__offset(this.bb_pos, 18); 123 return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; 124} 125 126mutate_required(value:boolean):boolean { 127 const offset = this.bb!.__offset(this.bb_pos, 18); 128 129 if (offset === 0) { 130 return false; 131 } 132 133 this.bb!.writeInt8(this.bb_pos + offset, +value); 134 return true; 135} 136 137key():boolean { 138 const offset = this.bb!.__offset(this.bb_pos, 20); 139 return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; 140} 141 142mutate_key(value:boolean):boolean { 143 const offset = this.bb!.__offset(this.bb_pos, 20); 144 145 if (offset === 0) { 146 return false; 147 } 148 149 this.bb!.writeInt8(this.bb_pos + offset, +value); 150 return true; 151} 152 153attributes(index: number, obj?:KeyValue):KeyValue|null { 154 const offset = this.bb!.__offset(this.bb_pos, 22); 155 return offset ? (obj || new KeyValue()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; 156} 157 158attributesLength():number { 159 const offset = this.bb!.__offset(this.bb_pos, 22); 160 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 161} 162 163documentation(index: number):string 164documentation(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array 165documentation(index: number,optionalEncoding?:any):string|Uint8Array|null { 166 const offset = this.bb!.__offset(this.bb_pos, 24); 167 return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null; 168} 169 170documentationLength():number { 171 const offset = this.bb!.__offset(this.bb_pos, 24); 172 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; 173} 174 175optional():boolean { 176 const offset = this.bb!.__offset(this.bb_pos, 26); 177 return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; 178} 179 180mutate_optional(value:boolean):boolean { 181 const offset = this.bb!.__offset(this.bb_pos, 26); 182 183 if (offset === 0) { 184 return false; 185 } 186 187 this.bb!.writeInt8(this.bb_pos + offset, +value); 188 return true; 189} 190 191/** 192 * Number of padding octets to always add after this field. Structs only. 193 */ 194padding():number { 195 const offset = this.bb!.__offset(this.bb_pos, 28); 196 return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0; 197} 198 199mutate_padding(value:number):boolean { 200 const offset = this.bb!.__offset(this.bb_pos, 28); 201 202 if (offset === 0) { 203 return false; 204 } 205 206 this.bb!.writeUint16(this.bb_pos + offset, value); 207 return true; 208} 209 210/** 211 * If the field uses 64-bit offsets. 212 */ 213offset64():boolean { 214 const offset = this.bb!.__offset(this.bb_pos, 30); 215 return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; 216} 217 218mutate_offset64(value:boolean):boolean { 219 const offset = this.bb!.__offset(this.bb_pos, 30); 220 221 if (offset === 0) { 222 return false; 223 } 224 225 this.bb!.writeInt8(this.bb_pos + offset, +value); 226 return true; 227} 228 229static getFullyQualifiedName():string { 230 return 'reflection.Field'; 231} 232 233static startField(builder:flatbuffers.Builder) { 234 builder.startObject(14); 235} 236 237static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) { 238 builder.addFieldOffset(0, nameOffset, 0); 239} 240 241static addType(builder:flatbuffers.Builder, typeOffset:flatbuffers.Offset) { 242 builder.addFieldOffset(1, typeOffset, 0); 243} 244 245static addId(builder:flatbuffers.Builder, id:number) { 246 builder.addFieldInt16(2, id, 0); 247} 248 249static addOffset(builder:flatbuffers.Builder, offset:number) { 250 builder.addFieldInt16(3, offset, 0); 251} 252 253static addDefaultInteger(builder:flatbuffers.Builder, defaultInteger:bigint) { 254 builder.addFieldInt64(4, defaultInteger, BigInt('0')); 255} 256 257static addDefaultReal(builder:flatbuffers.Builder, defaultReal:number) { 258 builder.addFieldFloat64(5, defaultReal, 0.0); 259} 260 261static addDeprecated(builder:flatbuffers.Builder, deprecated:boolean) { 262 builder.addFieldInt8(6, +deprecated, +false); 263} 264 265static addRequired(builder:flatbuffers.Builder, required:boolean) { 266 builder.addFieldInt8(7, +required, +false); 267} 268 269static addKey(builder:flatbuffers.Builder, key:boolean) { 270 builder.addFieldInt8(8, +key, +false); 271} 272 273static addAttributes(builder:flatbuffers.Builder, attributesOffset:flatbuffers.Offset) { 274 builder.addFieldOffset(9, attributesOffset, 0); 275} 276 277static createAttributesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { 278 builder.startVector(4, data.length, 4); 279 for (let i = data.length - 1; i >= 0; i--) { 280 builder.addOffset(data[i]!); 281 } 282 return builder.endVector(); 283} 284 285static startAttributesVector(builder:flatbuffers.Builder, numElems:number) { 286 builder.startVector(4, numElems, 4); 287} 288 289static addDocumentation(builder:flatbuffers.Builder, documentationOffset:flatbuffers.Offset) { 290 builder.addFieldOffset(10, documentationOffset, 0); 291} 292 293static createDocumentationVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { 294 builder.startVector(4, data.length, 4); 295 for (let i = data.length - 1; i >= 0; i--) { 296 builder.addOffset(data[i]!); 297 } 298 return builder.endVector(); 299} 300 301static startDocumentationVector(builder:flatbuffers.Builder, numElems:number) { 302 builder.startVector(4, numElems, 4); 303} 304 305static addOptional(builder:flatbuffers.Builder, optional:boolean) { 306 builder.addFieldInt8(11, +optional, +false); 307} 308 309static addPadding(builder:flatbuffers.Builder, padding:number) { 310 builder.addFieldInt16(12, padding, 0); 311} 312 313static addOffset64(builder:flatbuffers.Builder, offset64:boolean) { 314 builder.addFieldInt8(13, +offset64, +false); 315} 316 317static endField(builder:flatbuffers.Builder):flatbuffers.Offset { 318 const offset = builder.endObject(); 319 builder.requiredField(offset, 4) // name 320 builder.requiredField(offset, 6) // type 321 return offset; 322} 323 324 325unpack(): FieldT { 326 return new FieldT( 327 this.name(), 328 (this.type() !== null ? this.type()!.unpack() : null), 329 this.id(), 330 this.offset(), 331 this.defaultInteger(), 332 this.defaultReal(), 333 this.deprecated(), 334 this.required(), 335 this.key(), 336 this.bb!.createObjList<KeyValue, KeyValueT>(this.attributes.bind(this), this.attributesLength()), 337 this.bb!.createScalarList<string>(this.documentation.bind(this), this.documentationLength()), 338 this.optional(), 339 this.padding(), 340 this.offset64() 341 ); 342} 343 344 345unpackTo(_o: FieldT): void { 346 _o.name = this.name(); 347 _o.type = (this.type() !== null ? this.type()!.unpack() : null); 348 _o.id = this.id(); 349 _o.offset = this.offset(); 350 _o.defaultInteger = this.defaultInteger(); 351 _o.defaultReal = this.defaultReal(); 352 _o.deprecated = this.deprecated(); 353 _o.required = this.required(); 354 _o.key = this.key(); 355 _o.attributes = this.bb!.createObjList<KeyValue, KeyValueT>(this.attributes.bind(this), this.attributesLength()); 356 _o.documentation = this.bb!.createScalarList<string>(this.documentation.bind(this), this.documentationLength()); 357 _o.optional = this.optional(); 358 _o.padding = this.padding(); 359 _o.offset64 = this.offset64(); 360} 361} 362 363export class FieldT implements flatbuffers.IGeneratedObject { 364constructor( 365 public name: string|Uint8Array|null = null, 366 public type: TypeT|null = null, 367 public id: number = 0, 368 public offset: number = 0, 369 public defaultInteger: bigint = BigInt('0'), 370 public defaultReal: number = 0.0, 371 public deprecated: boolean = false, 372 public required: boolean = false, 373 public key: boolean = false, 374 public attributes: (KeyValueT)[] = [], 375 public documentation: (string)[] = [], 376 public optional: boolean = false, 377 public padding: number = 0, 378 public offset64: boolean = false 379){} 380 381 382pack(builder:flatbuffers.Builder): flatbuffers.Offset { 383 const name = (this.name !== null ? builder.createString(this.name!) : 0); 384 const type = (this.type !== null ? this.type!.pack(builder) : 0); 385 const attributes = Field.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes)); 386 const documentation = Field.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation)); 387 388 Field.startField(builder); 389 Field.addName(builder, name); 390 Field.addType(builder, type); 391 Field.addId(builder, this.id); 392 Field.addOffset(builder, this.offset); 393 Field.addDefaultInteger(builder, this.defaultInteger); 394 Field.addDefaultReal(builder, this.defaultReal); 395 Field.addDeprecated(builder, this.deprecated); 396 Field.addRequired(builder, this.required); 397 Field.addKey(builder, this.key); 398 Field.addAttributes(builder, attributes); 399 Field.addDocumentation(builder, documentation); 400 Field.addOptional(builder, this.optional); 401 Field.addPadding(builder, this.padding); 402 Field.addOffset64(builder, this.offset64); 403 404 return Field.endField(builder); 405} 406} 407