Austin Schuh | 2dd86a9 | 2022-09-14 21:19:23 -0700 | [diff] [blame] | 1 | // automatically generated by the FlatBuffers compiler, do not modify |
| 2 | |
| 3 | import * as flatbuffers from 'flatbuffers'; |
| 4 | |
| 5 | |
| 6 | |
| 7 | /** |
| 8 | * File specific information. |
| 9 | * Symbols declared within a file may be recovered by iterating over all |
| 10 | * symbols and examining the `declaration_file` field. |
| 11 | */ |
James Kuszmaul | 3b15b0c | 2022-11-08 14:03:16 -0800 | [diff] [blame^] | 12 | export class SchemaFile implements flatbuffers.IUnpackableObject<SchemaFileT> { |
Austin Schuh | 2dd86a9 | 2022-09-14 21:19:23 -0700 | [diff] [blame] | 13 | bb: flatbuffers.ByteBuffer|null = null; |
| 14 | bb_pos = 0; |
| 15 | __init(i:number, bb:flatbuffers.ByteBuffer):SchemaFile { |
| 16 | this.bb_pos = i; |
| 17 | this.bb = bb; |
| 18 | return this; |
| 19 | } |
| 20 | |
| 21 | static getRootAsSchemaFile(bb:flatbuffers.ByteBuffer, obj?:SchemaFile):SchemaFile { |
| 22 | return (obj || new SchemaFile()).__init(bb.readInt32(bb.position()) + bb.position(), bb); |
| 23 | } |
| 24 | |
| 25 | static getSizePrefixedRootAsSchemaFile(bb:flatbuffers.ByteBuffer, obj?:SchemaFile):SchemaFile { |
| 26 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); |
| 27 | return (obj || new SchemaFile()).__init(bb.readInt32(bb.position()) + bb.position(), bb); |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * Filename, relative to project root. |
| 32 | */ |
| 33 | filename():string|null |
| 34 | filename(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null |
| 35 | filename(optionalEncoding?:any):string|Uint8Array|null { |
| 36 | const offset = this.bb!.__offset(this.bb_pos, 4); |
| 37 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Names of included files, relative to project root. |
| 42 | */ |
| 43 | includedFilenames(index: number):string |
| 44 | includedFilenames(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array |
| 45 | includedFilenames(index: number,optionalEncoding?:any):string|Uint8Array|null { |
| 46 | const offset = this.bb!.__offset(this.bb_pos, 6); |
| 47 | return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null; |
| 48 | } |
| 49 | |
| 50 | includedFilenamesLength():number { |
| 51 | const offset = this.bb!.__offset(this.bb_pos, 6); |
| 52 | return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; |
| 53 | } |
| 54 | |
| 55 | static getFullyQualifiedName():string { |
| 56 | return 'reflection_SchemaFile'; |
| 57 | } |
| 58 | |
| 59 | static startSchemaFile(builder:flatbuffers.Builder) { |
| 60 | builder.startObject(2); |
| 61 | } |
| 62 | |
| 63 | static addFilename(builder:flatbuffers.Builder, filenameOffset:flatbuffers.Offset) { |
| 64 | builder.addFieldOffset(0, filenameOffset, 0); |
| 65 | } |
| 66 | |
| 67 | static addIncludedFilenames(builder:flatbuffers.Builder, includedFilenamesOffset:flatbuffers.Offset) { |
| 68 | builder.addFieldOffset(1, includedFilenamesOffset, 0); |
| 69 | } |
| 70 | |
| 71 | static createIncludedFilenamesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { |
| 72 | builder.startVector(4, data.length, 4); |
| 73 | for (let i = data.length - 1; i >= 0; i--) { |
| 74 | builder.addOffset(data[i]!); |
| 75 | } |
| 76 | return builder.endVector(); |
| 77 | } |
| 78 | |
| 79 | static startIncludedFilenamesVector(builder:flatbuffers.Builder, numElems:number) { |
| 80 | builder.startVector(4, numElems, 4); |
| 81 | } |
| 82 | |
| 83 | static endSchemaFile(builder:flatbuffers.Builder):flatbuffers.Offset { |
| 84 | const offset = builder.endObject(); |
| 85 | builder.requiredField(offset, 4) // filename |
| 86 | return offset; |
| 87 | } |
| 88 | |
| 89 | static createSchemaFile(builder:flatbuffers.Builder, filenameOffset:flatbuffers.Offset, includedFilenamesOffset:flatbuffers.Offset):flatbuffers.Offset { |
| 90 | SchemaFile.startSchemaFile(builder); |
| 91 | SchemaFile.addFilename(builder, filenameOffset); |
| 92 | SchemaFile.addIncludedFilenames(builder, includedFilenamesOffset); |
| 93 | return SchemaFile.endSchemaFile(builder); |
| 94 | } |
| 95 | |
| 96 | unpack(): SchemaFileT { |
| 97 | return new SchemaFileT( |
| 98 | this.filename(), |
James Kuszmaul | 3b15b0c | 2022-11-08 14:03:16 -0800 | [diff] [blame^] | 99 | this.bb!.createScalarList<string>(this.includedFilenames.bind(this), this.includedFilenamesLength()) |
Austin Schuh | 2dd86a9 | 2022-09-14 21:19:23 -0700 | [diff] [blame] | 100 | ); |
| 101 | } |
| 102 | |
| 103 | |
| 104 | unpackTo(_o: SchemaFileT): void { |
| 105 | _o.filename = this.filename(); |
James Kuszmaul | 3b15b0c | 2022-11-08 14:03:16 -0800 | [diff] [blame^] | 106 | _o.includedFilenames = this.bb!.createScalarList<string>(this.includedFilenames.bind(this), this.includedFilenamesLength()); |
Austin Schuh | 2dd86a9 | 2022-09-14 21:19:23 -0700 | [diff] [blame] | 107 | } |
| 108 | } |
| 109 | |
James Kuszmaul | 3b15b0c | 2022-11-08 14:03:16 -0800 | [diff] [blame^] | 110 | export class SchemaFileT implements flatbuffers.IGeneratedObject { |
Austin Schuh | 2dd86a9 | 2022-09-14 21:19:23 -0700 | [diff] [blame] | 111 | constructor( |
| 112 | public filename: string|Uint8Array|null = null, |
| 113 | public includedFilenames: (string)[] = [] |
| 114 | ){} |
| 115 | |
| 116 | |
| 117 | pack(builder:flatbuffers.Builder): flatbuffers.Offset { |
| 118 | const filename = (this.filename !== null ? builder.createString(this.filename!) : 0); |
| 119 | const includedFilenames = SchemaFile.createIncludedFilenamesVector(builder, builder.createObjectOffsetList(this.includedFilenames)); |
| 120 | |
| 121 | return SchemaFile.createSchemaFile(builder, |
| 122 | filename, |
| 123 | includedFilenames |
| 124 | ); |
| 125 | } |
| 126 | } |