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 
18 package androidx.text.emoji.flatbuffer;
19 
20 import com.google.flatbuffers.FlatBufferBuilder;
21 import com.google.flatbuffers.Table;
22 
23 import java.nio.ByteBuffer;
24 import java.nio.ByteOrder;
25 
26 /**
27  * Automatically generated by the FlatBuffers compiler, do not modify.
28  */
29 @SuppressWarnings("unused")
30 public final class MetadataItem extends Table {
getRootAsMetadataItem(ByteBuffer _bb)31     public static MetadataItem getRootAsMetadataItem(ByteBuffer _bb) {
32         return getRootAsMetadataItem(_bb, new MetadataItem());
33     }
34 
getRootAsMetadataItem(ByteBuffer _bb, MetadataItem obj)35     public static MetadataItem getRootAsMetadataItem(ByteBuffer _bb, MetadataItem obj) {
36         _bb.order(ByteOrder.LITTLE_ENDIAN);
37         return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb));
38     }
39 
__init(int _i, ByteBuffer _bb)40     public void __init(int _i, ByteBuffer _bb) {
41         bb_pos = _i;
42         bb = _bb;
43     }
44 
__assign(int _i, ByteBuffer _bb)45     public MetadataItem __assign(int _i, ByteBuffer _bb) {
46         __init(_i, _bb);
47         return this;
48     }
49 
id()50     public int id() {
51         int o = __offset(4);
52         return o != 0 ? bb.getInt(o + bb_pos) : 0;
53     }
54 
emojiStyle()55     public boolean emojiStyle() {
56         int o = __offset(6);
57         return o != 0 ? 0 != bb.get(o + bb_pos) : false;
58     }
59 
sdkAdded()60     public short sdkAdded() {
61         int o = __offset(8);
62         return o != 0 ? bb.getShort(o + bb_pos) : 0;
63     }
64 
compatAdded()65     public short compatAdded() {
66         int o = __offset(10);
67         return o != 0 ? bb.getShort(o + bb_pos) : 0;
68     }
69 
width()70     public short width() {
71         int o = __offset(12);
72         return o != 0 ? bb.getShort(o + bb_pos) : 0;
73     }
74 
height()75     public short height() {
76         int o = __offset(14);
77         return o != 0 ? bb.getShort(o + bb_pos) : 0;
78     }
79 
codepoints(int j)80     public int codepoints(int j) {
81         int o = __offset(16);
82         return o != 0 ? bb.getInt(__vector(o) + j * 4) : 0;
83     }
84 
codepointsLength()85     public int codepointsLength() {
86         int o = __offset(16);
87         return o != 0 ? __vector_len(o) : 0;
88     }
89 
codepointsAsByteBuffer()90     public ByteBuffer codepointsAsByteBuffer() {
91         return __vector_as_bytebuffer(16, 4);
92     }
93 
createMetadataItem(FlatBufferBuilder builder, int id, boolean emojiStyle, short sdkAdded, short compatAdded, short width, short height, int codepointsOffset)94     public static int createMetadataItem(FlatBufferBuilder builder,
95             int id,
96             boolean emojiStyle,
97             short sdkAdded,
98             short compatAdded,
99             short width,
100             short height,
101             int codepointsOffset) {
102         builder.startObject(7);
103         MetadataItem.addCodepoints(builder, codepointsOffset);
104         MetadataItem.addId(builder, id);
105         MetadataItem.addHeight(builder, height);
106         MetadataItem.addWidth(builder, width);
107         MetadataItem.addCompatAdded(builder, compatAdded);
108         MetadataItem.addSdkAdded(builder, sdkAdded);
109         MetadataItem.addEmojiStyle(builder, emojiStyle);
110         return MetadataItem.endMetadataItem(builder);
111     }
112 
startMetadataItem(FlatBufferBuilder builder)113     public static void startMetadataItem(FlatBufferBuilder builder) {
114         builder.startObject(7);
115     }
116 
addId(FlatBufferBuilder builder, int id)117     public static void addId(FlatBufferBuilder builder, int id) {
118         builder.addInt(0, id, 0);
119     }
120 
addEmojiStyle(FlatBufferBuilder builder, boolean emojiStyle)121     public static void addEmojiStyle(FlatBufferBuilder builder, boolean emojiStyle) {
122         builder.addBoolean(1, emojiStyle, false);
123     }
124 
addSdkAdded(FlatBufferBuilder builder, short sdkAdded)125     public static void addSdkAdded(FlatBufferBuilder builder, short sdkAdded) {
126         builder.addShort(2, sdkAdded, 0);
127     }
128 
addCompatAdded(FlatBufferBuilder builder, short compatAdded)129     public static void addCompatAdded(FlatBufferBuilder builder, short compatAdded) {
130         builder.addShort(3, compatAdded, 0);
131     }
132 
addWidth(FlatBufferBuilder builder, short width)133     public static void addWidth(FlatBufferBuilder builder, short width) {
134         builder.addShort(4, width, 0);
135     }
136 
addHeight(FlatBufferBuilder builder, short height)137     public static void addHeight(FlatBufferBuilder builder, short height) {
138         builder.addShort(5, height, 0);
139     }
140 
addCodepoints(FlatBufferBuilder builder, int codepointsOffset)141     public static void addCodepoints(FlatBufferBuilder builder, int codepointsOffset) {
142         builder.addOffset(6, codepointsOffset, 0);
143     }
144 
createCodepointsVector(FlatBufferBuilder builder, int[] data)145     public static int createCodepointsVector(FlatBufferBuilder builder, int[] data) {
146         builder.startVector(4, data.length, 4);
147         for (int i = data.length - 1; i >= 0; i--) builder.addInt(data[i]);
148         return builder.endVector();
149     }
150 
startCodepointsVector(FlatBufferBuilder builder, int numElems)151     public static void startCodepointsVector(FlatBufferBuilder builder, int numElems) {
152         builder.startVector(4, numElems, 4);
153     }
154 
endMetadataItem(FlatBufferBuilder builder)155     public static int endMetadataItem(FlatBufferBuilder builder) {
156         int o = builder.endObject();
157         return o;
158     }
159 }
160 
161