1// CHECKSTYLE:OFF Generated code
2/*
3 * Copyright (C) 2017 The Android Open Source Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18package androidx.text.emoji.flatbuffer;
19
20import com.google.flatbuffers.FlatBufferBuilder;
21import com.google.flatbuffers.Table;
22
23import java.nio.ByteBuffer;
24import java.nio.ByteOrder;
25
26/**
27 * Automatically generated by the FlatBuffers compiler, do not modify.
28 */
29@SuppressWarnings("unused")
30public final class MetadataList extends Table {
31    public static MetadataList getRootAsMetadataList(ByteBuffer _bb) {
32        return getRootAsMetadataList(_bb, new MetadataList());
33    }
34
35    public static MetadataList getRootAsMetadataList(ByteBuffer _bb, MetadataList obj) {
36        _bb.order(ByteOrder.LITTLE_ENDIAN);
37        return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb));
38    }
39
40    public void __init(int _i, ByteBuffer _bb) {
41        bb_pos = _i;
42        bb = _bb;
43    }
44
45    public MetadataList __assign(int _i, ByteBuffer _bb) {
46        __init(_i, _bb);
47        return this;
48    }
49
50    public int version() {
51        int o = __offset(4);
52        return o != 0 ? bb.getInt(o + bb_pos) : 0;
53    }
54
55    public MetadataItem list(int j) {
56        return list(new MetadataItem(), j);
57    }
58
59    public MetadataItem list(MetadataItem obj, int j) {
60        int o = __offset(6);
61        return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null;
62    }
63
64    public int listLength() {
65        int o = __offset(6);
66        return o != 0 ? __vector_len(o) : 0;
67    }
68
69    public String sourceSha() {
70        int o = __offset(8);
71        return o != 0 ? __string(o + bb_pos) : null;
72    }
73
74    public ByteBuffer sourceShaAsByteBuffer() {
75        return __vector_as_bytebuffer(8, 1);
76    }
77
78    public static int createMetadataList(FlatBufferBuilder builder,
79            int version,
80            int listOffset,
81            int sourceShaOffset) {
82        builder.startObject(3);
83        MetadataList.addSourceSha(builder, sourceShaOffset);
84        MetadataList.addList(builder, listOffset);
85        MetadataList.addVersion(builder, version);
86        return MetadataList.endMetadataList(builder);
87    }
88
89    public static void startMetadataList(FlatBufferBuilder builder) {
90        builder.startObject(3);
91    }
92
93    public static void addVersion(FlatBufferBuilder builder, int version) {
94        builder.addInt(0, version, 0);
95    }
96
97    public static void addList(FlatBufferBuilder builder, int listOffset) {
98        builder.addOffset(1, listOffset, 0);
99    }
100
101    public static int createListVector(FlatBufferBuilder builder, int[] data) {
102        builder.startVector(4, data.length, 4);
103        for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]);
104        return builder.endVector();
105    }
106
107    public static void startListVector(FlatBufferBuilder builder, int numElems) {
108        builder.startVector(4, numElems, 4);
109    }
110
111    public static void addSourceSha(FlatBufferBuilder builder, int sourceShaOffset) {
112        builder.addOffset(2, sourceShaOffset, 0);
113    }
114
115    public static int endMetadataList(FlatBufferBuilder builder) {
116        int o = builder.endObject();
117        return o;
118    }
119
120    public static void finishMetadataListBuffer(FlatBufferBuilder builder, int offset) {
121        builder.finish(offset);
122    }
123}
124
125