OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // This file is autogenerated by: | |
6 // mojo/public/tools/bindings/mojom_bindings_generator.py | |
7 // For: | |
8 // mojo/public/interfaces/bindings/tests/sample_service.mojom | |
9 // | |
10 | |
11 package org.chromium.mojo.bindings.test.mojom.sample; | |
12 | |
13 public final class Foo extends org.chromium.mojo.bindings.Struct { | |
14 | |
15 private static final int STRUCT_SIZE = 96; | |
16 private static final DataHeader DEFAULT_STRUCT_INFO = new DataHeader(STRUCT_ SIZE, 15); | |
17 | |
18 public static final String FOOBY = (String) "Fooby"; | |
19 | |
20 public String name; | |
21 public int x; | |
22 public int y; | |
23 public boolean a; | |
24 public boolean b; | |
25 public boolean c; | |
26 public Bar bar; | |
27 public Bar[] extraBars; | |
28 public byte[] data; | |
29 public org.chromium.mojo.system.MessagePipeHandle source; | |
30 public org.chromium.mojo.system.DataPipe.ConsumerHandle[] inputStreams; | |
31 public org.chromium.mojo.system.DataPipe.ProducerHandle[] outputStreams; | |
32 public boolean[][] arrayOfArrayOfBools; | |
33 public String[][][] multiArrayOfStrings; | |
34 public boolean[] arrayOfBools; | |
35 | |
36 public Foo() { | |
37 super(STRUCT_SIZE); | |
38 name = (String) Foo.FOOBY; | |
39 a = (boolean) true; | |
40 source = org.chromium.mojo.system.InvalidHandle.INSTANCE; | |
41 } | |
42 | |
43 public static Foo deserialize(org.chromium.mojo.bindings.Message message) { | |
44 return decode(new org.chromium.mojo.bindings.Decoder(message)); | |
45 } | |
46 | |
47 public static Foo decode(org.chromium.mojo.bindings.Decoder decoder0) { | |
48 if (decoder0 == null) { | |
49 return null; | |
50 } | |
51 Foo result = new Foo(); | |
52 DataHeader mainDataHeader = decoder0.readDataHeader(); | |
53 if (mainDataHeader.numFields > 0) { | |
54 result.x = decoder0.readInt(8); | |
55 } | |
56 if (mainDataHeader.numFields > 1) { | |
57 result.y = decoder0.readInt(12); | |
58 } | |
59 if (mainDataHeader.numFields > 2) { | |
60 result.a = decoder0.readBoolean(16, 0); | |
61 } | |
62 if (mainDataHeader.numFields > 3) { | |
63 result.b = decoder0.readBoolean(16, 1); | |
64 } | |
65 if (mainDataHeader.numFields > 4) { | |
66 result.c = decoder0.readBoolean(16, 2); | |
67 } | |
68 if (mainDataHeader.numFields > 9) { | |
69 result.source = decoder0.readMessagePipeHandle(20, true); | |
70 } | |
71 if (mainDataHeader.numFields > 5) { | |
72 org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(2 4, true); | |
73 result.bar = Bar.decode(decoder1); | |
74 } | |
75 if (mainDataHeader.numFields > 6) { | |
76 result.data = decoder0.readBytes(32, org.chromium.mojo.bindings.Deco der.ARRAY_NULLABLE); | |
qsr
2014/08/29 14:17:57
Should probably be in BindingsHelper and not Decod
ppi
2014/08/29 14:46:49
Done.
| |
77 } | |
78 if (mainDataHeader.numFields > 7) { | |
79 org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(4 0, true); | |
80 if (decoder1 == null) { | |
81 result.extraBars = null; | |
82 } else { | |
83 DataHeader si1 = decoder1.readDataHeader(); | |
84 result.extraBars = new Bar[si1.numFields]; | |
85 for (int i1 = 0; i1 < si1.numFields; ++i1) { | |
86 org.chromium.mojo.bindings.Decoder decoder2 = decoder1.readP ointer(DataHeader.HEADER_SIZE + org.chromium.mojo.bindings.BindingsHelper.POINTE R_SIZE * i1, false); | |
87 result.extraBars[i1] = Bar.decode(decoder2); | |
88 } | |
89 } | |
90 } | |
91 if (mainDataHeader.numFields > 8) { | |
92 result.name = decoder0.readString(48, false); | |
93 } | |
94 if (mainDataHeader.numFields > 10) { | |
95 result.inputStreams = decoder0.readConsumerHandles(56, org.chromium. mojo.bindings.Decoder.ARRAY_NULLABLE); | |
96 } | |
97 if (mainDataHeader.numFields > 11) { | |
98 result.outputStreams = decoder0.readProducerHandles(64, org.chromium .mojo.bindings.Decoder.ARRAY_NULLABLE); | |
99 } | |
100 if (mainDataHeader.numFields > 12) { | |
101 org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(7 2, true); | |
102 if (decoder1 == null) { | |
103 result.arrayOfArrayOfBools = null; | |
104 } else { | |
105 DataHeader si1 = decoder1.readDataHeader(); | |
106 result.arrayOfArrayOfBools = new boolean[si1.numFields][]; | |
107 for (int i1 = 0; i1 < si1.numFields; ++i1) { | |
108 result.arrayOfArrayOfBools[i1] = decoder1.readBooleans(DataH eader.HEADER_SIZE + org.chromium.mojo.bindings.BindingsHelper.POINTER_SIZE * i1, org.chromium.mojo.bindings.Decoder.NOTHING_NULLABLE); | |
109 } | |
110 } | |
111 } | |
112 if (mainDataHeader.numFields > 13) { | |
113 org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(8 0, true); | |
114 if (decoder1 == null) { | |
115 result.multiArrayOfStrings = null; | |
116 } else { | |
117 DataHeader si1 = decoder1.readDataHeader(); | |
118 result.multiArrayOfStrings = new String[si1.numFields][][]; | |
119 for (int i1 = 0; i1 < si1.numFields; ++i1) { | |
120 org.chromium.mojo.bindings.Decoder decoder2 = decoder1.readP ointer(DataHeader.HEADER_SIZE + org.chromium.mojo.bindings.BindingsHelper.POINTE R_SIZE * i1, false); | |
121 if (decoder2 == null) { | |
122 result.multiArrayOfStrings[i1] = null; | |
123 } else { | |
124 DataHeader si2 = decoder2.readDataHeader(); | |
125 result.multiArrayOfStrings[i1] = new String[si2.numField s][]; | |
126 for (int i2 = 0; i2 < si2.numFields; ++i2) { | |
127 org.chromium.mojo.bindings.Decoder decoder3 = decode r2.readPointer(DataHeader.HEADER_SIZE + org.chromium.mojo.bindings.BindingsHelpe r.POINTER_SIZE * i2, false); | |
128 if (decoder3 == null) { | |
129 result.multiArrayOfStrings[i1][i2] = null; | |
130 } else { | |
131 DataHeader si3 = decoder3.readDataHeader(); | |
132 result.multiArrayOfStrings[i1][i2] = new String[ si3.numFields]; | |
133 for (int i3 = 0; i3 < si3.numFields; ++i3) { | |
134 result.multiArrayOfStrings[i1][i2][i3] = dec oder3.readString(DataHeader.HEADER_SIZE + org.chromium.mojo.bindings.BindingsHel per.POINTER_SIZE * i3, false); | |
135 } | |
136 } | |
137 } | |
138 } | |
139 } | |
140 } | |
141 } | |
142 if (mainDataHeader.numFields > 14) { | |
143 result.arrayOfBools = decoder0.readBooleans(88, org.chromium.mojo.bi ndings.Decoder.ARRAY_NULLABLE); | |
144 } | |
145 return result; | |
146 } | |
147 | |
148 @Override | |
149 protected final void encode(org.chromium.mojo.bindings.Encoder encoder) { | |
150 org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOf fset(DEFAULT_STRUCT_INFO); | |
151 encoder0.encode(x, 8); | |
152 encoder0.encode(y, 12); | |
153 encoder0.encode(a, 16, 0); | |
154 encoder0.encode(b, 16, 1); | |
155 encoder0.encode(c, 16, 2); | |
156 encoder0.encode(source, 20); | |
157 encoder0.encode(bar, 24); | |
158 encoder0.encode(data, 32); | |
159 if (extraBars == null) { | |
160 encoder0.encodeNullPointer(40); | |
161 } else { | |
162 org.chromium.mojo.bindings.Encoder encoder1 = encoder0.encodePointer Array(extraBars.length, 40); | |
163 for (int i0 = 0; i0 < extraBars.length; ++i0) { | |
164 encoder1.encode(extraBars[i0], DataHeader.HEADER_SIZE + org.chro mium.mojo.bindings.BindingsHelper.POINTER_SIZE * i0); | |
165 } | |
166 } | |
167 encoder0.encode(name, 48); | |
168 encoder0.encode(inputStreams, 56); | |
169 encoder0.encode(outputStreams, 64); | |
170 if (arrayOfArrayOfBools == null) { | |
171 encoder0.encodeNullPointer(72); | |
172 } else { | |
173 org.chromium.mojo.bindings.Encoder encoder1 = encoder0.encodePointer Array(arrayOfArrayOfBools.length, 72); | |
174 for (int i0 = 0; i0 < arrayOfArrayOfBools.length; ++i0) { | |
175 encoder1.encode(arrayOfArrayOfBools[i0], DataHeader.HEADER_SIZE + org.chromium.mojo.bindings.BindingsHelper.POINTER_SIZE * i0); | |
176 } | |
177 } | |
178 if (multiArrayOfStrings == null) { | |
179 encoder0.encodeNullPointer(80); | |
180 } else { | |
181 org.chromium.mojo.bindings.Encoder encoder1 = encoder0.encodePointer Array(multiArrayOfStrings.length, 80); | |
182 for (int i0 = 0; i0 < multiArrayOfStrings.length; ++i0) { | |
183 if (multiArrayOfStrings[i0] == null) { | |
184 encoder1.encodeNullPointer(DataHeader.HEADER_SIZE + org.chro mium.mojo.bindings.BindingsHelper.POINTER_SIZE * i0); | |
185 } else { | |
186 org.chromium.mojo.bindings.Encoder encoder2 = encoder1.encod ePointerArray(multiArrayOfStrings[i0].length, DataHeader.HEADER_SIZE + org.chrom ium.mojo.bindings.BindingsHelper.POINTER_SIZE * i0); | |
187 for (int i1 = 0; i1 < multiArrayOfStrings[i0].length; ++i1) { | |
188 if (multiArrayOfStrings[i0][i1] == null) { | |
189 encoder2.encodeNullPointer(DataHeader.HEADER_SIZE + org.chromium.mojo.bindings.BindingsHelper.POINTER_SIZE * i1); | |
190 } else { | |
191 org.chromium.mojo.bindings.Encoder encoder3 = encode r2.encodePointerArray(multiArrayOfStrings[i0][i1].length, DataHeader.HEADER_SIZE + org.chromium.mojo.bindings.BindingsHelper.POINTER_SIZE * i1); | |
192 for (int i2 = 0; i2 < multiArrayOfStrings[i0][i1].le ngth; ++i2) { | |
193 encoder3.encode(multiArrayOfStrings[i0][i1][i2], DataHeader.HEADER_SIZE + org.chromium.mojo.bindings.BindingsHelper.POINTER_SIZE * i2); | |
194 } | |
195 } | |
196 } | |
197 } | |
198 } | |
199 } | |
200 encoder0.encode(arrayOfBools, 88); | |
201 } | |
202 } | |
203 | |
OLD | NEW |