1// automatically generated by the FlatBuffers compiler, do not modify 2 3/** 4 * @enum {number} 5 */ 6var Character = { 7 NONE: 0, 8 MuLan: 1, 9 Rapunzel: 2, 10 Belle: 3, 11 BookFan: 4, 12 Other: 5, 13 Unused: 6 14}; 15 16/** 17 * @enum {string} 18 */ 19var CharacterName = { 20 '0': 'NONE', 21 '1': 'MuLan', 22 '2': 'Rapunzel', 23 '3': 'Belle', 24 '4': 'BookFan', 25 '5': 'Other', 26 '6': 'Unused' 27}; 28 29/** 30 * @constructor 31 */ 32function Attacker() { 33 /** 34 * @type {flatbuffers.ByteBuffer} 35 */ 36 this.bb = null; 37 38 /** 39 * @type {number} 40 */ 41 this.bb_pos = 0; 42} 43 44/** 45 * @param {number} i 46 * @param {flatbuffers.ByteBuffer} bb 47 * @returns {Attacker} 48 */ 49Attacker.prototype.__init = function(i, bb) { 50 this.bb_pos = i; 51 this.bb = bb; 52 return this; 53}; 54 55/** 56 * @param {flatbuffers.ByteBuffer} bb 57 * @param {Attacker=} obj 58 * @returns {Attacker} 59 */ 60Attacker.getRootAsAttacker = function(bb, obj) { 61 return (obj || new Attacker).__init(bb.readInt32(bb.position()) + bb.position(), bb); 62}; 63 64/** 65 * @param {flatbuffers.ByteBuffer} bb 66 * @param {Attacker=} obj 67 * @returns {Attacker} 68 */ 69Attacker.getSizePrefixedRootAsAttacker = function(bb, obj) { 70 bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); 71 return (obj || new Attacker).__init(bb.readInt32(bb.position()) + bb.position(), bb); 72}; 73 74/** 75 * @returns {number} 76 */ 77Attacker.prototype.swordAttackDamage = function() { 78 var offset = this.bb.__offset(this.bb_pos, 4); 79 return offset ? this.bb.readInt32(this.bb_pos + offset) : 0; 80}; 81 82/** 83 * @param {number} value 84 * @returns {boolean} 85 */ 86Attacker.prototype.mutate_sword_attack_damage = function(value) { 87 var offset = this.bb.__offset(this.bb_pos, 4); 88 89 if (offset === 0) { 90 return false; 91 } 92 93 this.bb.writeInt32(this.bb_pos + offset, value); 94 return true; 95}; 96 97/** 98 * @param {flatbuffers.Builder} builder 99 */ 100Attacker.startAttacker = function(builder) { 101 builder.startObject(1); 102}; 103 104/** 105 * @param {flatbuffers.Builder} builder 106 * @param {number} swordAttackDamage 107 */ 108Attacker.addSwordAttackDamage = function(builder, swordAttackDamage) { 109 builder.addFieldInt32(0, swordAttackDamage, 0); 110}; 111 112/** 113 * @param {flatbuffers.Builder} builder 114 * @returns {flatbuffers.Offset} 115 */ 116Attacker.endAttacker = function(builder) { 117 var offset = builder.endObject(); 118 return offset; 119}; 120 121/** 122 * @param {flatbuffers.Builder} builder 123 * @param {number} swordAttackDamage 124 * @returns {flatbuffers.Offset} 125 */ 126Attacker.createAttacker = function(builder, swordAttackDamage) { 127 Attacker.startAttacker(builder); 128 Attacker.addSwordAttackDamage(builder, swordAttackDamage); 129 return Attacker.endAttacker(builder); 130} 131 132/** 133 * @constructor 134 */ 135function Rapunzel() { 136 /** 137 * @type {flatbuffers.ByteBuffer} 138 */ 139 this.bb = null; 140 141 /** 142 * @type {number} 143 */ 144 this.bb_pos = 0; 145} 146 147/** 148 * @param {number} i 149 * @param {flatbuffers.ByteBuffer} bb 150 * @returns {Rapunzel} 151 */ 152Rapunzel.prototype.__init = function(i, bb) { 153 this.bb_pos = i; 154 this.bb = bb; 155 return this; 156}; 157 158/** 159 * @returns {number} 160 */ 161Rapunzel.prototype.hairLength = function() { 162 return this.bb.readInt32(this.bb_pos); 163}; 164 165/** 166 * @param {number} value 167 * @returns {boolean} 168 */ 169Rapunzel.prototype.mutate_hair_length = function(value) { 170 var offset = this.bb.__offset(this.bb_pos, 0); 171 172 if (offset === 0) { 173 return false; 174 } 175 176 this.bb.writeInt32(this.bb_pos + offset, value); 177 return true; 178}; 179 180/** 181 * @param {flatbuffers.Builder} builder 182 * @param {number} hair_length 183 * @returns {flatbuffers.Offset} 184 */ 185Rapunzel.createRapunzel = function(builder, hair_length) { 186 builder.prep(4, 4); 187 builder.writeInt32(hair_length); 188 return builder.offset(); 189}; 190 191/** 192 * @constructor 193 */ 194function BookReader() { 195 /** 196 * @type {flatbuffers.ByteBuffer} 197 */ 198 this.bb = null; 199 200 /** 201 * @type {number} 202 */ 203 this.bb_pos = 0; 204} 205 206/** 207 * @param {number} i 208 * @param {flatbuffers.ByteBuffer} bb 209 * @returns {BookReader} 210 */ 211BookReader.prototype.__init = function(i, bb) { 212 this.bb_pos = i; 213 this.bb = bb; 214 return this; 215}; 216 217/** 218 * @returns {number} 219 */ 220BookReader.prototype.booksRead = function() { 221 return this.bb.readInt32(this.bb_pos); 222}; 223 224/** 225 * @param {number} value 226 * @returns {boolean} 227 */ 228BookReader.prototype.mutate_books_read = function(value) { 229 var offset = this.bb.__offset(this.bb_pos, 0); 230 231 if (offset === 0) { 232 return false; 233 } 234 235 this.bb.writeInt32(this.bb_pos + offset, value); 236 return true; 237}; 238 239/** 240 * @param {flatbuffers.Builder} builder 241 * @param {number} books_read 242 * @returns {flatbuffers.Offset} 243 */ 244BookReader.createBookReader = function(builder, books_read) { 245 builder.prep(4, 4); 246 builder.writeInt32(books_read); 247 return builder.offset(); 248}; 249 250/** 251 * @constructor 252 */ 253function Movie() { 254 /** 255 * @type {flatbuffers.ByteBuffer} 256 */ 257 this.bb = null; 258 259 /** 260 * @type {number} 261 */ 262 this.bb_pos = 0; 263} 264 265/** 266 * @param {number} i 267 * @param {flatbuffers.ByteBuffer} bb 268 * @returns {Movie} 269 */ 270Movie.prototype.__init = function(i, bb) { 271 this.bb_pos = i; 272 this.bb = bb; 273 return this; 274}; 275 276/** 277 * @param {flatbuffers.ByteBuffer} bb 278 * @param {Movie=} obj 279 * @returns {Movie} 280 */ 281Movie.getRootAsMovie = function(bb, obj) { 282 return (obj || new Movie).__init(bb.readInt32(bb.position()) + bb.position(), bb); 283}; 284 285/** 286 * @param {flatbuffers.ByteBuffer} bb 287 * @param {Movie=} obj 288 * @returns {Movie} 289 */ 290Movie.getSizePrefixedRootAsMovie = function(bb, obj) { 291 bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); 292 return (obj || new Movie).__init(bb.readInt32(bb.position()) + bb.position(), bb); 293}; 294 295/** 296 * @param {flatbuffers.ByteBuffer} bb 297 * @returns {boolean} 298 */ 299Movie.bufferHasIdentifier = function(bb) { 300 return bb.__has_identifier('MOVI'); 301}; 302 303/** 304 * @returns {Character} 305 */ 306Movie.prototype.mainCharacterType = function() { 307 var offset = this.bb.__offset(this.bb_pos, 4); 308 return offset ? /** @type {Character} */ (this.bb.readUint8(this.bb_pos + offset)) : Character.NONE; 309}; 310 311/** 312 * @param {flatbuffers.Table} obj 313 * @returns {?flatbuffers.Table} 314 */ 315Movie.prototype.mainCharacter = function(obj) { 316 var offset = this.bb.__offset(this.bb_pos, 6); 317 return offset ? this.bb.__union(obj, this.bb_pos + offset) : null; 318}; 319 320/** 321 * @param {number} index 322 * @returns {Character} 323 */ 324Movie.prototype.charactersType = function(index) { 325 var offset = this.bb.__offset(this.bb_pos, 8); 326 return offset ? /** @type {Character} */ (this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index)) : /** @type {Character} */ (0); 327}; 328 329/** 330 * @returns {number} 331 */ 332Movie.prototype.charactersTypeLength = function() { 333 var offset = this.bb.__offset(this.bb_pos, 8); 334 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; 335}; 336 337/** 338 * @returns {Uint8Array} 339 */ 340Movie.prototype.charactersTypeArray = function() { 341 var offset = this.bb.__offset(this.bb_pos, 8); 342 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; 343}; 344 345/** 346 * @param {number} index 347 * @param {flatbuffers.Table=} obj 348 * @returns {?flatbuffers.Table} 349 */ 350Movie.prototype.characters = function(index, obj) { 351 var offset = this.bb.__offset(this.bb_pos, 10); 352 return offset ? this.bb.__union(obj, this.bb.__vector(this.bb_pos + offset) + index * 4) : null; 353}; 354 355/** 356 * @returns {number} 357 */ 358Movie.prototype.charactersLength = function() { 359 var offset = this.bb.__offset(this.bb_pos, 10); 360 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; 361}; 362 363/** 364 * @param {flatbuffers.Builder} builder 365 */ 366Movie.startMovie = function(builder) { 367 builder.startObject(4); 368}; 369 370/** 371 * @param {flatbuffers.Builder} builder 372 * @param {Character} mainCharacterType 373 */ 374Movie.addMainCharacterType = function(builder, mainCharacterType) { 375 builder.addFieldInt8(0, mainCharacterType, Character.NONE); 376}; 377 378/** 379 * @param {flatbuffers.Builder} builder 380 * @param {flatbuffers.Offset} mainCharacterOffset 381 */ 382Movie.addMainCharacter = function(builder, mainCharacterOffset) { 383 builder.addFieldOffset(1, mainCharacterOffset, 0); 384}; 385 386/** 387 * @param {flatbuffers.Builder} builder 388 * @param {flatbuffers.Offset} charactersTypeOffset 389 */ 390Movie.addCharactersType = function(builder, charactersTypeOffset) { 391 builder.addFieldOffset(2, charactersTypeOffset, 0); 392}; 393 394/** 395 * @param {flatbuffers.Builder} builder 396 * @param {Array.<Character>} data 397 * @returns {flatbuffers.Offset} 398 */ 399Movie.createCharactersTypeVector = function(builder, data) { 400 builder.startVector(1, data.length, 1); 401 for (var i = data.length - 1; i >= 0; i--) { 402 builder.addInt8(data[i]); 403 } 404 return builder.endVector(); 405}; 406 407/** 408 * @param {flatbuffers.Builder} builder 409 * @param {number} numElems 410 */ 411Movie.startCharactersTypeVector = function(builder, numElems) { 412 builder.startVector(1, numElems, 1); 413}; 414 415/** 416 * @param {flatbuffers.Builder} builder 417 * @param {flatbuffers.Offset} charactersOffset 418 */ 419Movie.addCharacters = function(builder, charactersOffset) { 420 builder.addFieldOffset(3, charactersOffset, 0); 421}; 422 423/** 424 * @param {flatbuffers.Builder} builder 425 * @param {Array.<flatbuffers.Offset>} data 426 * @returns {flatbuffers.Offset} 427 */ 428Movie.createCharactersVector = function(builder, data) { 429 builder.startVector(4, data.length, 4); 430 for (var i = data.length - 1; i >= 0; i--) { 431 builder.addOffset(data[i]); 432 } 433 return builder.endVector(); 434}; 435 436/** 437 * @param {flatbuffers.Builder} builder 438 * @param {number} numElems 439 */ 440Movie.startCharactersVector = function(builder, numElems) { 441 builder.startVector(4, numElems, 4); 442}; 443 444/** 445 * @param {flatbuffers.Builder} builder 446 * @returns {flatbuffers.Offset} 447 */ 448Movie.endMovie = function(builder) { 449 var offset = builder.endObject(); 450 return offset; 451}; 452 453/** 454 * @param {flatbuffers.Builder} builder 455 * @param {flatbuffers.Offset} offset 456 */ 457Movie.finishMovieBuffer = function(builder, offset) { 458 builder.finish(offset, 'MOVI'); 459}; 460 461/** 462 * @param {flatbuffers.Builder} builder 463 * @param {flatbuffers.Offset} offset 464 */ 465Movie.finishSizePrefixedMovieBuffer = function(builder, offset) { 466 builder.finish(offset, 'MOVI', true); 467}; 468 469/** 470 * @param {flatbuffers.Builder} builder 471 * @param {Character} mainCharacterType 472 * @param {flatbuffers.Offset} mainCharacterOffset 473 * @param {flatbuffers.Offset} charactersTypeOffset 474 * @param {flatbuffers.Offset} charactersOffset 475 * @returns {flatbuffers.Offset} 476 */ 477Movie.createMovie = function(builder, mainCharacterType, mainCharacterOffset, charactersTypeOffset, charactersOffset) { 478 Movie.startMovie(builder); 479 Movie.addMainCharacterType(builder, mainCharacterType); 480 Movie.addMainCharacter(builder, mainCharacterOffset); 481 Movie.addCharactersType(builder, charactersTypeOffset); 482 Movie.addCharacters(builder, charactersOffset); 483 return Movie.endMovie(builder); 484} 485 486// Exports for Node.js and RequireJS 487this.Character = Character; 488this.CharacterName = CharacterName; 489this.Attacker = Attacker; 490this.Rapunzel = Rapunzel; 491this.BookReader = BookReader; 492this.Movie = Movie; 493