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 | export class KeyValue { |
| 4 | constructor() { |
| 5 | this.bb = null; |
| 6 | this.bb_pos = 0; |
| 7 | } |
| 8 | __init(i, bb) { |
| 9 | this.bb_pos = i; |
| 10 | this.bb = bb; |
| 11 | return this; |
| 12 | } |
| 13 | static getRootAsKeyValue(bb, obj) { |
| 14 | return (obj || new KeyValue()).__init(bb.readInt32(bb.position()) + bb.position(), bb); |
| 15 | } |
| 16 | static getSizePrefixedRootAsKeyValue(bb, obj) { |
| 17 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); |
| 18 | return (obj || new KeyValue()).__init(bb.readInt32(bb.position()) + bb.position(), bb); |
| 19 | } |
| 20 | key(optionalEncoding) { |
| 21 | const offset = this.bb.__offset(this.bb_pos, 4); |
| 22 | return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; |
| 23 | } |
| 24 | value(optionalEncoding) { |
| 25 | const offset = this.bb.__offset(this.bb_pos, 6); |
| 26 | return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; |
| 27 | } |
| 28 | static getFullyQualifiedName() { |
| 29 | return 'reflection_KeyValue'; |
| 30 | } |
| 31 | static startKeyValue(builder) { |
| 32 | builder.startObject(2); |
| 33 | } |
| 34 | static addKey(builder, keyOffset) { |
| 35 | builder.addFieldOffset(0, keyOffset, 0); |
| 36 | } |
| 37 | static addValue(builder, valueOffset) { |
| 38 | builder.addFieldOffset(1, valueOffset, 0); |
| 39 | } |
| 40 | static endKeyValue(builder) { |
| 41 | const offset = builder.endObject(); |
| 42 | builder.requiredField(offset, 4); // key |
| 43 | return offset; |
| 44 | } |
| 45 | static createKeyValue(builder, keyOffset, valueOffset) { |
| 46 | KeyValue.startKeyValue(builder); |
| 47 | KeyValue.addKey(builder, keyOffset); |
| 48 | KeyValue.addValue(builder, valueOffset); |
| 49 | return KeyValue.endKeyValue(builder); |
| 50 | } |
| 51 | unpack() { |
| 52 | return new KeyValueT(this.key(), this.value()); |
| 53 | } |
| 54 | unpackTo(_o) { |
| 55 | _o.key = this.key(); |
| 56 | _o.value = this.value(); |
| 57 | } |
| 58 | } |
| 59 | export class KeyValueT { |
| 60 | constructor(key = null, value = null) { |
| 61 | this.key = key; |
| 62 | this.value = value; |
| 63 | } |
| 64 | pack(builder) { |
| 65 | const key = (this.key !== null ? builder.createString(this.key) : 0); |
| 66 | const value = (this.value !== null ? builder.createString(this.value) : 0); |
| 67 | return KeyValue.createKeyValue(builder, key, value); |
| 68 | } |
| 69 | } |