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 | |
James Kuszmaul | 3b15b0c | 2022-11-08 14:03:16 -0800 | [diff] [blame^] | 7 | export class KeyValue implements flatbuffers.IUnpackableObject<KeyValueT> { |
Austin Schuh | 2dd86a9 | 2022-09-14 21:19:23 -0700 | [diff] [blame] | 8 | bb: flatbuffers.ByteBuffer|null = null; |
| 9 | bb_pos = 0; |
| 10 | __init(i:number, bb:flatbuffers.ByteBuffer):KeyValue { |
| 11 | this.bb_pos = i; |
| 12 | this.bb = bb; |
| 13 | return this; |
| 14 | } |
| 15 | |
| 16 | static getRootAsKeyValue(bb:flatbuffers.ByteBuffer, obj?:KeyValue):KeyValue { |
| 17 | return (obj || new KeyValue()).__init(bb.readInt32(bb.position()) + bb.position(), bb); |
| 18 | } |
| 19 | |
| 20 | static getSizePrefixedRootAsKeyValue(bb:flatbuffers.ByteBuffer, obj?:KeyValue):KeyValue { |
| 21 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); |
| 22 | return (obj || new KeyValue()).__init(bb.readInt32(bb.position()) + bb.position(), bb); |
| 23 | } |
| 24 | |
| 25 | key():string|null |
| 26 | key(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null |
| 27 | key(optionalEncoding?:any):string|Uint8Array|null { |
| 28 | const offset = this.bb!.__offset(this.bb_pos, 4); |
| 29 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; |
| 30 | } |
| 31 | |
| 32 | value():string|null |
| 33 | value(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null |
| 34 | value(optionalEncoding?:any):string|Uint8Array|null { |
| 35 | const offset = this.bb!.__offset(this.bb_pos, 6); |
| 36 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; |
| 37 | } |
| 38 | |
| 39 | static getFullyQualifiedName():string { |
| 40 | return 'reflection_KeyValue'; |
| 41 | } |
| 42 | |
| 43 | static startKeyValue(builder:flatbuffers.Builder) { |
| 44 | builder.startObject(2); |
| 45 | } |
| 46 | |
| 47 | static addKey(builder:flatbuffers.Builder, keyOffset:flatbuffers.Offset) { |
| 48 | builder.addFieldOffset(0, keyOffset, 0); |
| 49 | } |
| 50 | |
| 51 | static addValue(builder:flatbuffers.Builder, valueOffset:flatbuffers.Offset) { |
| 52 | builder.addFieldOffset(1, valueOffset, 0); |
| 53 | } |
| 54 | |
| 55 | static endKeyValue(builder:flatbuffers.Builder):flatbuffers.Offset { |
| 56 | const offset = builder.endObject(); |
| 57 | builder.requiredField(offset, 4) // key |
| 58 | return offset; |
| 59 | } |
| 60 | |
| 61 | static createKeyValue(builder:flatbuffers.Builder, keyOffset:flatbuffers.Offset, valueOffset:flatbuffers.Offset):flatbuffers.Offset { |
| 62 | KeyValue.startKeyValue(builder); |
| 63 | KeyValue.addKey(builder, keyOffset); |
| 64 | KeyValue.addValue(builder, valueOffset); |
| 65 | return KeyValue.endKeyValue(builder); |
| 66 | } |
| 67 | |
| 68 | unpack(): KeyValueT { |
| 69 | return new KeyValueT( |
| 70 | this.key(), |
| 71 | this.value() |
| 72 | ); |
| 73 | } |
| 74 | |
| 75 | |
| 76 | unpackTo(_o: KeyValueT): void { |
| 77 | _o.key = this.key(); |
| 78 | _o.value = this.value(); |
| 79 | } |
| 80 | } |
| 81 | |
James Kuszmaul | 3b15b0c | 2022-11-08 14:03:16 -0800 | [diff] [blame^] | 82 | export class KeyValueT implements flatbuffers.IGeneratedObject { |
Austin Schuh | 2dd86a9 | 2022-09-14 21:19:23 -0700 | [diff] [blame] | 83 | constructor( |
| 84 | public key: string|Uint8Array|null = null, |
| 85 | public value: string|Uint8Array|null = null |
| 86 | ){} |
| 87 | |
| 88 | |
| 89 | pack(builder:flatbuffers.Builder): flatbuffers.Offset { |
| 90 | const key = (this.key !== null ? builder.createString(this.key!) : 0); |
| 91 | const value = (this.value !== null ? builder.createString(this.value!) : 0); |
| 92 | |
| 93 | return KeyValue.createKeyValue(builder, |
| 94 | key, |
| 95 | value |
| 96 | ); |
| 97 | } |
| 98 | } |