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 { 31 public static MetadataItem getRootAsMetadataItem(ByteBuffer _bb) { 32 return getRootAsMetadataItem(_bb, new MetadataItem()); 33 } 34 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 40 public void __init(int _i, ByteBuffer _bb) { 41 bb_pos = _i; 42 bb = _bb; 43 } 44 45 public MetadataItem __assign(int _i, ByteBuffer _bb) { 46 __init(_i, _bb); 47 return this; 48 } 49 50 public int id() { 51 int o = __offset(4); 52 return o != 0 ? bb.getInt(o + bb_pos) : 0; 53 } 54 55 public boolean emojiStyle() { 56 int o = __offset(6); 57 return o != 0 ? 0 != bb.get(o + bb_pos) : false; 58 } 59 60 public short sdkAdded() { 61 int o = __offset(8); 62 return o != 0 ? bb.getShort(o + bb_pos) : 0; 63 } 64 65 public short compatAdded() { 66 int o = __offset(10); 67 return o != 0 ? bb.getShort(o + bb_pos) : 0; 68 } 69 70 public short width() { 71 int o = __offset(12); 72 return o != 0 ? bb.getShort(o + bb_pos) : 0; 73 } 74 75 public short height() { 76 int o = __offset(14); 77 return o != 0 ? bb.getShort(o + bb_pos) : 0; 78 } 79 80 public int codepoints(int j) { 81 int o = __offset(16); 82 return o != 0 ? bb.getInt(__vector(o) + j * 4) : 0; 83 } 84 85 public int codepointsLength() { 86 int o = __offset(16); 87 return o != 0 ? __vector_len(o) : 0; 88 } 89 90 public ByteBuffer codepointsAsByteBuffer() { 91 return __vector_as_bytebuffer(16, 4); 92 } 93 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 113 public static void startMetadataItem(FlatBufferBuilder builder) { 114 builder.startObject(7); 115 } 116 117 public static void addId(FlatBufferBuilder builder, int id) { 118 builder.addInt(0, id, 0); 119 } 120 121 public static void addEmojiStyle(FlatBufferBuilder builder, boolean emojiStyle) { 122 builder.addBoolean(1, emojiStyle, false); 123 } 124 125 public static void addSdkAdded(FlatBufferBuilder builder, short sdkAdded) { 126 builder.addShort(2, sdkAdded, 0); 127 } 128 129 public static void addCompatAdded(FlatBufferBuilder builder, short compatAdded) { 130 builder.addShort(3, compatAdded, 0); 131 } 132 133 public static void addWidth(FlatBufferBuilder builder, short width) { 134 builder.addShort(4, width, 0); 135 } 136 137 public static void addHeight(FlatBufferBuilder builder, short height) { 138 builder.addShort(5, height, 0); 139 } 140 141 public static void addCodepoints(FlatBufferBuilder builder, int codepointsOffset) { 142 builder.addOffset(6, codepointsOffset, 0); 143 } 144 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 151 public static void startCodepointsVector(FlatBufferBuilder builder, int numElems) { 152 builder.startVector(4, numElems, 4); 153 } 154 155 public static int endMetadataItem(FlatBufferBuilder builder) { 156 int o = builder.endObject(); 157 return o; 158 } 159 } 160 161