Re-sync with internal repository
[hiphop-php.git] / third-party / thrift / src / thrift / test / UnionTest2.thrift
blobe6ba22c48487e269cd609ef84fafa173b953b016
1 /*
2  * Copyright (c) Facebook, Inc. and its affiliates.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
17 namespace cpp thrift.test.debug
18 namespace py thrift.test.UnionTest
20 typedef binary (cpp.type = "folly::IOBuf") IOBuf
22 struct OneOfEach {
23   1: bool im_true;
24   2: bool im_false;
25   3: byte a_bite = 127;
26   4: i16 integer16 = 32767;
27   5: i32 integer32;
28   6: i64 integer64 = 1000000000;
29   7: double double_precision;
30   8: string some_characters;
31   9: string zomg_unicode;
32   10: bool what_who;
33   11: binary base64;
34   12: list<byte> byte_list = [1, 2, 3];
35   13: list<i16> i16_list = [1, 2, 3];
36   14: list<i64> i64_list = [1, 2, 3];
37   15: IOBuf io_buf;
40 struct RandomStuff {
41   1: i32 a;
42   2: i32 b;
43   3: i32 c;
44   4: i32 d;
45   5: list<i32> myintlist;
46   7: i64 bigint;
47   8: double triple;
50 union TestUnion {
51   /**
52    * A doc string
53    */
54   1: string string_field;
55   2: i32 i32_field;
56   3: OneOfEach struct_field;
57   4: list<RandomStuff> struct_list;
58   5: i32 other_i32_field;
59   6: OneOfEach ref_field (cpp.ref = "true");
62 struct StructWithAUnion {
63   1: TestUnion test_union;
66 struct NonCopyableStruct {
67   1: i64 num;
68 } (cpp.noncopyable)
70 union NonCopyableUnion {
71   1: i32 a;
72   2: IOBuf buf;
73   3: NonCopyableStruct ncs;
74 } (cpp.noncopyable, cpp.noncomparable)
76 union NoExceptMoveUnion {
77   1: string string_field;
78   2: i32 i32_field;
79   3: OneOfEach struct_field;
82 union CppRefContainers {
83   1: list<CppRefContainers> values (cpp.ref);
84   2: string data;