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 | |
David Reiss | c2532a9 | 2007-07-30 23:46:11 +0000 | [diff] [blame] | 20 | /** |
| 21 | * Program doctext. |
| 22 | * |
| 23 | * Seriously, this is the documentation for this whole program. |
| 24 | */ |
| 25 | |
David Reiss | 771f8c7 | 2008-02-27 01:55:25 +0000 | [diff] [blame] | 26 | namespace java thrift.test |
David Reiss | 9a08dc6 | 2008-02-27 01:55:17 +0000 | [diff] [blame] | 27 | namespace cpp thrift.test |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 28 | |
| 29 | // C++ comment |
| 30 | /* c style comment */ |
| 31 | |
| 32 | # the new unix comment |
| 33 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 34 | /** Some doc text goes here. Wow I am [nesting these] (no more nesting.) */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 35 | enum Numberz |
| 36 | { |
| 37 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 38 | /** This is how to document a parameter */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 39 | ONE = 1, |
| 40 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 41 | /** And this is a doc for a parameter that has no specific value assigned */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 42 | TWO, |
| 43 | |
| 44 | THREE, |
| 45 | FIVE = 5, |
| 46 | SIX, |
| 47 | EIGHT = 8 |
| 48 | } |
| 49 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 50 | /** This is how you would do a typedef doc */ |
David Reiss | 0c90f6f | 2008-02-06 22:18:40 +0000 | [diff] [blame] | 51 | typedef i64 UserId |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 52 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 53 | /** And this is where you would document a struct */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 54 | struct Xtruct |
| 55 | { |
| 56 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 57 | /** And the members of a struct */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 58 | 1: string string_thing |
| 59 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 60 | /** doct text goes before a comma */ |
Nobuaki Sukegawa | eb344a8 | 2016-03-25 09:37:18 +0900 | [diff] [blame] | 61 | 4: i8 byte_thing, |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 62 | |
| 63 | 9: i32 i32_thing, |
| 64 | 11: i64 i64_thing |
| 65 | } |
| 66 | |
David Reiss | cdffe26 | 2007-08-14 17:12:31 +0000 | [diff] [blame] | 67 | /** |
| 68 | * You can document constants now too. Yeehaw! |
| 69 | */ |
| 70 | const i32 INT32CONSTANT = 9853 |
| 71 | const i16 INT16CONSTANT = 1616 |
| 72 | /** Everyone get in on the docu-action! */ |
| 73 | const map<string,string> MAPCONSTANT = {'hello':'world', 'goodnight':'moon'} |
| 74 | |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 75 | struct Xtruct2 |
| 76 | { |
Nobuaki Sukegawa | eb344a8 | 2016-03-25 09:37:18 +0900 | [diff] [blame] | 77 | 1: i8 byte_thing, |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 78 | 2: Xtruct struct_thing, |
| 79 | 3: i32 i32_thing |
| 80 | } |
| 81 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 82 | /** Struct insanity */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 83 | struct Insanity |
| 84 | { |
| 85 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 86 | /** This is doc for field 1 */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 87 | 1: map<Numberz, UserId> userMap, |
| 88 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 89 | /** And this is doc for field 2 */ |
David Reiss | 0c90f6f | 2008-02-06 22:18:40 +0000 | [diff] [blame] | 90 | 2: list<Xtruct> xtructs |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 91 | } |
| 92 | |
| 93 | exception Xception { |
| 94 | 1: i32 errorCode, |
| 95 | 2: string message |
| 96 | } |
| 97 | |
| 98 | exception Xception2 { |
| 99 | 1: i32 errorCode, |
| 100 | 2: Xtruct struct_thing |
| 101 | } |
David Reiss | 0c90f6f | 2008-02-06 22:18:40 +0000 | [diff] [blame] | 102 | |
David Reiss | c2532a9 | 2007-07-30 23:46:11 +0000 | [diff] [blame] | 103 | /* C1 */ |
| 104 | /** Doc */ |
| 105 | /* C2 */ |
| 106 | /* C3 */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 107 | struct EmptyStruct {} |
| 108 | |
| 109 | struct OneField { |
| 110 | 1: EmptyStruct field |
| 111 | } |
| 112 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 113 | /** This is where you would document a Service */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 114 | service ThriftTest |
| 115 | { |
| 116 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 117 | /** And this is how you would document functions in a service */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 118 | void testVoid(), |
| 119 | string testString(1: string thing), |
Nobuaki Sukegawa | eb344a8 | 2016-03-25 09:37:18 +0900 | [diff] [blame] | 120 | i8 testByte(1: byte thing), |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 121 | i32 testI32(1: i32 thing), |
| 122 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 123 | /** Like this one */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 124 | i64 testI64(1: i64 thing), |
| 125 | double testDouble(1: double thing), |
| 126 | Xtruct testStruct(1: Xtruct thing), |
| 127 | Xtruct2 testNest(1: Xtruct2 thing), |
| 128 | map<i32,i32> testMap(1: map<i32,i32> thing), |
| 129 | set<i32> testSet(1: set<i32> thing), |
| 130 | list<i32> testList(1: list<i32> thing), |
| 131 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 132 | /** This is an example of a function with params documented */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 133 | Numberz testEnum( |
| 134 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 135 | /** This param is a thing */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 136 | 1: Numberz thing |
| 137 | |
| 138 | ), |
| 139 | |
| 140 | UserId testTypedef(1: UserId thing), |
| 141 | |
| 142 | map<i32,map<i32,i32>> testMapMap(1: i32 hello), |
| 143 | |
| 144 | /* So you think you've got this all worked, out eh? */ |
| 145 | map<UserId, map<Numberz,Insanity>> testInsanity(1: Insanity argument), |
| 146 | |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 147 | } |
| 148 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 149 | /// This style of Doxy-comment doesn't work. |
| 150 | typedef i32 SorryNoGo |
| 151 | |
| 152 | /** |
| 153 | * This is a trivial example of a multiline docstring. |
| 154 | */ |
| 155 | typedef i32 TrivialMultiLine |
| 156 | |
| 157 | /** |
Konrad Grochowski | 3b5dacb | 2014-11-24 10:55:31 +0100 | [diff] [blame] | 158 | * This is the canonical example |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 159 | * of a multiline docstring. |
| 160 | */ |
| 161 | typedef i32 StandardMultiLine |
| 162 | |
| 163 | /** |
| 164 | * The last line is non-blank. |
| 165 | * I said non-blank! */ |
| 166 | typedef i32 LastLine |
| 167 | |
| 168 | /** Both the first line |
| 169 | * are non blank. ;-) |
| 170 | * and the last line */ |
| 171 | typedef i32 FirstAndLastLine |
| 172 | |
| 173 | /** |
| 174 | * INDENTED TITLE |
| 175 | * The text is less indented. |
| 176 | */ |
| 177 | typedef i32 IndentedTitle |
| 178 | |
| 179 | /** First line indented. |
| 180 | * Unfortunately, this does not get indented. |
| 181 | */ |
| 182 | typedef i32 FirstLineIndent |
| 183 | |
| 184 | |
| 185 | /** |
| 186 | * void code_in_comment() { |
| 187 | * printf("hooray code!"); |
| 188 | * } |
| 189 | */ |
| 190 | typedef i32 CodeInComment |
| 191 | |
| 192 | /** |
| 193 | * Indented Docstring. |
| 194 | * This whole docstring is indented. |
| 195 | * This line is indented further. |
| 196 | */ |
| 197 | typedef i32 IndentedDocstring |
| 198 | |
| 199 | /** Irregular docstring. |
| 200 | * We will have to punt |
| 201 | * on this thing */ |
| 202 | typedef i32 Irregular1 |
| 203 | |
| 204 | /** |
| 205 | * note the space |
| 206 | * before these lines |
| 207 | * but not this |
| 208 | * one |
| 209 | */ |
| 210 | typedef i32 Irregular2 |
| 211 | |
| 212 | /** |
| 213 | * Flush against |
| 214 | * the left. |
| 215 | */ |
| 216 | typedef i32 Flush |
| 217 | |
| 218 | /** |
| 219 | No stars in this one. |
| 220 | It should still work fine, though. |
| 221 | Including indenting. |
| 222 | */ |
| 223 | typedef i32 NoStars |
| 224 | |
| 225 | /** Trailing whitespace |
| 226 | Sloppy trailing whitespace |
| 227 | is truncated. */ |
| 228 | typedef i32 TrailingWhitespace |
| 229 | |
| 230 | /** |
| 231 | * This is a big one. |
| 232 | * |
| 233 | * We'll have some blank lines in it. |
| 234 | * |
| 235 | * void as_well_as(some code) { |
| 236 | * puts("YEEHAW!"); |
| 237 | * } |
| 238 | */ |
| 239 | typedef i32 BigDog |
David Reiss | c2532a9 | 2007-07-30 23:46:11 +0000 | [diff] [blame] | 240 | |
| 241 | /** |
| 242 | * |
| 243 | * |
| 244 | */ |
| 245 | typedef i32 TotallyDegenerate |
| 246 | |
Jens Geyer | 97cc95b | 2013-09-18 23:53:14 +0200 | [diff] [blame] | 247 | /**no room for newline here*/ |
| 248 | |
Jens Geyer | 108fab8 | 2016-01-28 21:30:08 +0100 | [diff] [blame] | 249 | /* * / */ |
| 250 | typedef i32 TestFor3501a |
| 251 | |
| 252 | /** |
| 253 | * / |
| 254 | */ |
| 255 | typedef i32 TestFor3501b |
| 256 | |
Jens Geyer | 775671a | 2016-03-06 19:02:42 +0100 | [diff] [blame] | 257 | |
| 258 | /* Comment-end tokens can of course have more than one asterisk */ |
| 259 | struct TestFor3709_00 { /* ? */ 1: i32 foo } |
| 260 | /* Comment-end tokens can of course have more than one asterisk **/ |
| 261 | struct TestFor3709_01 { /* ? */ 1: i32 foo } |
| 262 | /* Comment-end tokens can of course have more than one asterisk ***/ |
| 263 | struct TestFor3709_02 { /* ? */ 1: i32 foo } |
| 264 | /** Comment-end tokens can of course have more than one asterisk */ |
| 265 | struct TestFor3709_03 { /* ? */ 1: i32 foo } |
| 266 | /** Comment-end tokens can of course have more than one asterisk **/ |
| 267 | struct TestFor3709_04 { /* ? */ 1: i32 foo } |
| 268 | /** Comment-end tokens can of course have more than one asterisk ***/ |
| 269 | struct TestFor3709_05 { /* ? */ 1: i32 foo } |
| 270 | /*** Comment-end tokens can of course have more than one asterisk */ |
| 271 | struct TestFor3709_06 { /* ? */ 1: i32 foo } |
| 272 | /*** Comment-end tokens can of course have more than one asterisk **/ |
| 273 | struct TestFor3709_07 { /* ? */ 1: i32 foo } |
| 274 | /*** Comment-end tokens can of course have more than one asterisk ***/ |
| 275 | struct TestFor3709_08 { /* ? */ 1: i32 foo } |
| 276 | |
| 277 | struct TestFor3709 { |
| 278 | /** This is a comment */ |
| 279 | 1: required string id, |
| 280 | /** This is also a comment **/ |
| 281 | 2: required string typeId, |
| 282 | /** Yet another comment! */ |
| 283 | 3: required i32 endTimestamp |
| 284 | } |
| 285 | |
| 286 | |
David Reiss | c2532a9 | 2007-07-30 23:46:11 +0000 | [diff] [blame] | 287 | /* THE END */ |