...

Text file src/github.com/google/flatbuffers/tests/union_vector/union_vector.fbs

Documentation: github.com/google/flatbuffers/tests/union_vector

     1// Demonstrates the ability to have vectors of unions, and also to
     2// store structs and strings in unions.
     3
     4table Attacker {
     5  sword_attack_damage: int;
     6}
     7
     8struct Rapunzel {
     9  hair_length: int;
    10}
    11
    12struct BookReader {
    13  books_read: int;
    14}
    15
    16union Character {
    17  MuLan: Attacker,  // Can have name be different from type.
    18  Rapunzel,         // Or just both the same, as before.
    19  Belle: BookReader,
    20  BookFan: BookReader,
    21  Other: string,
    22  Unused: string
    23}
    24
    25struct FallingTub {
    26  weight: int;
    27}
    28
    29table HandFan {
    30  length: int;
    31}
    32
    33union Gadget {
    34  FallingTub,
    35  HandFan,
    36}
    37
    38table Movie {
    39  main_character: Character;
    40  characters: [Character];
    41}
    42
    43root_type Movie;
    44file_identifier "MOVI";

View as plain text