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