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