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