| // Copyright 2019 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| library fidl.test.example.codingtables; |
| |
| struct SomeStruct { |
| bool foo; |
| int32 bar; |
| }; |
| |
| xunion MyXUnion { |
| bool foo; |
| int32 bar; |
| }; |
| |
| table MyTable { |
| 1: bool foo; |
| 2: int32 bar; |
| 3: reserved; |
| 4: array<uint64>:42 baz; |
| 5: vector<uint64>:42 qux; |
| }; |
| |
| // fidlc will only expose coding tables for message types. |
| // However, we can obtain the coding tables for SomeStruct/MyXUnion etc. via the coding table |
| // for request message types, by defining dummy methods which take a single desired argument. |
| protocol Coding { |
| SomeStruct(SomeStruct s); |
| // Various trickery to avoid directly refering a xunion/table inline, |
| // which is not supported in the C bindings. |
| MyXUnion(MyXUnion? x); |
| |
| // Ensuring support for multiple uses of the same nullable type. |
| MyXUnion2(MyXUnion? x); |
| VectorOfMyTable(vector<MyTable> t); |
| VectorOfMyXUnion(vector<MyXUnion> x); |
| }; |