Austin Schuh | 2dd86a9 | 2022-09-14 21:19:23 -0700 | [diff] [blame^] | 1 | // automatically generated by the FlatBuffers compiler, do not modify |
| 2 | import * as flatbuffers from 'flatbuffers'; |
| 3 | /** |
| 4 | * File specific information. |
| 5 | * Symbols declared within a file may be recovered by iterating over all |
| 6 | * symbols and examining the `declaration_file` field. |
| 7 | */ |
| 8 | export class SchemaFile { |
| 9 | constructor() { |
| 10 | this.bb = null; |
| 11 | this.bb_pos = 0; |
| 12 | } |
| 13 | __init(i, bb) { |
| 14 | this.bb_pos = i; |
| 15 | this.bb = bb; |
| 16 | return this; |
| 17 | } |
| 18 | static getRootAsSchemaFile(bb, obj) { |
| 19 | return (obj || new SchemaFile()).__init(bb.readInt32(bb.position()) + bb.position(), bb); |
| 20 | } |
| 21 | static getSizePrefixedRootAsSchemaFile(bb, obj) { |
| 22 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); |
| 23 | return (obj || new SchemaFile()).__init(bb.readInt32(bb.position()) + bb.position(), bb); |
| 24 | } |
| 25 | filename(optionalEncoding) { |
| 26 | const offset = this.bb.__offset(this.bb_pos, 4); |
| 27 | return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; |
| 28 | } |
| 29 | includedFilenames(index, optionalEncoding) { |
| 30 | const offset = this.bb.__offset(this.bb_pos, 6); |
| 31 | return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null; |
| 32 | } |
| 33 | includedFilenamesLength() { |
| 34 | const offset = this.bb.__offset(this.bb_pos, 6); |
| 35 | return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; |
| 36 | } |
| 37 | static getFullyQualifiedName() { |
| 38 | return 'reflection_SchemaFile'; |
| 39 | } |
| 40 | static startSchemaFile(builder) { |
| 41 | builder.startObject(2); |
| 42 | } |
| 43 | static addFilename(builder, filenameOffset) { |
| 44 | builder.addFieldOffset(0, filenameOffset, 0); |
| 45 | } |
| 46 | static addIncludedFilenames(builder, includedFilenamesOffset) { |
| 47 | builder.addFieldOffset(1, includedFilenamesOffset, 0); |
| 48 | } |
| 49 | static createIncludedFilenamesVector(builder, data) { |
| 50 | builder.startVector(4, data.length, 4); |
| 51 | for (let i = data.length - 1; i >= 0; i--) { |
| 52 | builder.addOffset(data[i]); |
| 53 | } |
| 54 | return builder.endVector(); |
| 55 | } |
| 56 | static startIncludedFilenamesVector(builder, numElems) { |
| 57 | builder.startVector(4, numElems, 4); |
| 58 | } |
| 59 | static endSchemaFile(builder) { |
| 60 | const offset = builder.endObject(); |
| 61 | builder.requiredField(offset, 4); // filename |
| 62 | return offset; |
| 63 | } |
| 64 | static createSchemaFile(builder, filenameOffset, includedFilenamesOffset) { |
| 65 | SchemaFile.startSchemaFile(builder); |
| 66 | SchemaFile.addFilename(builder, filenameOffset); |
| 67 | SchemaFile.addIncludedFilenames(builder, includedFilenamesOffset); |
| 68 | return SchemaFile.endSchemaFile(builder); |
| 69 | } |
| 70 | unpack() { |
| 71 | return new SchemaFileT(this.filename(), this.bb.createScalarList(this.includedFilenames.bind(this), this.includedFilenamesLength())); |
| 72 | } |
| 73 | unpackTo(_o) { |
| 74 | _o.filename = this.filename(); |
| 75 | _o.includedFilenames = this.bb.createScalarList(this.includedFilenames.bind(this), this.includedFilenamesLength()); |
| 76 | } |
| 77 | } |
| 78 | export class SchemaFileT { |
| 79 | constructor(filename = null, includedFilenames = []) { |
| 80 | this.filename = filename; |
| 81 | this.includedFilenames = includedFilenames; |
| 82 | } |
| 83 | pack(builder) { |
| 84 | const filename = (this.filename !== null ? builder.createString(this.filename) : 0); |
| 85 | const includedFilenames = SchemaFile.createIncludedFilenamesVector(builder, builder.createObjectOffsetList(this.includedFilenames)); |
| 86 | return SchemaFile.createSchemaFile(builder, filename, includedFilenames); |
| 87 | } |
| 88 | } |