summaryrefslogtreecommitdiff
path: root/tests/my-game/example/stat.js
diff options
context:
space:
mode:
Diffstat (limited to 'tests/my-game/example/stat.js')
-rw-r--r--tests/my-game/example/stat.js99
1 files changed, 99 insertions, 0 deletions
diff --git a/tests/my-game/example/stat.js b/tests/my-game/example/stat.js
new file mode 100644
index 00000000..12746ed5
--- /dev/null
+++ b/tests/my-game/example/stat.js
@@ -0,0 +1,99 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import * as flatbuffers from 'flatbuffers';
+export class Stat {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ static getRootAsStat(bb, obj) {
+ return (obj || new Stat()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static getSizePrefixedRootAsStat(bb, obj) {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Stat()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ id(optionalEncoding) {
+ const offset = this.bb.__offset(this.bb_pos, 4);
+ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
+ }
+ val() {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? this.bb.readInt64(this.bb_pos + offset) : this.bb.createLong(0, 0);
+ }
+ mutate_val(value) {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt64(this.bb_pos + offset, value);
+ return true;
+ }
+ count() {
+ const offset = this.bb.__offset(this.bb_pos, 8);
+ return offset ? this.bb.readUint16(this.bb_pos + offset) : 0;
+ }
+ mutate_count(value) {
+ const offset = this.bb.__offset(this.bb_pos, 8);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeUint16(this.bb_pos + offset, value);
+ return true;
+ }
+ static getFullyQualifiedName() {
+ return 'MyGame.Example.Stat';
+ }
+ static startStat(builder) {
+ builder.startObject(3);
+ }
+ static addId(builder, idOffset) {
+ builder.addFieldOffset(0, idOffset, 0);
+ }
+ static addVal(builder, val) {
+ builder.addFieldInt64(1, val, builder.createLong(0, 0));
+ }
+ static addCount(builder, count) {
+ builder.addFieldInt16(2, count, 0);
+ }
+ static endStat(builder) {
+ const offset = builder.endObject();
+ return offset;
+ }
+ static createStat(builder, idOffset, val, count) {
+ Stat.startStat(builder);
+ Stat.addId(builder, idOffset);
+ Stat.addVal(builder, val);
+ Stat.addCount(builder, count);
+ return Stat.endStat(builder);
+ }
+ serialize() {
+ return this.bb.bytes();
+ }
+ static deserialize(buffer) {
+ return Stat.getRootAsStat(new flatbuffers.ByteBuffer(buffer));
+ }
+ unpack() {
+ return new StatT(this.id(), this.val(), this.count());
+ }
+ unpackTo(_o) {
+ _o.id = this.id();
+ _o.val = this.val();
+ _o.count = this.count();
+ }
+}
+export class StatT {
+ constructor(id = null, val = flatbuffers.createLong(0, 0), count = 0) {
+ this.id = id;
+ this.val = val;
+ this.count = count;
+ }
+ pack(builder) {
+ const id = (this.id !== null ? builder.createString(this.id) : 0);
+ return Stat.createStat(builder, id, this.val, this.count);
+ }
+}