• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// automatically generated by the FlatBuffers compiler, do not modify
2/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
3import * as flatbuffers from 'flatbuffers';
4export class KeyValue {
5    constructor() {
6        this.bb = null;
7        this.bb_pos = 0;
8    }
9    __init(i, bb) {
10        this.bb_pos = i;
11        this.bb = bb;
12        return this;
13    }
14    static getRootAsKeyValue(bb, obj) {
15        return (obj || new KeyValue()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
16    }
17    static getSizePrefixedRootAsKeyValue(bb, obj) {
18        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
19        return (obj || new KeyValue()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
20    }
21    key(optionalEncoding) {
22        const offset = this.bb.__offset(this.bb_pos, 4);
23        return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
24    }
25    value(optionalEncoding) {
26        const offset = this.bb.__offset(this.bb_pos, 6);
27        return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
28    }
29    static getFullyQualifiedName() {
30        return 'reflection.KeyValue';
31    }
32    static startKeyValue(builder) {
33        builder.startObject(2);
34    }
35    static addKey(builder, keyOffset) {
36        builder.addFieldOffset(0, keyOffset, 0);
37    }
38    static addValue(builder, valueOffset) {
39        builder.addFieldOffset(1, valueOffset, 0);
40    }
41    static endKeyValue(builder) {
42        const offset = builder.endObject();
43        builder.requiredField(offset, 4); // key
44        return offset;
45    }
46    static createKeyValue(builder, keyOffset, valueOffset) {
47        KeyValue.startKeyValue(builder);
48        KeyValue.addKey(builder, keyOffset);
49        KeyValue.addValue(builder, valueOffset);
50        return KeyValue.endKeyValue(builder);
51    }
52    unpack() {
53        return new KeyValueT(this.key(), this.value());
54    }
55    unpackTo(_o) {
56        _o.key = this.key();
57        _o.value = this.value();
58    }
59}
60export class KeyValueT {
61    constructor(key = null, value = null) {
62        this.key = key;
63        this.value = value;
64    }
65    pack(builder) {
66        const key = (this.key !== null ? builder.createString(this.key) : 0);
67        const value = (this.value !== null ? builder.createString(this.value) : 0);
68        return KeyValue.createKeyValue(builder, key, value);
69    }
70}
71