...

Text file src/github.com/google/flatbuffers/tests/MyGame/Example/TestSimpleTableWithEnum.java

Documentation: github.com/google/flatbuffers/tests/MyGame/Example

     1// automatically generated by the FlatBuffers compiler, do not modify
     2
     3package MyGame.Example;
     4
     5import com.google.flatbuffers.BaseVector;
     6import com.google.flatbuffers.BooleanVector;
     7import com.google.flatbuffers.ByteVector;
     8import com.google.flatbuffers.Constants;
     9import com.google.flatbuffers.DoubleVector;
    10import com.google.flatbuffers.FlatBufferBuilder;
    11import com.google.flatbuffers.FloatVector;
    12import com.google.flatbuffers.IntVector;
    13import com.google.flatbuffers.LongVector;
    14import com.google.flatbuffers.ShortVector;
    15import com.google.flatbuffers.StringVector;
    16import com.google.flatbuffers.Struct;
    17import com.google.flatbuffers.Table;
    18import com.google.flatbuffers.UnionVector;
    19import java.nio.ByteBuffer;
    20import java.nio.ByteOrder;
    21
    22@SuppressWarnings("unused")
    23final class TestSimpleTableWithEnum extends Table {
    24  public static void ValidateVersion() { Constants.FLATBUFFERS_23_5_26(); }
    25  public static TestSimpleTableWithEnum getRootAsTestSimpleTableWithEnum(ByteBuffer _bb) { return getRootAsTestSimpleTableWithEnum(_bb, new TestSimpleTableWithEnum()); }
    26  public static TestSimpleTableWithEnum getRootAsTestSimpleTableWithEnum(ByteBuffer _bb, TestSimpleTableWithEnum obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
    27  public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
    28  public TestSimpleTableWithEnum __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
    29
    30  public int color() { int o = __offset(4); return o != 0 ? bb.get(o + bb_pos) & 0xFF : 2; }
    31  public boolean mutateColor(int color) { int o = __offset(4); if (o != 0) { bb.put(o + bb_pos, (byte) color); return true; } else { return false; } }
    32
    33  public static int createTestSimpleTableWithEnum(FlatBufferBuilder builder,
    34      int color) {
    35    builder.startTable(1);
    36    TestSimpleTableWithEnum.addColor(builder, color);
    37    return TestSimpleTableWithEnum.endTestSimpleTableWithEnum(builder);
    38  }
    39
    40  public static void startTestSimpleTableWithEnum(FlatBufferBuilder builder) { builder.startTable(1); }
    41  public static void addColor(FlatBufferBuilder builder, int color) { builder.addByte(0, (byte) color, (byte) 2); }
    42  public static int endTestSimpleTableWithEnum(FlatBufferBuilder builder) {
    43    int o = builder.endTable();
    44    return o;
    45  }
    46
    47  static final class Vector extends BaseVector {
    48    public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
    49
    50    public TestSimpleTableWithEnum get(int j) { return get(new TestSimpleTableWithEnum(), j); }
    51    public TestSimpleTableWithEnum get(TestSimpleTableWithEnum obj, int j) {  return obj.__assign(__indirect(__element(j), bb), bb); }
    52  }
    53  public TestSimpleTableWithEnumT unpack() {
    54    TestSimpleTableWithEnumT _o = new TestSimpleTableWithEnumT();
    55    unpackTo(_o);
    56    return _o;
    57  }
    58  public void unpackTo(TestSimpleTableWithEnumT _o) {
    59    int _oColor = color();
    60    _o.setColor(_oColor);
    61  }
    62  public static int pack(FlatBufferBuilder builder, TestSimpleTableWithEnumT _o) {
    63    if (_o == null) return 0;
    64    return createTestSimpleTableWithEnum(
    65      builder,
    66      _o.getColor());
    67  }
    68}
    69

View as plain text