Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 1 | // automatically generated by the FlatBuffers compiler, do not modify |
| 2 | |
| 3 | /** |
| 4 | * @enum |
| 5 | */ |
| 6 | export namespace MyGame.Example{ |
| 7 | export enum Color{ |
| 8 | Red= 1, |
| 9 | Green= 2, |
| 10 | Blue= 8 |
| 11 | }}; |
| 12 | |
| 13 | /** |
| 14 | * @enum |
| 15 | */ |
| 16 | export namespace MyGame.Example{ |
| 17 | export enum Any{ |
| 18 | NONE= 0, |
| 19 | Monster= 1, |
| 20 | TestSimpleTableWithEnum= 2, |
| 21 | MyGame_Example2_Monster= 3 |
| 22 | }}; |
| 23 | |
| 24 | /** |
| 25 | * @constructor |
| 26 | */ |
| 27 | export namespace MyGame.Example2{ |
| 28 | export class Monster { |
| 29 | /** |
| 30 | * @type {flatbuffers.ByteBuffer} |
| 31 | */ |
Kamil Rojewski | 86777bd | 2017-05-02 01:05:53 +0200 | [diff] [blame] | 32 | bb: flatbuffers.ByteBuffer; |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 33 | |
| 34 | /** |
| 35 | * @type {number} |
| 36 | */ |
| 37 | bb_pos:number = 0; |
| 38 | /** |
| 39 | * @param {number} i |
| 40 | * @param {flatbuffers.ByteBuffer} bb |
| 41 | * @returns {Monster} |
| 42 | */ |
| 43 | __init(i:number, bb:flatbuffers.ByteBuffer):Monster { |
| 44 | this.bb_pos = i; |
| 45 | this.bb = bb; |
| 46 | return this; |
| 47 | }; |
| 48 | |
| 49 | /** |
| 50 | * @param {flatbuffers.ByteBuffer} bb |
| 51 | * @param {Monster=} obj |
| 52 | * @returns {Monster} |
| 53 | */ |
| 54 | static getRootAsMonster(bb:flatbuffers.ByteBuffer, obj?:Monster):Monster { |
| 55 | return (obj || new Monster).__init(bb.readInt32(bb.position()) + bb.position(), bb); |
| 56 | }; |
| 57 | |
| 58 | /** |
| 59 | * @param {flatbuffers.Builder} builder |
| 60 | */ |
| 61 | static startMonster(builder:flatbuffers.Builder) { |
| 62 | builder.startObject(0); |
| 63 | }; |
| 64 | |
| 65 | /** |
| 66 | * @param {flatbuffers.Builder} builder |
| 67 | * @returns {flatbuffers.Offset} |
| 68 | */ |
| 69 | static endMonster(builder:flatbuffers.Builder):flatbuffers.Offset { |
| 70 | var offset = builder.endObject(); |
| 71 | return offset; |
| 72 | }; |
| 73 | |
| 74 | } |
| 75 | } |
| 76 | /** |
| 77 | * @constructor |
| 78 | */ |
| 79 | export namespace MyGame.Example{ |
| 80 | export class Test { |
| 81 | /** |
| 82 | * @type {flatbuffers.ByteBuffer} |
| 83 | */ |
Kamil Rojewski | 86777bd | 2017-05-02 01:05:53 +0200 | [diff] [blame] | 84 | bb: flatbuffers.ByteBuffer; |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 85 | |
| 86 | /** |
| 87 | * @type {number} |
| 88 | */ |
| 89 | bb_pos:number = 0; |
| 90 | /** |
| 91 | * @param {number} i |
| 92 | * @param {flatbuffers.ByteBuffer} bb |
| 93 | * @returns {Test} |
| 94 | */ |
| 95 | __init(i:number, bb:flatbuffers.ByteBuffer):Test { |
| 96 | this.bb_pos = i; |
| 97 | this.bb = bb; |
| 98 | return this; |
| 99 | }; |
| 100 | |
| 101 | /** |
| 102 | * @returns {number} |
| 103 | */ |
| 104 | a():number { |
| 105 | return this.bb.readInt16(this.bb_pos); |
| 106 | }; |
| 107 | |
| 108 | /** |
| 109 | * @param {number} value |
| 110 | * @returns {boolean} |
| 111 | */ |
| 112 | mutate_a(value:number):boolean { |
| 113 | var offset = this.bb.__offset(this.bb_pos, 0); |
| 114 | |
| 115 | if (offset === 0) { |
| 116 | return false; |
| 117 | } |
| 118 | |
| 119 | this.bb.writeInt16(this.bb_pos + offset, value); |
| 120 | return true; |
| 121 | }; |
| 122 | |
| 123 | /** |
| 124 | * @returns {number} |
| 125 | */ |
| 126 | b():number { |
| 127 | return this.bb.readInt8(this.bb_pos + 2); |
| 128 | }; |
| 129 | |
| 130 | /** |
| 131 | * @param {number} value |
| 132 | * @returns {boolean} |
| 133 | */ |
| 134 | mutate_b(value:number):boolean { |
| 135 | var offset = this.bb.__offset(this.bb_pos, 2); |
| 136 | |
| 137 | if (offset === 0) { |
| 138 | return false; |
| 139 | } |
| 140 | |
| 141 | this.bb.writeInt8(this.bb_pos + offset, value); |
| 142 | return true; |
| 143 | }; |
| 144 | |
| 145 | /** |
| 146 | * @param {flatbuffers.Builder} builder |
| 147 | * @param {number} a |
| 148 | * @param {number} b |
| 149 | * @returns {flatbuffers.Offset} |
| 150 | */ |
Kamil Rojewski | 3d2cf55 | 2017-05-18 19:30:30 +0200 | [diff] [blame] | 151 | static createTest(builder:flatbuffers.Builder, a: number, b: number):flatbuffers.Offset { |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 152 | builder.prep(2, 4); |
| 153 | builder.pad(1); |
| 154 | builder.writeInt8(b); |
| 155 | builder.writeInt16(a); |
| 156 | return builder.offset(); |
| 157 | }; |
| 158 | |
| 159 | } |
| 160 | } |
| 161 | /** |
| 162 | * @constructor |
| 163 | */ |
| 164 | export namespace MyGame.Example{ |
| 165 | export class TestSimpleTableWithEnum { |
| 166 | /** |
| 167 | * @type {flatbuffers.ByteBuffer} |
| 168 | */ |
Kamil Rojewski | 86777bd | 2017-05-02 01:05:53 +0200 | [diff] [blame] | 169 | bb: flatbuffers.ByteBuffer; |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 170 | |
| 171 | /** |
| 172 | * @type {number} |
| 173 | */ |
| 174 | bb_pos:number = 0; |
| 175 | /** |
| 176 | * @param {number} i |
| 177 | * @param {flatbuffers.ByteBuffer} bb |
| 178 | * @returns {TestSimpleTableWithEnum} |
| 179 | */ |
| 180 | __init(i:number, bb:flatbuffers.ByteBuffer):TestSimpleTableWithEnum { |
| 181 | this.bb_pos = i; |
| 182 | this.bb = bb; |
| 183 | return this; |
| 184 | }; |
| 185 | |
| 186 | /** |
| 187 | * @param {flatbuffers.ByteBuffer} bb |
| 188 | * @param {TestSimpleTableWithEnum=} obj |
| 189 | * @returns {TestSimpleTableWithEnum} |
| 190 | */ |
| 191 | static getRootAsTestSimpleTableWithEnum(bb:flatbuffers.ByteBuffer, obj?:TestSimpleTableWithEnum):TestSimpleTableWithEnum { |
| 192 | return (obj || new TestSimpleTableWithEnum).__init(bb.readInt32(bb.position()) + bb.position(), bb); |
| 193 | }; |
| 194 | |
| 195 | /** |
| 196 | * @returns {MyGame.Example.Color} |
| 197 | */ |
| 198 | color():MyGame.Example.Color { |
| 199 | var offset = this.bb.__offset(this.bb_pos, 4); |
| 200 | return offset ? /** @type {MyGame.Example.Color} */ (this.bb.readInt8(this.bb_pos + offset)) : MyGame.Example.Color.Green; |
| 201 | }; |
| 202 | |
| 203 | /** |
| 204 | * @param {MyGame.Example.Color} value |
| 205 | * @returns {boolean} |
| 206 | */ |
| 207 | mutate_color(value:MyGame.Example.Color):boolean { |
| 208 | var offset = this.bb.__offset(this.bb_pos, 4); |
| 209 | |
| 210 | if (offset === 0) { |
| 211 | return false; |
| 212 | } |
| 213 | |
| 214 | this.bb.writeInt8(this.bb_pos + offset, value); |
| 215 | return true; |
| 216 | }; |
| 217 | |
| 218 | /** |
| 219 | * @param {flatbuffers.Builder} builder |
| 220 | */ |
| 221 | static startTestSimpleTableWithEnum(builder:flatbuffers.Builder) { |
| 222 | builder.startObject(1); |
| 223 | }; |
| 224 | |
| 225 | /** |
| 226 | * @param {flatbuffers.Builder} builder |
| 227 | * @param {MyGame.Example.Color} color |
| 228 | */ |
| 229 | static addColor(builder:flatbuffers.Builder, color:MyGame.Example.Color) { |
| 230 | builder.addFieldInt8(0, color, MyGame.Example.Color.Green); |
| 231 | }; |
| 232 | |
| 233 | /** |
| 234 | * @param {flatbuffers.Builder} builder |
| 235 | * @returns {flatbuffers.Offset} |
| 236 | */ |
| 237 | static endTestSimpleTableWithEnum(builder:flatbuffers.Builder):flatbuffers.Offset { |
| 238 | var offset = builder.endObject(); |
| 239 | return offset; |
| 240 | }; |
| 241 | |
| 242 | } |
| 243 | } |
| 244 | /** |
| 245 | * @constructor |
| 246 | */ |
| 247 | export namespace MyGame.Example{ |
| 248 | export class Vec3 { |
| 249 | /** |
| 250 | * @type {flatbuffers.ByteBuffer} |
| 251 | */ |
Kamil Rojewski | 86777bd | 2017-05-02 01:05:53 +0200 | [diff] [blame] | 252 | bb: flatbuffers.ByteBuffer; |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 253 | |
| 254 | /** |
| 255 | * @type {number} |
| 256 | */ |
| 257 | bb_pos:number = 0; |
| 258 | /** |
| 259 | * @param {number} i |
| 260 | * @param {flatbuffers.ByteBuffer} bb |
| 261 | * @returns {Vec3} |
| 262 | */ |
| 263 | __init(i:number, bb:flatbuffers.ByteBuffer):Vec3 { |
| 264 | this.bb_pos = i; |
| 265 | this.bb = bb; |
| 266 | return this; |
| 267 | }; |
| 268 | |
| 269 | /** |
| 270 | * @returns {number} |
| 271 | */ |
| 272 | x():number { |
| 273 | return this.bb.readFloat32(this.bb_pos); |
| 274 | }; |
| 275 | |
| 276 | /** |
| 277 | * @param {number} value |
| 278 | * @returns {boolean} |
| 279 | */ |
| 280 | mutate_x(value:number):boolean { |
| 281 | var offset = this.bb.__offset(this.bb_pos, 0); |
| 282 | |
| 283 | if (offset === 0) { |
| 284 | return false; |
| 285 | } |
| 286 | |
| 287 | this.bb.writeFloat32(this.bb_pos + offset, value); |
| 288 | return true; |
| 289 | }; |
| 290 | |
| 291 | /** |
| 292 | * @returns {number} |
| 293 | */ |
| 294 | y():number { |
| 295 | return this.bb.readFloat32(this.bb_pos + 4); |
| 296 | }; |
| 297 | |
| 298 | /** |
| 299 | * @param {number} value |
| 300 | * @returns {boolean} |
| 301 | */ |
| 302 | mutate_y(value:number):boolean { |
| 303 | var offset = this.bb.__offset(this.bb_pos, 4); |
| 304 | |
| 305 | if (offset === 0) { |
| 306 | return false; |
| 307 | } |
| 308 | |
| 309 | this.bb.writeFloat32(this.bb_pos + offset, value); |
| 310 | return true; |
| 311 | }; |
| 312 | |
| 313 | /** |
| 314 | * @returns {number} |
| 315 | */ |
| 316 | z():number { |
| 317 | return this.bb.readFloat32(this.bb_pos + 8); |
| 318 | }; |
| 319 | |
| 320 | /** |
| 321 | * @param {number} value |
| 322 | * @returns {boolean} |
| 323 | */ |
| 324 | mutate_z(value:number):boolean { |
| 325 | var offset = this.bb.__offset(this.bb_pos, 8); |
| 326 | |
| 327 | if (offset === 0) { |
| 328 | return false; |
| 329 | } |
| 330 | |
| 331 | this.bb.writeFloat32(this.bb_pos + offset, value); |
| 332 | return true; |
| 333 | }; |
| 334 | |
| 335 | /** |
| 336 | * @returns {number} |
| 337 | */ |
| 338 | test1():number { |
| 339 | return this.bb.readFloat64(this.bb_pos + 16); |
| 340 | }; |
| 341 | |
| 342 | /** |
| 343 | * @param {number} value |
| 344 | * @returns {boolean} |
| 345 | */ |
| 346 | mutate_test1(value:number):boolean { |
| 347 | var offset = this.bb.__offset(this.bb_pos, 16); |
| 348 | |
| 349 | if (offset === 0) { |
| 350 | return false; |
| 351 | } |
| 352 | |
| 353 | this.bb.writeFloat64(this.bb_pos + offset, value); |
| 354 | return true; |
| 355 | }; |
| 356 | |
| 357 | /** |
| 358 | * @returns {MyGame.Example.Color} |
| 359 | */ |
| 360 | test2():MyGame.Example.Color { |
| 361 | return /** @type {MyGame.Example.Color} */ (this.bb.readInt8(this.bb_pos + 24)); |
| 362 | }; |
| 363 | |
| 364 | /** |
| 365 | * @param {MyGame.Example.Color} value |
| 366 | * @returns {boolean} |
| 367 | */ |
| 368 | mutate_test2(value:MyGame.Example.Color):boolean { |
| 369 | var offset = this.bb.__offset(this.bb_pos, 24); |
| 370 | |
| 371 | if (offset === 0) { |
| 372 | return false; |
| 373 | } |
| 374 | |
| 375 | this.bb.writeInt8(this.bb_pos + offset, value); |
| 376 | return true; |
| 377 | }; |
| 378 | |
| 379 | /** |
| 380 | * @param {MyGame.Example.Test=} obj |
Wouter van Oortmerssen | a0a313b | 2017-05-10 13:25:51 -0700 | [diff] [blame] | 381 | * @returns {MyGame.Example.Test|null} |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 382 | */ |
Wouter van Oortmerssen | a0a313b | 2017-05-10 13:25:51 -0700 | [diff] [blame] | 383 | test3(obj?:MyGame.Example.Test):MyGame.Example.Test|null { |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 384 | return (obj || new MyGame.Example.Test).__init(this.bb_pos + 26, this.bb); |
| 385 | }; |
| 386 | |
| 387 | /** |
| 388 | * @param {flatbuffers.Builder} builder |
| 389 | * @param {number} x |
| 390 | * @param {number} y |
| 391 | * @param {number} z |
| 392 | * @param {number} test1 |
| 393 | * @param {MyGame.Example.Color} test2 |
| 394 | * @param {number} test3_a |
| 395 | * @param {number} test3_b |
| 396 | * @returns {flatbuffers.Offset} |
| 397 | */ |
Kamil Rojewski | 3d2cf55 | 2017-05-18 19:30:30 +0200 | [diff] [blame] | 398 | static createVec3(builder:flatbuffers.Builder, x: number, y: number, z: number, test1: number, test2: MyGame.Example.Color, test3_a: number, test3_b: number):flatbuffers.Offset { |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 399 | builder.prep(16, 32); |
| 400 | builder.pad(2); |
| 401 | builder.prep(2, 4); |
| 402 | builder.pad(1); |
| 403 | builder.writeInt8(test3_b); |
| 404 | builder.writeInt16(test3_a); |
| 405 | builder.pad(1); |
| 406 | builder.writeInt8(test2); |
| 407 | builder.writeFloat64(test1); |
| 408 | builder.pad(4); |
| 409 | builder.writeFloat32(z); |
| 410 | builder.writeFloat32(y); |
| 411 | builder.writeFloat32(x); |
| 412 | return builder.offset(); |
| 413 | }; |
| 414 | |
| 415 | } |
| 416 | } |
| 417 | /** |
| 418 | * @constructor |
| 419 | */ |
| 420 | export namespace MyGame.Example{ |
| 421 | export class Ability { |
| 422 | /** |
| 423 | * @type {flatbuffers.ByteBuffer} |
| 424 | */ |
Kamil Rojewski | 86777bd | 2017-05-02 01:05:53 +0200 | [diff] [blame] | 425 | bb: flatbuffers.ByteBuffer; |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 426 | |
| 427 | /** |
| 428 | * @type {number} |
| 429 | */ |
| 430 | bb_pos:number = 0; |
| 431 | /** |
| 432 | * @param {number} i |
| 433 | * @param {flatbuffers.ByteBuffer} bb |
| 434 | * @returns {Ability} |
| 435 | */ |
| 436 | __init(i:number, bb:flatbuffers.ByteBuffer):Ability { |
| 437 | this.bb_pos = i; |
| 438 | this.bb = bb; |
| 439 | return this; |
| 440 | }; |
| 441 | |
| 442 | /** |
| 443 | * @returns {number} |
| 444 | */ |
| 445 | id():number { |
| 446 | return this.bb.readUint32(this.bb_pos); |
| 447 | }; |
| 448 | |
| 449 | /** |
| 450 | * @param {number} value |
| 451 | * @returns {boolean} |
| 452 | */ |
| 453 | mutate_id(value:number):boolean { |
| 454 | var offset = this.bb.__offset(this.bb_pos, 0); |
| 455 | |
| 456 | if (offset === 0) { |
| 457 | return false; |
| 458 | } |
| 459 | |
| 460 | this.bb.writeUint32(this.bb_pos + offset, value); |
| 461 | return true; |
| 462 | }; |
| 463 | |
| 464 | /** |
| 465 | * @returns {number} |
| 466 | */ |
| 467 | distance():number { |
| 468 | return this.bb.readUint32(this.bb_pos + 4); |
| 469 | }; |
| 470 | |
| 471 | /** |
| 472 | * @param {number} value |
| 473 | * @returns {boolean} |
| 474 | */ |
| 475 | mutate_distance(value:number):boolean { |
| 476 | var offset = this.bb.__offset(this.bb_pos, 4); |
| 477 | |
| 478 | if (offset === 0) { |
| 479 | return false; |
| 480 | } |
| 481 | |
| 482 | this.bb.writeUint32(this.bb_pos + offset, value); |
| 483 | return true; |
| 484 | }; |
| 485 | |
| 486 | /** |
| 487 | * @param {flatbuffers.Builder} builder |
| 488 | * @param {number} id |
| 489 | * @param {number} distance |
| 490 | * @returns {flatbuffers.Offset} |
| 491 | */ |
Kamil Rojewski | 3d2cf55 | 2017-05-18 19:30:30 +0200 | [diff] [blame] | 492 | static createAbility(builder:flatbuffers.Builder, id: number, distance: number):flatbuffers.Offset { |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 493 | builder.prep(4, 8); |
| 494 | builder.writeInt32(distance); |
| 495 | builder.writeInt32(id); |
| 496 | return builder.offset(); |
| 497 | }; |
| 498 | |
| 499 | } |
| 500 | } |
| 501 | /** |
| 502 | * @constructor |
| 503 | */ |
| 504 | export namespace MyGame.Example{ |
| 505 | export class Stat { |
| 506 | /** |
| 507 | * @type {flatbuffers.ByteBuffer} |
| 508 | */ |
Kamil Rojewski | 86777bd | 2017-05-02 01:05:53 +0200 | [diff] [blame] | 509 | bb: flatbuffers.ByteBuffer; |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 510 | |
| 511 | /** |
| 512 | * @type {number} |
| 513 | */ |
| 514 | bb_pos:number = 0; |
| 515 | /** |
| 516 | * @param {number} i |
| 517 | * @param {flatbuffers.ByteBuffer} bb |
| 518 | * @returns {Stat} |
| 519 | */ |
| 520 | __init(i:number, bb:flatbuffers.ByteBuffer):Stat { |
| 521 | this.bb_pos = i; |
| 522 | this.bb = bb; |
| 523 | return this; |
| 524 | }; |
| 525 | |
| 526 | /** |
| 527 | * @param {flatbuffers.ByteBuffer} bb |
| 528 | * @param {Stat=} obj |
| 529 | * @returns {Stat} |
| 530 | */ |
| 531 | static getRootAsStat(bb:flatbuffers.ByteBuffer, obj?:Stat):Stat { |
| 532 | return (obj || new Stat).__init(bb.readInt32(bb.position()) + bb.position(), bb); |
| 533 | }; |
| 534 | |
| 535 | /** |
| 536 | * @param {flatbuffers.Encoding=} optionalEncoding |
Kamil Rojewski | 86777bd | 2017-05-02 01:05:53 +0200 | [diff] [blame] | 537 | * @returns {string|Uint8Array|null} |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 538 | */ |
Kamil Rojewski | 86777bd | 2017-05-02 01:05:53 +0200 | [diff] [blame] | 539 | id():string|null |
| 540 | id(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null |
Wouter van Oortmerssen | a0a313b | 2017-05-10 13:25:51 -0700 | [diff] [blame] | 541 | id(optionalEncoding?:any):string|Uint8Array|null { |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 542 | var offset = this.bb.__offset(this.bb_pos, 4); |
| 543 | return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; |
| 544 | }; |
| 545 | |
| 546 | /** |
| 547 | * @returns {flatbuffers.Long} |
| 548 | */ |
| 549 | val():flatbuffers.Long { |
| 550 | var offset = this.bb.__offset(this.bb_pos, 6); |
| 551 | return offset ? this.bb.readInt64(this.bb_pos + offset) : this.bb.createLong(0, 0); |
| 552 | }; |
| 553 | |
| 554 | /** |
| 555 | * @param {flatbuffers.Long} value |
| 556 | * @returns {boolean} |
| 557 | */ |
| 558 | mutate_val(value:flatbuffers.Long):boolean { |
| 559 | var offset = this.bb.__offset(this.bb_pos, 6); |
| 560 | |
| 561 | if (offset === 0) { |
| 562 | return false; |
| 563 | } |
| 564 | |
| 565 | this.bb.writeInt64(this.bb_pos + offset, value); |
| 566 | return true; |
| 567 | }; |
| 568 | |
| 569 | /** |
| 570 | * @returns {number} |
| 571 | */ |
| 572 | count():number { |
| 573 | var offset = this.bb.__offset(this.bb_pos, 8); |
| 574 | return offset ? this.bb.readUint16(this.bb_pos + offset) : 0; |
| 575 | }; |
| 576 | |
| 577 | /** |
| 578 | * @param {number} value |
| 579 | * @returns {boolean} |
| 580 | */ |
| 581 | mutate_count(value:number):boolean { |
| 582 | var offset = this.bb.__offset(this.bb_pos, 8); |
| 583 | |
| 584 | if (offset === 0) { |
| 585 | return false; |
| 586 | } |
| 587 | |
| 588 | this.bb.writeUint16(this.bb_pos + offset, value); |
| 589 | return true; |
| 590 | }; |
| 591 | |
| 592 | /** |
| 593 | * @param {flatbuffers.Builder} builder |
| 594 | */ |
| 595 | static startStat(builder:flatbuffers.Builder) { |
| 596 | builder.startObject(3); |
| 597 | }; |
| 598 | |
| 599 | /** |
| 600 | * @param {flatbuffers.Builder} builder |
| 601 | * @param {flatbuffers.Offset} idOffset |
| 602 | */ |
| 603 | static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) { |
| 604 | builder.addFieldOffset(0, idOffset, 0); |
| 605 | }; |
| 606 | |
| 607 | /** |
| 608 | * @param {flatbuffers.Builder} builder |
| 609 | * @param {flatbuffers.Long} val |
| 610 | */ |
| 611 | static addVal(builder:flatbuffers.Builder, val:flatbuffers.Long) { |
| 612 | builder.addFieldInt64(1, val, builder.createLong(0, 0)); |
| 613 | }; |
| 614 | |
| 615 | /** |
| 616 | * @param {flatbuffers.Builder} builder |
| 617 | * @param {number} count |
| 618 | */ |
| 619 | static addCount(builder:flatbuffers.Builder, count:number) { |
| 620 | builder.addFieldInt16(2, count, 0); |
| 621 | }; |
| 622 | |
| 623 | /** |
| 624 | * @param {flatbuffers.Builder} builder |
| 625 | * @returns {flatbuffers.Offset} |
| 626 | */ |
| 627 | static endStat(builder:flatbuffers.Builder):flatbuffers.Offset { |
| 628 | var offset = builder.endObject(); |
| 629 | return offset; |
| 630 | }; |
| 631 | |
| 632 | } |
| 633 | } |
| 634 | /** |
| 635 | * an example documentation comment: monster object |
| 636 | * |
| 637 | * @constructor |
| 638 | */ |
| 639 | export namespace MyGame.Example{ |
| 640 | export class Monster { |
| 641 | /** |
| 642 | * @type {flatbuffers.ByteBuffer} |
| 643 | */ |
Kamil Rojewski | 86777bd | 2017-05-02 01:05:53 +0200 | [diff] [blame] | 644 | bb: flatbuffers.ByteBuffer; |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 645 | |
| 646 | /** |
| 647 | * @type {number} |
| 648 | */ |
| 649 | bb_pos:number = 0; |
| 650 | /** |
| 651 | * @param {number} i |
| 652 | * @param {flatbuffers.ByteBuffer} bb |
| 653 | * @returns {Monster} |
| 654 | */ |
| 655 | __init(i:number, bb:flatbuffers.ByteBuffer):Monster { |
| 656 | this.bb_pos = i; |
| 657 | this.bb = bb; |
| 658 | return this; |
| 659 | }; |
| 660 | |
| 661 | /** |
| 662 | * @param {flatbuffers.ByteBuffer} bb |
| 663 | * @param {Monster=} obj |
| 664 | * @returns {Monster} |
| 665 | */ |
| 666 | static getRootAsMonster(bb:flatbuffers.ByteBuffer, obj?:Monster):Monster { |
| 667 | return (obj || new Monster).__init(bb.readInt32(bb.position()) + bb.position(), bb); |
| 668 | }; |
| 669 | |
| 670 | /** |
| 671 | * @param {flatbuffers.ByteBuffer} bb |
| 672 | * @returns {boolean} |
| 673 | */ |
| 674 | static bufferHasIdentifier(bb:flatbuffers.ByteBuffer):boolean { |
| 675 | return bb.__has_identifier('MONS'); |
| 676 | }; |
| 677 | |
| 678 | /** |
| 679 | * @param {MyGame.Example.Vec3=} obj |
Wouter van Oortmerssen | a0a313b | 2017-05-10 13:25:51 -0700 | [diff] [blame] | 680 | * @returns {MyGame.Example.Vec3|null} |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 681 | */ |
Wouter van Oortmerssen | a0a313b | 2017-05-10 13:25:51 -0700 | [diff] [blame] | 682 | pos(obj?:MyGame.Example.Vec3):MyGame.Example.Vec3|null { |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 683 | var offset = this.bb.__offset(this.bb_pos, 4); |
| 684 | return offset ? (obj || new MyGame.Example.Vec3).__init(this.bb_pos + offset, this.bb) : null; |
| 685 | }; |
| 686 | |
| 687 | /** |
| 688 | * @returns {number} |
| 689 | */ |
| 690 | mana():number { |
| 691 | var offset = this.bb.__offset(this.bb_pos, 6); |
| 692 | return offset ? this.bb.readInt16(this.bb_pos + offset) : 150; |
| 693 | }; |
| 694 | |
| 695 | /** |
| 696 | * @param {number} value |
| 697 | * @returns {boolean} |
| 698 | */ |
| 699 | mutate_mana(value:number):boolean { |
| 700 | var offset = this.bb.__offset(this.bb_pos, 6); |
| 701 | |
| 702 | if (offset === 0) { |
| 703 | return false; |
| 704 | } |
| 705 | |
| 706 | this.bb.writeInt16(this.bb_pos + offset, value); |
| 707 | return true; |
| 708 | }; |
| 709 | |
| 710 | /** |
| 711 | * @returns {number} |
| 712 | */ |
| 713 | hp():number { |
| 714 | var offset = this.bb.__offset(this.bb_pos, 8); |
| 715 | return offset ? this.bb.readInt16(this.bb_pos + offset) : 100; |
| 716 | }; |
| 717 | |
| 718 | /** |
| 719 | * @param {number} value |
| 720 | * @returns {boolean} |
| 721 | */ |
| 722 | mutate_hp(value:number):boolean { |
| 723 | var offset = this.bb.__offset(this.bb_pos, 8); |
| 724 | |
| 725 | if (offset === 0) { |
| 726 | return false; |
| 727 | } |
| 728 | |
| 729 | this.bb.writeInt16(this.bb_pos + offset, value); |
| 730 | return true; |
| 731 | }; |
| 732 | |
| 733 | /** |
| 734 | * @param {flatbuffers.Encoding=} optionalEncoding |
Kamil Rojewski | 86777bd | 2017-05-02 01:05:53 +0200 | [diff] [blame] | 735 | * @returns {string|Uint8Array|null} |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 736 | */ |
Kamil Rojewski | 86777bd | 2017-05-02 01:05:53 +0200 | [diff] [blame] | 737 | name():string|null |
| 738 | name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null |
Wouter van Oortmerssen | a0a313b | 2017-05-10 13:25:51 -0700 | [diff] [blame] | 739 | name(optionalEncoding?:any):string|Uint8Array|null { |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 740 | var offset = this.bb.__offset(this.bb_pos, 10); |
| 741 | return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; |
| 742 | }; |
| 743 | |
| 744 | /** |
| 745 | * @param {number} index |
| 746 | * @returns {number} |
| 747 | */ |
Wouter van Oortmerssen | a0a313b | 2017-05-10 13:25:51 -0700 | [diff] [blame] | 748 | inventory(index: number):number|null { |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 749 | var offset = this.bb.__offset(this.bb_pos, 14); |
| 750 | return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0; |
| 751 | }; |
| 752 | |
| 753 | /** |
| 754 | * @returns {number} |
| 755 | */ |
| 756 | inventoryLength():number { |
| 757 | var offset = this.bb.__offset(this.bb_pos, 14); |
| 758 | return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; |
| 759 | }; |
| 760 | |
| 761 | /** |
| 762 | * @returns {Uint8Array} |
| 763 | */ |
Wouter van Oortmerssen | a0a313b | 2017-05-10 13:25:51 -0700 | [diff] [blame] | 764 | inventoryArray():Uint8Array|null { |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 765 | var offset = this.bb.__offset(this.bb_pos, 14); |
| 766 | return offset ? new Uint8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null; |
| 767 | }; |
| 768 | |
| 769 | /** |
| 770 | * @returns {MyGame.Example.Color} |
| 771 | */ |
| 772 | color():MyGame.Example.Color { |
| 773 | var offset = this.bb.__offset(this.bb_pos, 16); |
| 774 | return offset ? /** @type {MyGame.Example.Color} */ (this.bb.readInt8(this.bb_pos + offset)) : MyGame.Example.Color.Blue; |
| 775 | }; |
| 776 | |
| 777 | /** |
| 778 | * @param {MyGame.Example.Color} value |
| 779 | * @returns {boolean} |
| 780 | */ |
| 781 | mutate_color(value:MyGame.Example.Color):boolean { |
| 782 | var offset = this.bb.__offset(this.bb_pos, 16); |
| 783 | |
| 784 | if (offset === 0) { |
| 785 | return false; |
| 786 | } |
| 787 | |
| 788 | this.bb.writeInt8(this.bb_pos + offset, value); |
| 789 | return true; |
| 790 | }; |
| 791 | |
| 792 | /** |
| 793 | * @returns {MyGame.Example.Any} |
| 794 | */ |
| 795 | testType():MyGame.Example.Any { |
| 796 | var offset = this.bb.__offset(this.bb_pos, 18); |
| 797 | return offset ? /** @type {MyGame.Example.Any} */ (this.bb.readUint8(this.bb_pos + offset)) : MyGame.Example.Any.NONE; |
| 798 | }; |
| 799 | |
| 800 | /** |
| 801 | * @param {MyGame.Example.Any} value |
| 802 | * @returns {boolean} |
| 803 | */ |
| 804 | mutate_test_type(value:MyGame.Example.Any):boolean { |
| 805 | var offset = this.bb.__offset(this.bb_pos, 18); |
| 806 | |
| 807 | if (offset === 0) { |
| 808 | return false; |
| 809 | } |
| 810 | |
| 811 | this.bb.writeUint8(this.bb_pos + offset, value); |
| 812 | return true; |
| 813 | }; |
| 814 | |
| 815 | /** |
| 816 | * @param {flatbuffers.Table} obj |
| 817 | * @returns {?flatbuffers.Table} |
| 818 | */ |
Wouter van Oortmerssen | a0a313b | 2017-05-10 13:25:51 -0700 | [diff] [blame] | 819 | test<T extends flatbuffers.Table>(obj:T):T|null { |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 820 | var offset = this.bb.__offset(this.bb_pos, 20); |
| 821 | return offset ? this.bb.__union(obj, this.bb_pos + offset) : null; |
| 822 | }; |
| 823 | |
| 824 | /** |
| 825 | * @param {number} index |
| 826 | * @param {MyGame.Example.Test=} obj |
| 827 | * @returns {MyGame.Example.Test} |
| 828 | */ |
Wouter van Oortmerssen | a0a313b | 2017-05-10 13:25:51 -0700 | [diff] [blame] | 829 | test4(index: number, obj?:MyGame.Example.Test):MyGame.Example.Test|null { |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 830 | var offset = this.bb.__offset(this.bb_pos, 22); |
| 831 | return offset ? (obj || new MyGame.Example.Test).__init(this.bb.__vector(this.bb_pos + offset) + index * 4, this.bb) : null; |
| 832 | }; |
| 833 | |
| 834 | /** |
| 835 | * @returns {number} |
| 836 | */ |
| 837 | test4Length():number { |
| 838 | var offset = this.bb.__offset(this.bb_pos, 22); |
| 839 | return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; |
| 840 | }; |
| 841 | |
| 842 | /** |
| 843 | * @param {number} index |
| 844 | * @param {flatbuffers.Encoding=} optionalEncoding |
| 845 | * @returns {string|Uint8Array} |
| 846 | */ |
| 847 | testarrayofstring(index: number):string |
| 848 | testarrayofstring(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array |
Wouter van Oortmerssen | a0a313b | 2017-05-10 13:25:51 -0700 | [diff] [blame] | 849 | testarrayofstring(index: number,optionalEncoding?:any):string|Uint8Array|null { |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 850 | var offset = this.bb.__offset(this.bb_pos, 24); |
| 851 | return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null; |
| 852 | }; |
| 853 | |
| 854 | /** |
| 855 | * @returns {number} |
| 856 | */ |
| 857 | testarrayofstringLength():number { |
| 858 | var offset = this.bb.__offset(this.bb_pos, 24); |
| 859 | return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; |
| 860 | }; |
| 861 | |
| 862 | /** |
| 863 | * an example documentation comment: this will end up in the generated code |
| 864 | * multiline too |
| 865 | * |
| 866 | * @param {number} index |
| 867 | * @param {MyGame.Example.Monster=} obj |
| 868 | * @returns {MyGame.Example.Monster} |
| 869 | */ |
Wouter van Oortmerssen | a0a313b | 2017-05-10 13:25:51 -0700 | [diff] [blame] | 870 | testarrayoftables(index: number, obj?:MyGame.Example.Monster):MyGame.Example.Monster|null { |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 871 | var offset = this.bb.__offset(this.bb_pos, 26); |
| 872 | return offset ? (obj || new MyGame.Example.Monster).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null; |
| 873 | }; |
| 874 | |
| 875 | /** |
| 876 | * @returns {number} |
| 877 | */ |
| 878 | testarrayoftablesLength():number { |
| 879 | var offset = this.bb.__offset(this.bb_pos, 26); |
| 880 | return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; |
| 881 | }; |
| 882 | |
| 883 | /** |
| 884 | * @param {MyGame.Example.Monster=} obj |
Wouter van Oortmerssen | a0a313b | 2017-05-10 13:25:51 -0700 | [diff] [blame] | 885 | * @returns {MyGame.Example.Monster|null} |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 886 | */ |
Wouter van Oortmerssen | a0a313b | 2017-05-10 13:25:51 -0700 | [diff] [blame] | 887 | enemy(obj?:MyGame.Example.Monster):MyGame.Example.Monster|null { |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 888 | var offset = this.bb.__offset(this.bb_pos, 28); |
| 889 | return offset ? (obj || new MyGame.Example.Monster).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null; |
| 890 | }; |
| 891 | |
| 892 | /** |
| 893 | * @param {number} index |
| 894 | * @returns {number} |
| 895 | */ |
Wouter van Oortmerssen | a0a313b | 2017-05-10 13:25:51 -0700 | [diff] [blame] | 896 | testnestedflatbuffer(index: number):number|null { |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 897 | var offset = this.bb.__offset(this.bb_pos, 30); |
| 898 | return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0; |
| 899 | }; |
| 900 | |
| 901 | /** |
| 902 | * @returns {number} |
| 903 | */ |
| 904 | testnestedflatbufferLength():number { |
| 905 | var offset = this.bb.__offset(this.bb_pos, 30); |
| 906 | return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; |
| 907 | }; |
| 908 | |
| 909 | /** |
| 910 | * @returns {Uint8Array} |
| 911 | */ |
Wouter van Oortmerssen | a0a313b | 2017-05-10 13:25:51 -0700 | [diff] [blame] | 912 | testnestedflatbufferArray():Uint8Array|null { |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 913 | var offset = this.bb.__offset(this.bb_pos, 30); |
| 914 | return offset ? new Uint8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null; |
| 915 | }; |
| 916 | |
| 917 | /** |
| 918 | * @param {MyGame.Example.Stat=} obj |
Wouter van Oortmerssen | a0a313b | 2017-05-10 13:25:51 -0700 | [diff] [blame] | 919 | * @returns {MyGame.Example.Stat|null} |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 920 | */ |
Wouter van Oortmerssen | a0a313b | 2017-05-10 13:25:51 -0700 | [diff] [blame] | 921 | testempty(obj?:MyGame.Example.Stat):MyGame.Example.Stat|null { |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 922 | var offset = this.bb.__offset(this.bb_pos, 32); |
| 923 | return offset ? (obj || new MyGame.Example.Stat).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null; |
| 924 | }; |
| 925 | |
| 926 | /** |
| 927 | * @returns {boolean} |
| 928 | */ |
| 929 | testbool():boolean { |
| 930 | var offset = this.bb.__offset(this.bb_pos, 34); |
| 931 | return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false; |
| 932 | }; |
| 933 | |
| 934 | /** |
| 935 | * @param {boolean} value |
| 936 | * @returns {boolean} |
| 937 | */ |
| 938 | mutate_testbool(value:boolean):boolean { |
| 939 | var offset = this.bb.__offset(this.bb_pos, 34); |
| 940 | |
| 941 | if (offset === 0) { |
| 942 | return false; |
| 943 | } |
| 944 | |
| 945 | this.bb.writeInt8(this.bb_pos + offset, +value); |
| 946 | return true; |
| 947 | }; |
| 948 | |
| 949 | /** |
| 950 | * @returns {number} |
| 951 | */ |
| 952 | testhashs32Fnv1():number { |
| 953 | var offset = this.bb.__offset(this.bb_pos, 36); |
| 954 | return offset ? this.bb.readInt32(this.bb_pos + offset) : 0; |
| 955 | }; |
| 956 | |
| 957 | /** |
| 958 | * @param {number} value |
| 959 | * @returns {boolean} |
| 960 | */ |
| 961 | mutate_testhashs32_fnv1(value:number):boolean { |
| 962 | var offset = this.bb.__offset(this.bb_pos, 36); |
| 963 | |
| 964 | if (offset === 0) { |
| 965 | return false; |
| 966 | } |
| 967 | |
| 968 | this.bb.writeInt32(this.bb_pos + offset, value); |
| 969 | return true; |
| 970 | }; |
| 971 | |
| 972 | /** |
| 973 | * @returns {number} |
| 974 | */ |
| 975 | testhashu32Fnv1():number { |
| 976 | var offset = this.bb.__offset(this.bb_pos, 38); |
| 977 | return offset ? this.bb.readUint32(this.bb_pos + offset) : 0; |
| 978 | }; |
| 979 | |
| 980 | /** |
| 981 | * @param {number} value |
| 982 | * @returns {boolean} |
| 983 | */ |
| 984 | mutate_testhashu32_fnv1(value:number):boolean { |
| 985 | var offset = this.bb.__offset(this.bb_pos, 38); |
| 986 | |
| 987 | if (offset === 0) { |
| 988 | return false; |
| 989 | } |
| 990 | |
| 991 | this.bb.writeUint32(this.bb_pos + offset, value); |
| 992 | return true; |
| 993 | }; |
| 994 | |
| 995 | /** |
| 996 | * @returns {flatbuffers.Long} |
| 997 | */ |
| 998 | testhashs64Fnv1():flatbuffers.Long { |
| 999 | var offset = this.bb.__offset(this.bb_pos, 40); |
| 1000 | return offset ? this.bb.readInt64(this.bb_pos + offset) : this.bb.createLong(0, 0); |
| 1001 | }; |
| 1002 | |
| 1003 | /** |
| 1004 | * @param {flatbuffers.Long} value |
| 1005 | * @returns {boolean} |
| 1006 | */ |
| 1007 | mutate_testhashs64_fnv1(value:flatbuffers.Long):boolean { |
| 1008 | var offset = this.bb.__offset(this.bb_pos, 40); |
| 1009 | |
| 1010 | if (offset === 0) { |
| 1011 | return false; |
| 1012 | } |
| 1013 | |
| 1014 | this.bb.writeInt64(this.bb_pos + offset, value); |
| 1015 | return true; |
| 1016 | }; |
| 1017 | |
| 1018 | /** |
| 1019 | * @returns {flatbuffers.Long} |
| 1020 | */ |
| 1021 | testhashu64Fnv1():flatbuffers.Long { |
| 1022 | var offset = this.bb.__offset(this.bb_pos, 42); |
| 1023 | return offset ? this.bb.readUint64(this.bb_pos + offset) : this.bb.createLong(0, 0); |
| 1024 | }; |
| 1025 | |
| 1026 | /** |
| 1027 | * @param {flatbuffers.Long} value |
| 1028 | * @returns {boolean} |
| 1029 | */ |
| 1030 | mutate_testhashu64_fnv1(value:flatbuffers.Long):boolean { |
| 1031 | var offset = this.bb.__offset(this.bb_pos, 42); |
| 1032 | |
| 1033 | if (offset === 0) { |
| 1034 | return false; |
| 1035 | } |
| 1036 | |
| 1037 | this.bb.writeUint64(this.bb_pos + offset, value); |
| 1038 | return true; |
| 1039 | }; |
| 1040 | |
| 1041 | /** |
| 1042 | * @returns {number} |
| 1043 | */ |
| 1044 | testhashs32Fnv1a():number { |
| 1045 | var offset = this.bb.__offset(this.bb_pos, 44); |
| 1046 | return offset ? this.bb.readInt32(this.bb_pos + offset) : 0; |
| 1047 | }; |
| 1048 | |
| 1049 | /** |
| 1050 | * @param {number} value |
| 1051 | * @returns {boolean} |
| 1052 | */ |
| 1053 | mutate_testhashs32_fnv1a(value:number):boolean { |
| 1054 | var offset = this.bb.__offset(this.bb_pos, 44); |
| 1055 | |
| 1056 | if (offset === 0) { |
| 1057 | return false; |
| 1058 | } |
| 1059 | |
| 1060 | this.bb.writeInt32(this.bb_pos + offset, value); |
| 1061 | return true; |
| 1062 | }; |
| 1063 | |
| 1064 | /** |
| 1065 | * @returns {number} |
| 1066 | */ |
| 1067 | testhashu32Fnv1a():number { |
| 1068 | var offset = this.bb.__offset(this.bb_pos, 46); |
| 1069 | return offset ? this.bb.readUint32(this.bb_pos + offset) : 0; |
| 1070 | }; |
| 1071 | |
| 1072 | /** |
| 1073 | * @param {number} value |
| 1074 | * @returns {boolean} |
| 1075 | */ |
| 1076 | mutate_testhashu32_fnv1a(value:number):boolean { |
| 1077 | var offset = this.bb.__offset(this.bb_pos, 46); |
| 1078 | |
| 1079 | if (offset === 0) { |
| 1080 | return false; |
| 1081 | } |
| 1082 | |
| 1083 | this.bb.writeUint32(this.bb_pos + offset, value); |
| 1084 | return true; |
| 1085 | }; |
| 1086 | |
| 1087 | /** |
| 1088 | * @returns {flatbuffers.Long} |
| 1089 | */ |
| 1090 | testhashs64Fnv1a():flatbuffers.Long { |
| 1091 | var offset = this.bb.__offset(this.bb_pos, 48); |
| 1092 | return offset ? this.bb.readInt64(this.bb_pos + offset) : this.bb.createLong(0, 0); |
| 1093 | }; |
| 1094 | |
| 1095 | /** |
| 1096 | * @param {flatbuffers.Long} value |
| 1097 | * @returns {boolean} |
| 1098 | */ |
| 1099 | mutate_testhashs64_fnv1a(value:flatbuffers.Long):boolean { |
| 1100 | var offset = this.bb.__offset(this.bb_pos, 48); |
| 1101 | |
| 1102 | if (offset === 0) { |
| 1103 | return false; |
| 1104 | } |
| 1105 | |
| 1106 | this.bb.writeInt64(this.bb_pos + offset, value); |
| 1107 | return true; |
| 1108 | }; |
| 1109 | |
| 1110 | /** |
| 1111 | * @returns {flatbuffers.Long} |
| 1112 | */ |
| 1113 | testhashu64Fnv1a():flatbuffers.Long { |
| 1114 | var offset = this.bb.__offset(this.bb_pos, 50); |
| 1115 | return offset ? this.bb.readUint64(this.bb_pos + offset) : this.bb.createLong(0, 0); |
| 1116 | }; |
| 1117 | |
| 1118 | /** |
| 1119 | * @param {flatbuffers.Long} value |
| 1120 | * @returns {boolean} |
| 1121 | */ |
| 1122 | mutate_testhashu64_fnv1a(value:flatbuffers.Long):boolean { |
| 1123 | var offset = this.bb.__offset(this.bb_pos, 50); |
| 1124 | |
| 1125 | if (offset === 0) { |
| 1126 | return false; |
| 1127 | } |
| 1128 | |
| 1129 | this.bb.writeUint64(this.bb_pos + offset, value); |
| 1130 | return true; |
| 1131 | }; |
| 1132 | |
| 1133 | /** |
| 1134 | * @param {number} index |
| 1135 | * @returns {boolean} |
| 1136 | */ |
Wouter van Oortmerssen | a0a313b | 2017-05-10 13:25:51 -0700 | [diff] [blame] | 1137 | testarrayofbools(index: number):boolean|null { |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 1138 | var offset = this.bb.__offset(this.bb_pos, 52); |
| 1139 | return offset ? !!this.bb.readInt8(this.bb.__vector(this.bb_pos + offset) + index) : false; |
| 1140 | }; |
| 1141 | |
| 1142 | /** |
| 1143 | * @returns {number} |
| 1144 | */ |
| 1145 | testarrayofboolsLength():number { |
| 1146 | var offset = this.bb.__offset(this.bb_pos, 52); |
| 1147 | return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; |
| 1148 | }; |
| 1149 | |
| 1150 | /** |
| 1151 | * @returns {Int8Array} |
| 1152 | */ |
Wouter van Oortmerssen | a0a313b | 2017-05-10 13:25:51 -0700 | [diff] [blame] | 1153 | testarrayofboolsArray():Int8Array|null { |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 1154 | var offset = this.bb.__offset(this.bb_pos, 52); |
| 1155 | return offset ? new Int8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null; |
| 1156 | }; |
| 1157 | |
| 1158 | /** |
| 1159 | * @returns {number} |
| 1160 | */ |
| 1161 | testf():number { |
| 1162 | var offset = this.bb.__offset(this.bb_pos, 54); |
| 1163 | return offset ? this.bb.readFloat32(this.bb_pos + offset) : 3.14159; |
| 1164 | }; |
| 1165 | |
| 1166 | /** |
| 1167 | * @param {number} value |
| 1168 | * @returns {boolean} |
| 1169 | */ |
| 1170 | mutate_testf(value:number):boolean { |
| 1171 | var offset = this.bb.__offset(this.bb_pos, 54); |
| 1172 | |
| 1173 | if (offset === 0) { |
| 1174 | return false; |
| 1175 | } |
| 1176 | |
| 1177 | this.bb.writeFloat32(this.bb_pos + offset, value); |
| 1178 | return true; |
| 1179 | }; |
| 1180 | |
| 1181 | /** |
| 1182 | * @returns {number} |
| 1183 | */ |
| 1184 | testf2():number { |
| 1185 | var offset = this.bb.__offset(this.bb_pos, 56); |
| 1186 | return offset ? this.bb.readFloat32(this.bb_pos + offset) : 3.0; |
| 1187 | }; |
| 1188 | |
| 1189 | /** |
| 1190 | * @param {number} value |
| 1191 | * @returns {boolean} |
| 1192 | */ |
| 1193 | mutate_testf2(value:number):boolean { |
| 1194 | var offset = this.bb.__offset(this.bb_pos, 56); |
| 1195 | |
| 1196 | if (offset === 0) { |
| 1197 | return false; |
| 1198 | } |
| 1199 | |
| 1200 | this.bb.writeFloat32(this.bb_pos + offset, value); |
| 1201 | return true; |
| 1202 | }; |
| 1203 | |
| 1204 | /** |
| 1205 | * @returns {number} |
| 1206 | */ |
| 1207 | testf3():number { |
| 1208 | var offset = this.bb.__offset(this.bb_pos, 58); |
| 1209 | return offset ? this.bb.readFloat32(this.bb_pos + offset) : 0.0; |
| 1210 | }; |
| 1211 | |
| 1212 | /** |
| 1213 | * @param {number} value |
| 1214 | * @returns {boolean} |
| 1215 | */ |
| 1216 | mutate_testf3(value:number):boolean { |
| 1217 | var offset = this.bb.__offset(this.bb_pos, 58); |
| 1218 | |
| 1219 | if (offset === 0) { |
| 1220 | return false; |
| 1221 | } |
| 1222 | |
| 1223 | this.bb.writeFloat32(this.bb_pos + offset, value); |
| 1224 | return true; |
| 1225 | }; |
| 1226 | |
| 1227 | /** |
| 1228 | * @param {number} index |
| 1229 | * @param {flatbuffers.Encoding=} optionalEncoding |
| 1230 | * @returns {string|Uint8Array} |
| 1231 | */ |
| 1232 | testarrayofstring2(index: number):string |
| 1233 | testarrayofstring2(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array |
Wouter van Oortmerssen | a0a313b | 2017-05-10 13:25:51 -0700 | [diff] [blame] | 1234 | testarrayofstring2(index: number,optionalEncoding?:any):string|Uint8Array|null { |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 1235 | var offset = this.bb.__offset(this.bb_pos, 60); |
| 1236 | return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null; |
| 1237 | }; |
| 1238 | |
| 1239 | /** |
| 1240 | * @returns {number} |
| 1241 | */ |
| 1242 | testarrayofstring2Length():number { |
| 1243 | var offset = this.bb.__offset(this.bb_pos, 60); |
| 1244 | return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; |
| 1245 | }; |
| 1246 | |
| 1247 | /** |
| 1248 | * @param {number} index |
| 1249 | * @param {MyGame.Example.Ability=} obj |
| 1250 | * @returns {MyGame.Example.Ability} |
| 1251 | */ |
Wouter van Oortmerssen | a0a313b | 2017-05-10 13:25:51 -0700 | [diff] [blame] | 1252 | testarrayofsortedstruct(index: number, obj?:MyGame.Example.Ability):MyGame.Example.Ability|null { |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 1253 | var offset = this.bb.__offset(this.bb_pos, 62); |
| 1254 | return offset ? (obj || new MyGame.Example.Ability).__init(this.bb.__vector(this.bb_pos + offset) + index * 8, this.bb) : null; |
| 1255 | }; |
| 1256 | |
| 1257 | /** |
| 1258 | * @returns {number} |
| 1259 | */ |
| 1260 | testarrayofsortedstructLength():number { |
| 1261 | var offset = this.bb.__offset(this.bb_pos, 62); |
| 1262 | return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; |
| 1263 | }; |
| 1264 | |
| 1265 | /** |
| 1266 | * @param {flatbuffers.Builder} builder |
| 1267 | */ |
| 1268 | static startMonster(builder:flatbuffers.Builder) { |
| 1269 | builder.startObject(30); |
| 1270 | }; |
| 1271 | |
| 1272 | /** |
| 1273 | * @param {flatbuffers.Builder} builder |
| 1274 | * @param {flatbuffers.Offset} posOffset |
| 1275 | */ |
| 1276 | static addPos(builder:flatbuffers.Builder, posOffset:flatbuffers.Offset) { |
| 1277 | builder.addFieldStruct(0, posOffset, 0); |
| 1278 | }; |
| 1279 | |
| 1280 | /** |
| 1281 | * @param {flatbuffers.Builder} builder |
| 1282 | * @param {number} mana |
| 1283 | */ |
| 1284 | static addMana(builder:flatbuffers.Builder, mana:number) { |
| 1285 | builder.addFieldInt16(1, mana, 150); |
| 1286 | }; |
| 1287 | |
| 1288 | /** |
| 1289 | * @param {flatbuffers.Builder} builder |
| 1290 | * @param {number} hp |
| 1291 | */ |
| 1292 | static addHp(builder:flatbuffers.Builder, hp:number) { |
| 1293 | builder.addFieldInt16(2, hp, 100); |
| 1294 | }; |
| 1295 | |
| 1296 | /** |
| 1297 | * @param {flatbuffers.Builder} builder |
| 1298 | * @param {flatbuffers.Offset} nameOffset |
| 1299 | */ |
| 1300 | static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) { |
| 1301 | builder.addFieldOffset(3, nameOffset, 0); |
| 1302 | }; |
| 1303 | |
| 1304 | /** |
| 1305 | * @param {flatbuffers.Builder} builder |
| 1306 | * @param {flatbuffers.Offset} inventoryOffset |
| 1307 | */ |
| 1308 | static addInventory(builder:flatbuffers.Builder, inventoryOffset:flatbuffers.Offset) { |
| 1309 | builder.addFieldOffset(5, inventoryOffset, 0); |
| 1310 | }; |
| 1311 | |
| 1312 | /** |
| 1313 | * @param {flatbuffers.Builder} builder |
| 1314 | * @param {Array.<number>} data |
| 1315 | * @returns {flatbuffers.Offset} |
| 1316 | */ |
Kamil Rojewski | 3d2cf55 | 2017-05-18 19:30:30 +0200 | [diff] [blame] | 1317 | static createInventoryVector(builder:flatbuffers.Builder, data:number[] | Uint8Array):flatbuffers.Offset { |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 1318 | builder.startVector(1, data.length, 1); |
| 1319 | for (var i = data.length - 1; i >= 0; i--) { |
| 1320 | builder.addInt8(data[i]); |
| 1321 | } |
| 1322 | return builder.endVector(); |
| 1323 | }; |
| 1324 | |
| 1325 | /** |
| 1326 | * @param {flatbuffers.Builder} builder |
| 1327 | * @param {number} numElems |
| 1328 | */ |
| 1329 | static startInventoryVector(builder:flatbuffers.Builder, numElems:number) { |
| 1330 | builder.startVector(1, numElems, 1); |
| 1331 | }; |
| 1332 | |
| 1333 | /** |
| 1334 | * @param {flatbuffers.Builder} builder |
| 1335 | * @param {MyGame.Example.Color} color |
| 1336 | */ |
| 1337 | static addColor(builder:flatbuffers.Builder, color:MyGame.Example.Color) { |
| 1338 | builder.addFieldInt8(6, color, MyGame.Example.Color.Blue); |
| 1339 | }; |
| 1340 | |
| 1341 | /** |
| 1342 | * @param {flatbuffers.Builder} builder |
| 1343 | * @param {MyGame.Example.Any} testType |
| 1344 | */ |
| 1345 | static addTestType(builder:flatbuffers.Builder, testType:MyGame.Example.Any) { |
| 1346 | builder.addFieldInt8(7, testType, MyGame.Example.Any.NONE); |
| 1347 | }; |
| 1348 | |
| 1349 | /** |
| 1350 | * @param {flatbuffers.Builder} builder |
| 1351 | * @param {flatbuffers.Offset} testOffset |
| 1352 | */ |
| 1353 | static addTest(builder:flatbuffers.Builder, testOffset:flatbuffers.Offset) { |
| 1354 | builder.addFieldOffset(8, testOffset, 0); |
| 1355 | }; |
| 1356 | |
| 1357 | /** |
| 1358 | * @param {flatbuffers.Builder} builder |
| 1359 | * @param {flatbuffers.Offset} test4Offset |
| 1360 | */ |
| 1361 | static addTest4(builder:flatbuffers.Builder, test4Offset:flatbuffers.Offset) { |
| 1362 | builder.addFieldOffset(9, test4Offset, 0); |
| 1363 | }; |
| 1364 | |
| 1365 | /** |
| 1366 | * @param {flatbuffers.Builder} builder |
| 1367 | * @param {number} numElems |
| 1368 | */ |
| 1369 | static startTest4Vector(builder:flatbuffers.Builder, numElems:number) { |
| 1370 | builder.startVector(4, numElems, 2); |
| 1371 | }; |
| 1372 | |
| 1373 | /** |
| 1374 | * @param {flatbuffers.Builder} builder |
| 1375 | * @param {flatbuffers.Offset} testarrayofstringOffset |
| 1376 | */ |
| 1377 | static addTestarrayofstring(builder:flatbuffers.Builder, testarrayofstringOffset:flatbuffers.Offset) { |
| 1378 | builder.addFieldOffset(10, testarrayofstringOffset, 0); |
| 1379 | }; |
| 1380 | |
| 1381 | /** |
| 1382 | * @param {flatbuffers.Builder} builder |
| 1383 | * @param {Array.<flatbuffers.Offset>} data |
| 1384 | * @returns {flatbuffers.Offset} |
| 1385 | */ |
Kamil Rojewski | 3d2cf55 | 2017-05-18 19:30:30 +0200 | [diff] [blame] | 1386 | static createTestarrayofstringVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 1387 | builder.startVector(4, data.length, 4); |
| 1388 | for (var i = data.length - 1; i >= 0; i--) { |
| 1389 | builder.addOffset(data[i]); |
| 1390 | } |
| 1391 | return builder.endVector(); |
| 1392 | }; |
| 1393 | |
| 1394 | /** |
| 1395 | * @param {flatbuffers.Builder} builder |
| 1396 | * @param {number} numElems |
| 1397 | */ |
| 1398 | static startTestarrayofstringVector(builder:flatbuffers.Builder, numElems:number) { |
| 1399 | builder.startVector(4, numElems, 4); |
| 1400 | }; |
| 1401 | |
| 1402 | /** |
| 1403 | * @param {flatbuffers.Builder} builder |
| 1404 | * @param {flatbuffers.Offset} testarrayoftablesOffset |
| 1405 | */ |
| 1406 | static addTestarrayoftables(builder:flatbuffers.Builder, testarrayoftablesOffset:flatbuffers.Offset) { |
| 1407 | builder.addFieldOffset(11, testarrayoftablesOffset, 0); |
| 1408 | }; |
| 1409 | |
| 1410 | /** |
| 1411 | * @param {flatbuffers.Builder} builder |
| 1412 | * @param {Array.<flatbuffers.Offset>} data |
| 1413 | * @returns {flatbuffers.Offset} |
| 1414 | */ |
Kamil Rojewski | 3d2cf55 | 2017-05-18 19:30:30 +0200 | [diff] [blame] | 1415 | static createTestarrayoftablesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 1416 | builder.startVector(4, data.length, 4); |
| 1417 | for (var i = data.length - 1; i >= 0; i--) { |
| 1418 | builder.addOffset(data[i]); |
| 1419 | } |
| 1420 | return builder.endVector(); |
| 1421 | }; |
| 1422 | |
| 1423 | /** |
| 1424 | * @param {flatbuffers.Builder} builder |
| 1425 | * @param {number} numElems |
| 1426 | */ |
| 1427 | static startTestarrayoftablesVector(builder:flatbuffers.Builder, numElems:number) { |
| 1428 | builder.startVector(4, numElems, 4); |
| 1429 | }; |
| 1430 | |
| 1431 | /** |
| 1432 | * @param {flatbuffers.Builder} builder |
| 1433 | * @param {flatbuffers.Offset} enemyOffset |
| 1434 | */ |
| 1435 | static addEnemy(builder:flatbuffers.Builder, enemyOffset:flatbuffers.Offset) { |
| 1436 | builder.addFieldOffset(12, enemyOffset, 0); |
| 1437 | }; |
| 1438 | |
| 1439 | /** |
| 1440 | * @param {flatbuffers.Builder} builder |
| 1441 | * @param {flatbuffers.Offset} testnestedflatbufferOffset |
| 1442 | */ |
| 1443 | static addTestnestedflatbuffer(builder:flatbuffers.Builder, testnestedflatbufferOffset:flatbuffers.Offset) { |
| 1444 | builder.addFieldOffset(13, testnestedflatbufferOffset, 0); |
| 1445 | }; |
| 1446 | |
| 1447 | /** |
| 1448 | * @param {flatbuffers.Builder} builder |
| 1449 | * @param {Array.<number>} data |
| 1450 | * @returns {flatbuffers.Offset} |
| 1451 | */ |
Kamil Rojewski | 3d2cf55 | 2017-05-18 19:30:30 +0200 | [diff] [blame] | 1452 | static createTestnestedflatbufferVector(builder:flatbuffers.Builder, data:number[] | Uint8Array):flatbuffers.Offset { |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 1453 | builder.startVector(1, data.length, 1); |
| 1454 | for (var i = data.length - 1; i >= 0; i--) { |
| 1455 | builder.addInt8(data[i]); |
| 1456 | } |
| 1457 | return builder.endVector(); |
| 1458 | }; |
| 1459 | |
| 1460 | /** |
| 1461 | * @param {flatbuffers.Builder} builder |
| 1462 | * @param {number} numElems |
| 1463 | */ |
| 1464 | static startTestnestedflatbufferVector(builder:flatbuffers.Builder, numElems:number) { |
| 1465 | builder.startVector(1, numElems, 1); |
| 1466 | }; |
| 1467 | |
| 1468 | /** |
| 1469 | * @param {flatbuffers.Builder} builder |
| 1470 | * @param {flatbuffers.Offset} testemptyOffset |
| 1471 | */ |
| 1472 | static addTestempty(builder:flatbuffers.Builder, testemptyOffset:flatbuffers.Offset) { |
| 1473 | builder.addFieldOffset(14, testemptyOffset, 0); |
| 1474 | }; |
| 1475 | |
| 1476 | /** |
| 1477 | * @param {flatbuffers.Builder} builder |
| 1478 | * @param {boolean} testbool |
| 1479 | */ |
| 1480 | static addTestbool(builder:flatbuffers.Builder, testbool:boolean) { |
| 1481 | builder.addFieldInt8(15, +testbool, +false); |
| 1482 | }; |
| 1483 | |
| 1484 | /** |
| 1485 | * @param {flatbuffers.Builder} builder |
| 1486 | * @param {number} testhashs32Fnv1 |
| 1487 | */ |
| 1488 | static addTesthashs32Fnv1(builder:flatbuffers.Builder, testhashs32Fnv1:number) { |
| 1489 | builder.addFieldInt32(16, testhashs32Fnv1, 0); |
| 1490 | }; |
| 1491 | |
| 1492 | /** |
| 1493 | * @param {flatbuffers.Builder} builder |
| 1494 | * @param {number} testhashu32Fnv1 |
| 1495 | */ |
| 1496 | static addTesthashu32Fnv1(builder:flatbuffers.Builder, testhashu32Fnv1:number) { |
| 1497 | builder.addFieldInt32(17, testhashu32Fnv1, 0); |
| 1498 | }; |
| 1499 | |
| 1500 | /** |
| 1501 | * @param {flatbuffers.Builder} builder |
| 1502 | * @param {flatbuffers.Long} testhashs64Fnv1 |
| 1503 | */ |
| 1504 | static addTesthashs64Fnv1(builder:flatbuffers.Builder, testhashs64Fnv1:flatbuffers.Long) { |
| 1505 | builder.addFieldInt64(18, testhashs64Fnv1, builder.createLong(0, 0)); |
| 1506 | }; |
| 1507 | |
| 1508 | /** |
| 1509 | * @param {flatbuffers.Builder} builder |
| 1510 | * @param {flatbuffers.Long} testhashu64Fnv1 |
| 1511 | */ |
| 1512 | static addTesthashu64Fnv1(builder:flatbuffers.Builder, testhashu64Fnv1:flatbuffers.Long) { |
| 1513 | builder.addFieldInt64(19, testhashu64Fnv1, builder.createLong(0, 0)); |
| 1514 | }; |
| 1515 | |
| 1516 | /** |
| 1517 | * @param {flatbuffers.Builder} builder |
| 1518 | * @param {number} testhashs32Fnv1a |
| 1519 | */ |
| 1520 | static addTesthashs32Fnv1a(builder:flatbuffers.Builder, testhashs32Fnv1a:number) { |
| 1521 | builder.addFieldInt32(20, testhashs32Fnv1a, 0); |
| 1522 | }; |
| 1523 | |
| 1524 | /** |
| 1525 | * @param {flatbuffers.Builder} builder |
| 1526 | * @param {number} testhashu32Fnv1a |
| 1527 | */ |
| 1528 | static addTesthashu32Fnv1a(builder:flatbuffers.Builder, testhashu32Fnv1a:number) { |
| 1529 | builder.addFieldInt32(21, testhashu32Fnv1a, 0); |
| 1530 | }; |
| 1531 | |
| 1532 | /** |
| 1533 | * @param {flatbuffers.Builder} builder |
| 1534 | * @param {flatbuffers.Long} testhashs64Fnv1a |
| 1535 | */ |
| 1536 | static addTesthashs64Fnv1a(builder:flatbuffers.Builder, testhashs64Fnv1a:flatbuffers.Long) { |
| 1537 | builder.addFieldInt64(22, testhashs64Fnv1a, builder.createLong(0, 0)); |
| 1538 | }; |
| 1539 | |
| 1540 | /** |
| 1541 | * @param {flatbuffers.Builder} builder |
| 1542 | * @param {flatbuffers.Long} testhashu64Fnv1a |
| 1543 | */ |
| 1544 | static addTesthashu64Fnv1a(builder:flatbuffers.Builder, testhashu64Fnv1a:flatbuffers.Long) { |
| 1545 | builder.addFieldInt64(23, testhashu64Fnv1a, builder.createLong(0, 0)); |
| 1546 | }; |
| 1547 | |
| 1548 | /** |
| 1549 | * @param {flatbuffers.Builder} builder |
| 1550 | * @param {flatbuffers.Offset} testarrayofboolsOffset |
| 1551 | */ |
| 1552 | static addTestarrayofbools(builder:flatbuffers.Builder, testarrayofboolsOffset:flatbuffers.Offset) { |
| 1553 | builder.addFieldOffset(24, testarrayofboolsOffset, 0); |
| 1554 | }; |
| 1555 | |
| 1556 | /** |
| 1557 | * @param {flatbuffers.Builder} builder |
| 1558 | * @param {Array.<boolean>} data |
| 1559 | * @returns {flatbuffers.Offset} |
| 1560 | */ |
Kamil Rojewski | 3d2cf55 | 2017-05-18 19:30:30 +0200 | [diff] [blame] | 1561 | static createTestarrayofboolsVector(builder:flatbuffers.Builder, data:boolean[]):flatbuffers.Offset { |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 1562 | builder.startVector(1, data.length, 1); |
| 1563 | for (var i = data.length - 1; i >= 0; i--) { |
| 1564 | builder.addInt8(+data[i]); |
| 1565 | } |
| 1566 | return builder.endVector(); |
| 1567 | }; |
| 1568 | |
| 1569 | /** |
| 1570 | * @param {flatbuffers.Builder} builder |
| 1571 | * @param {number} numElems |
| 1572 | */ |
| 1573 | static startTestarrayofboolsVector(builder:flatbuffers.Builder, numElems:number) { |
| 1574 | builder.startVector(1, numElems, 1); |
| 1575 | }; |
| 1576 | |
| 1577 | /** |
| 1578 | * @param {flatbuffers.Builder} builder |
| 1579 | * @param {number} testf |
| 1580 | */ |
| 1581 | static addTestf(builder:flatbuffers.Builder, testf:number) { |
| 1582 | builder.addFieldFloat32(25, testf, 3.14159); |
| 1583 | }; |
| 1584 | |
| 1585 | /** |
| 1586 | * @param {flatbuffers.Builder} builder |
| 1587 | * @param {number} testf2 |
| 1588 | */ |
| 1589 | static addTestf2(builder:flatbuffers.Builder, testf2:number) { |
| 1590 | builder.addFieldFloat32(26, testf2, 3.0); |
| 1591 | }; |
| 1592 | |
| 1593 | /** |
| 1594 | * @param {flatbuffers.Builder} builder |
| 1595 | * @param {number} testf3 |
| 1596 | */ |
| 1597 | static addTestf3(builder:flatbuffers.Builder, testf3:number) { |
| 1598 | builder.addFieldFloat32(27, testf3, 0.0); |
| 1599 | }; |
| 1600 | |
| 1601 | /** |
| 1602 | * @param {flatbuffers.Builder} builder |
| 1603 | * @param {flatbuffers.Offset} testarrayofstring2Offset |
| 1604 | */ |
| 1605 | static addTestarrayofstring2(builder:flatbuffers.Builder, testarrayofstring2Offset:flatbuffers.Offset) { |
| 1606 | builder.addFieldOffset(28, testarrayofstring2Offset, 0); |
| 1607 | }; |
| 1608 | |
| 1609 | /** |
| 1610 | * @param {flatbuffers.Builder} builder |
| 1611 | * @param {Array.<flatbuffers.Offset>} data |
| 1612 | * @returns {flatbuffers.Offset} |
| 1613 | */ |
Kamil Rojewski | 3d2cf55 | 2017-05-18 19:30:30 +0200 | [diff] [blame] | 1614 | static createTestarrayofstring2Vector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { |
Kamil Rojewski | 28e7dbd | 2017-04-10 19:01:13 +0200 | [diff] [blame] | 1615 | builder.startVector(4, data.length, 4); |
| 1616 | for (var i = data.length - 1; i >= 0; i--) { |
| 1617 | builder.addOffset(data[i]); |
| 1618 | } |
| 1619 | return builder.endVector(); |
| 1620 | }; |
| 1621 | |
| 1622 | /** |
| 1623 | * @param {flatbuffers.Builder} builder |
| 1624 | * @param {number} numElems |
| 1625 | */ |
| 1626 | static startTestarrayofstring2Vector(builder:flatbuffers.Builder, numElems:number) { |
| 1627 | builder.startVector(4, numElems, 4); |
| 1628 | }; |
| 1629 | |
| 1630 | /** |
| 1631 | * @param {flatbuffers.Builder} builder |
| 1632 | * @param {flatbuffers.Offset} testarrayofsortedstructOffset |
| 1633 | */ |
| 1634 | static addTestarrayofsortedstruct(builder:flatbuffers.Builder, testarrayofsortedstructOffset:flatbuffers.Offset) { |
| 1635 | builder.addFieldOffset(29, testarrayofsortedstructOffset, 0); |
| 1636 | }; |
| 1637 | |
| 1638 | /** |
| 1639 | * @param {flatbuffers.Builder} builder |
| 1640 | * @param {number} numElems |
| 1641 | */ |
| 1642 | static startTestarrayofsortedstructVector(builder:flatbuffers.Builder, numElems:number) { |
| 1643 | builder.startVector(8, numElems, 4); |
| 1644 | }; |
| 1645 | |
| 1646 | /** |
| 1647 | * @param {flatbuffers.Builder} builder |
| 1648 | * @returns {flatbuffers.Offset} |
| 1649 | */ |
| 1650 | static endMonster(builder:flatbuffers.Builder):flatbuffers.Offset { |
| 1651 | var offset = builder.endObject(); |
| 1652 | builder.requiredField(offset, 10); // name |
| 1653 | return offset; |
| 1654 | }; |
| 1655 | |
| 1656 | /** |
| 1657 | * @param {flatbuffers.Builder} builder |
| 1658 | * @param {flatbuffers.Offset} offset |
| 1659 | */ |
| 1660 | static finishMonsterBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) { |
| 1661 | builder.finish(offset, 'MONS'); |
| 1662 | }; |
| 1663 | |
| 1664 | } |
| 1665 | } |