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 | union My_union { |
| 46 | 1: bool im_true, |
| 47 | 2: byte a_bite, |
| 48 | 3: i16 integer16, |
| 49 | 4: i32 integer32, |
| 50 | 5: i64 integer64, |
| 51 | 6: double double_precision, |
| 52 | 7: string some_characters, |
| 53 | 8: i32 other_i32 |
| 54 | } |
| 55 | |
| 56 | struct Struct_with_union { |
| 57 | 1: My_union fun_union |
| 58 | 2: i32 integer32 |
| 59 | 3: string some_characters |
| 60 | } |
| 61 | |
| 62 | enum SomeEnum { |
| 63 | ONE |
| 64 | TWO |
| 65 | } |
| 66 | |
| 67 | union TestUnion { |
| 68 | /** |
| 69 | * A doc string |
| 70 | */ |
| 71 | 1: string string_field; |
| 72 | 2: i32 i32_field; |
| 73 | 3: i32 other_i32_field; |
| 74 | 4: SomeEnum enum_field; |
| 75 | } |
| 76 | |
Kevin Clark | 03d7a47 | 2008-06-18 01:09:41 +0000 | [diff] [blame] | 77 | struct Foo { |
| 78 | 1: i32 simple = 53, |
| 79 | 2: string words = "words", |
| 80 | 3: Hello hello = {'greeting' : "hello, world!"}, |
| 81 | 4: list<i32> ints = [1, 2, 2, 3], |
| 82 | 5: map<i32, map<string, double>> complex, |
Kevin Clark | 5ad6d4a | 2008-08-26 20:02:07 +0000 | [diff] [blame] | 83 | 6: set<i16> shorts = [5, 17, 239], |
| 84 | 7: optional string opt_string |
Kevin Clark | 03d7a47 | 2008-06-18 01:09:41 +0000 | [diff] [blame] | 85 | } |
Kevin Clark | 1cfd693 | 2008-06-18 01:13:58 +0000 | [diff] [blame] | 86 | |
| 87 | struct BoolStruct { |
| 88 | 1: bool yesno = 1 |
| 89 | } |
Kevin Clark | e0fddde | 2008-06-18 01:16:02 +0000 | [diff] [blame] | 90 | |
Kevin Clark | 14fe791 | 2008-08-04 18:46:19 +0000 | [diff] [blame] | 91 | struct SimpleList { |
| 92 | 1: list<bool> bools, |
| 93 | 2: list<byte> bytes, |
| 94 | 3: list<i16> i16s, |
| 95 | 4: list<i32> i32s, |
| 96 | 5: list<i64> i64s, |
| 97 | 6: list<double> doubles, |
| 98 | 7: list<string> strings, |
| 99 | 8: list<map<i16, i16>> maps, |
| 100 | 9: list<list<i16>> lists, |
| 101 | 10: list<set<i16>> sets, |
| 102 | 11: list<Hello> hellos |
| 103 | } |
| 104 | |
Kevin Clark | 031baf7 | 2008-11-14 17:11:39 +0000 | [diff] [blame] | 105 | exception Xception { |
| 106 | 1: string message, |
| 107 | 2: i32 code = 1 |
| 108 | } |
| 109 | |
Kevin Clark | e0fddde | 2008-06-18 01:16:02 +0000 | [diff] [blame] | 110 | service NonblockingService { |
| 111 | Hello greeting(1:bool english) |
| 112 | bool block() |
David Reiss | cecbed8 | 2009-03-24 20:02:22 +0000 | [diff] [blame] | 113 | oneway void unblock(1:i32 n) |
| 114 | oneway void shutdown() |
Kevin Clark | e0fddde | 2008-06-18 01:16:02 +0000 | [diff] [blame] | 115 | void sleep(1:double seconds) |
| 116 | } |