David Reiss | ea2cba8 | 2009-03-30 21:35:00 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | * or more contributor license agreements. See the NOTICE file |
| 4 | * distributed with this work for additional information |
| 5 | * regarding copyright ownership. The ASF licenses this file |
| 6 | * to you under the Apache License, Version 2.0 (the |
| 7 | * "License"); you may not use this file except in compliance |
| 8 | * with the License. You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, |
| 13 | * software distributed under the License is distributed on an |
| 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | * KIND, either express or implied. See the License for the |
| 16 | * specific language governing permissions and limitations |
| 17 | * under the License. |
| 18 | */ |
| 19 | |
| 20 | # |
| 21 | # Licensed to the Apache Software Foundation (ASF) under one |
| 22 | # or more contributor license agreements. See the NOTICE file |
| 23 | # distributed with this work for additional information |
| 24 | # regarding copyright ownership. The ASF licenses this file |
| 25 | # to you under the Apache License, Version 2.0 (the |
| 26 | # "License"); you may not use this file except in compliance |
| 27 | # with the License. You may obtain a copy of the License at |
| 28 | # |
| 29 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 30 | # |
| 31 | # Unless required by applicable law or agreed to in writing, |
| 32 | # software distributed under the License is distributed on an |
| 33 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 34 | # KIND, either express or implied. See the License for the |
| 35 | # specific language governing permissions and limitations |
| 36 | # under the License. |
| 37 | # |
| 38 | |
Kevin Clark | 03d7a47 | 2008-06-18 01:09:41 +0000 | [diff] [blame] | 39 | namespace rb SpecNamespace |
| 40 | |
| 41 | struct Hello { |
| 42 | 1: string greeting = "hello world" |
| 43 | } |
| 44 | |
Bryan Duxbury | 33e190c | 2010-02-16 21:19:01 +0000 | [diff] [blame] | 45 | enum SomeEnum { |
| 46 | ONE |
| 47 | TWO |
| 48 | } |
| 49 | |
Bryan Duxbury | 3d03c52 | 2010-02-18 17:42:06 +0000 | [diff] [blame] | 50 | struct StructWithSomeEnum { |
| 51 | 1: SomeEnum some_enum; |
| 52 | } |
| 53 | |
Bryan Duxbury | 33e190c | 2010-02-16 21:19:01 +0000 | [diff] [blame] | 54 | union TestUnion { |
| 55 | /** |
| 56 | * A doc string |
| 57 | */ |
| 58 | 1: string string_field; |
| 59 | 2: i32 i32_field; |
| 60 | 3: i32 other_i32_field; |
| 61 | 4: SomeEnum enum_field; |
Bryan Duxbury | 39dadd6 | 2010-02-18 22:00:45 +0000 | [diff] [blame] | 62 | 5: binary binary_field; |
Bryan Duxbury | 33e190c | 2010-02-16 21:19:01 +0000 | [diff] [blame] | 63 | } |
| 64 | |
Kevin Clark | 03d7a47 | 2008-06-18 01:09:41 +0000 | [diff] [blame] | 65 | struct Foo { |
| 66 | 1: i32 simple = 53, |
| 67 | 2: string words = "words", |
| 68 | 3: Hello hello = {'greeting' : "hello, world!"}, |
| 69 | 4: list<i32> ints = [1, 2, 2, 3], |
| 70 | 5: map<i32, map<string, double>> complex, |
Kevin Clark | 5ad6d4a | 2008-08-26 20:02:07 +0000 | [diff] [blame] | 71 | 6: set<i16> shorts = [5, 17, 239], |
| 72 | 7: optional string opt_string |
Bryan Duxbury | 0e4920c | 2010-02-18 20:28:27 +0000 | [diff] [blame] | 73 | 8: bool my_bool |
Kevin Clark | 03d7a47 | 2008-06-18 01:09:41 +0000 | [diff] [blame] | 74 | } |
Kevin Clark | 1cfd693 | 2008-06-18 01:13:58 +0000 | [diff] [blame] | 75 | |
Bryan Duxbury | 39dadd6 | 2010-02-18 22:00:45 +0000 | [diff] [blame] | 76 | struct Foo2 { |
| 77 | 1: binary my_binary |
| 78 | } |
| 79 | |
Kevin Clark | 1cfd693 | 2008-06-18 01:13:58 +0000 | [diff] [blame] | 80 | struct BoolStruct { |
| 81 | 1: bool yesno = 1 |
| 82 | } |
Kevin Clark | e0fddde | 2008-06-18 01:16:02 +0000 | [diff] [blame] | 83 | |
Kevin Clark | 14fe791 | 2008-08-04 18:46:19 +0000 | [diff] [blame] | 84 | struct SimpleList { |
| 85 | 1: list<bool> bools, |
| 86 | 2: list<byte> bytes, |
| 87 | 3: list<i16> i16s, |
| 88 | 4: list<i32> i32s, |
| 89 | 5: list<i64> i64s, |
| 90 | 6: list<double> doubles, |
| 91 | 7: list<string> strings, |
| 92 | 8: list<map<i16, i16>> maps, |
| 93 | 9: list<list<i16>> lists, |
| 94 | 10: list<set<i16>> sets, |
| 95 | 11: list<Hello> hellos |
| 96 | } |
| 97 | |
Kevin Clark | 031baf7 | 2008-11-14 17:11:39 +0000 | [diff] [blame] | 98 | exception Xception { |
| 99 | 1: string message, |
| 100 | 2: i32 code = 1 |
| 101 | } |
| 102 | |
Kevin Clark | e0fddde | 2008-06-18 01:16:02 +0000 | [diff] [blame] | 103 | service NonblockingService { |
| 104 | Hello greeting(1:bool english) |
| 105 | bool block() |
David Reiss | cecbed8 | 2009-03-24 20:02:22 +0000 | [diff] [blame] | 106 | oneway void unblock(1:i32 n) |
| 107 | oneway void shutdown() |
Kevin Clark | e0fddde | 2008-06-18 01:16:02 +0000 | [diff] [blame] | 108 | void sleep(1:double seconds) |
| 109 | } |
Bryan Duxbury | 3d03c52 | 2010-02-18 17:42:06 +0000 | [diff] [blame] | 110 | |
| 111 | union My_union { |
| 112 | 1: bool im_true, |
| 113 | 2: byte a_bite, |
| 114 | 3: i16 integer16, |
| 115 | 4: i32 integer32, |
| 116 | 5: i64 integer64, |
| 117 | 6: double double_precision, |
| 118 | 7: string some_characters, |
| 119 | 8: i32 other_i32 |
| 120 | 9: SomeEnum some_enum; |
| 121 | 10: map<SomeEnum, list<SomeEnum>> my_map; |
| 122 | } |
| 123 | |
| 124 | struct Struct_with_union { |
| 125 | 1: My_union fun_union |
| 126 | 2: i32 integer32 |
| 127 | 3: string some_characters |
| 128 | } |
| 129 | |
| 130 | struct StructWithEnumMap { |
| 131 | 1: map<SomeEnum, list<SomeEnum>> my_map; |
Ilya Maykov | a81b040 | 2012-02-29 00:39:38 +0000 | [diff] [blame] | 132 | } |
| 133 | |
| 134 | # Nested lists |
| 135 | struct NestedListInList { |
| 136 | 1: list<list<byte>> value |
| 137 | } |
| 138 | |
| 139 | struct NestedListInSet { |
| 140 | 1: set<list<byte>> value |
| 141 | } |
| 142 | |
| 143 | struct NestedListInMapKey { |
| 144 | 1: map<list<byte>, byte> value |
| 145 | } |
| 146 | |
| 147 | struct NestedListInMapValue { |
| 148 | 1: map<byte, list<byte>> value |
| 149 | } |
| 150 | |
| 151 | # Nested sets |
| 152 | struct NestedSetInList { |
| 153 | 1: list<set<byte>> value |
| 154 | } |
| 155 | |
| 156 | struct NestedSetInSet { |
| 157 | 1: set<set<byte>> value |
| 158 | } |
| 159 | |
| 160 | struct NestedSetInMapKey { |
| 161 | 1: map<set<byte>, byte> value |
| 162 | } |
| 163 | |
| 164 | struct NestedSetInMapValue { |
| 165 | 1: map<byte, set<byte>> value |
| 166 | } |
| 167 | |
| 168 | # Nested maps |
| 169 | struct NestedMapInList { |
| 170 | 1: list<map<byte, byte>> value |
| 171 | } |
| 172 | |
| 173 | struct NestedMapInSet { |
| 174 | 1: set<map<byte, byte>> value |
| 175 | } |
| 176 | |
| 177 | struct NestedMapInMapKey { |
| 178 | 2: map<map<byte, byte>, byte> value |
| 179 | } |
| 180 | |
| 181 | struct NestedMapInMapValue { |
| 182 | 2: map<byte, map<byte, byte>> value |
| 183 | } |