blob: d702b2c231ed634db5c6128c36c85c74b9a56b0f [file] [log] [blame]
David Reissea2cba82009-03-30 21:35:00 +00001/*
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 Reissc2532a92007-07-30 23:46:11 +000020/**
21 * Program doctext.
22 *
23 * Seriously, this is the documentation for this whole program.
24 */
25
David Reiss771f8c72008-02-27 01:55:25 +000026namespace java thrift.test
David Reiss9a08dc62008-02-27 01:55:17 +000027namespace cpp thrift.test
ccheeverf53b5cf2007-02-05 20:33:11 +000028
29// C++ comment
30/* c style comment */
31
32# the new unix comment
33
David Reiss1ac05802007-07-30 22:00:27 +000034/** Some doc text goes here. Wow I am [nesting these] (no more nesting.) */
ccheeverf53b5cf2007-02-05 20:33:11 +000035enum Numberz
36{
37
David Reiss1ac05802007-07-30 22:00:27 +000038 /** This is how to document a parameter */
ccheeverf53b5cf2007-02-05 20:33:11 +000039 ONE = 1,
40
David Reiss1ac05802007-07-30 22:00:27 +000041 /** And this is a doc for a parameter that has no specific value assigned */
ccheeverf53b5cf2007-02-05 20:33:11 +000042 TWO,
43
44 THREE,
45 FIVE = 5,
46 SIX,
47 EIGHT = 8
48}
49
David Reiss1ac05802007-07-30 22:00:27 +000050/** This is how you would do a typedef doc */
David Reiss0c90f6f2008-02-06 22:18:40 +000051typedef i64 UserId
ccheeverf53b5cf2007-02-05 20:33:11 +000052
David Reiss1ac05802007-07-30 22:00:27 +000053/** And this is where you would document a struct */
ccheeverf53b5cf2007-02-05 20:33:11 +000054struct Xtruct
55{
56
David Reiss1ac05802007-07-30 22:00:27 +000057 /** And the members of a struct */
ccheeverf53b5cf2007-02-05 20:33:11 +000058 1: string string_thing
59
David Reiss1ac05802007-07-30 22:00:27 +000060 /** doct text goes before a comma */
Nobuaki Sukegawaeb344a82016-03-25 09:37:18 +090061 4: i8 byte_thing,
ccheeverf53b5cf2007-02-05 20:33:11 +000062
63 9: i32 i32_thing,
64 11: i64 i64_thing
65}
66
David Reisscdffe262007-08-14 17:12:31 +000067/**
68 * You can document constants now too. Yeehaw!
69 */
70const i32 INT32CONSTANT = 9853
71const i16 INT16CONSTANT = 1616
72/** Everyone get in on the docu-action! */
73const map<string,string> MAPCONSTANT = {'hello':'world', 'goodnight':'moon'}
74
ccheeverf53b5cf2007-02-05 20:33:11 +000075struct Xtruct2
76{
Nobuaki Sukegawaeb344a82016-03-25 09:37:18 +090077 1: i8 byte_thing,
ccheeverf53b5cf2007-02-05 20:33:11 +000078 2: Xtruct struct_thing,
79 3: i32 i32_thing
80}
81
David Reiss1ac05802007-07-30 22:00:27 +000082/** Struct insanity */
ccheeverf53b5cf2007-02-05 20:33:11 +000083struct Insanity
84{
85
David Reiss1ac05802007-07-30 22:00:27 +000086 /** This is doc for field 1 */
ccheeverf53b5cf2007-02-05 20:33:11 +000087 1: map<Numberz, UserId> userMap,
88
David Reiss1ac05802007-07-30 22:00:27 +000089 /** And this is doc for field 2 */
David Reiss0c90f6f2008-02-06 22:18:40 +000090 2: list<Xtruct> xtructs
ccheeverf53b5cf2007-02-05 20:33:11 +000091}
92
93exception Xception {
94 1: i32 errorCode,
95 2: string message
96}
97
98exception Xception2 {
99 1: i32 errorCode,
100 2: Xtruct struct_thing
101}
David Reiss0c90f6f2008-02-06 22:18:40 +0000102
David Reissc2532a92007-07-30 23:46:11 +0000103/* C1 */
104/** Doc */
105/* C2 */
106/* C3 */
ccheeverf53b5cf2007-02-05 20:33:11 +0000107struct EmptyStruct {}
108
109struct OneField {
110 1: EmptyStruct field
111}
112
David Reiss1ac05802007-07-30 22:00:27 +0000113/** This is where you would document a Service */
ccheeverf53b5cf2007-02-05 20:33:11 +0000114service ThriftTest
115{
116
David Reiss1ac05802007-07-30 22:00:27 +0000117 /** And this is how you would document functions in a service */
ccheeverf53b5cf2007-02-05 20:33:11 +0000118 void testVoid(),
119 string testString(1: string thing),
Nobuaki Sukegawaeb344a82016-03-25 09:37:18 +0900120 i8 testByte(1: byte thing),
ccheeverf53b5cf2007-02-05 20:33:11 +0000121 i32 testI32(1: i32 thing),
122
David Reiss1ac05802007-07-30 22:00:27 +0000123 /** Like this one */
ccheeverf53b5cf2007-02-05 20:33:11 +0000124 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 Reiss1ac05802007-07-30 22:00:27 +0000132 /** This is an example of a function with params documented */
ccheeverf53b5cf2007-02-05 20:33:11 +0000133 Numberz testEnum(
134
David Reiss1ac05802007-07-30 22:00:27 +0000135 /** This param is a thing */
ccheeverf53b5cf2007-02-05 20:33:11 +0000136 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
ccheeverf53b5cf2007-02-05 20:33:11 +0000147}
148
David Reiss1ac05802007-07-30 22:00:27 +0000149/// This style of Doxy-comment doesn't work.
150typedef i32 SorryNoGo
151
152/**
153 * This is a trivial example of a multiline docstring.
154 */
155typedef i32 TrivialMultiLine
156
157/**
Konrad Grochowski3b5dacb2014-11-24 10:55:31 +0100158 * This is the canonical example
David Reiss1ac05802007-07-30 22:00:27 +0000159 * of a multiline docstring.
160 */
161typedef i32 StandardMultiLine
162
163/**
164 * The last line is non-blank.
165 * I said non-blank! */
166typedef i32 LastLine
167
168/** Both the first line
169 * are non blank. ;-)
170 * and the last line */
171typedef i32 FirstAndLastLine
172
173/**
174 * INDENTED TITLE
175 * The text is less indented.
176 */
177typedef i32 IndentedTitle
178
179/** First line indented.
180 * Unfortunately, this does not get indented.
181 */
182typedef i32 FirstLineIndent
183
184
185/**
186 * void code_in_comment() {
187 * printf("hooray code!");
188 * }
189 */
190typedef i32 CodeInComment
191
192 /**
193 * Indented Docstring.
194 * This whole docstring is indented.
195 * This line is indented further.
196 */
197typedef i32 IndentedDocstring
198
199/** Irregular docstring.
200 * We will have to punt
201 * on this thing */
202typedef i32 Irregular1
203
204/**
205 * note the space
206 * before these lines
207* but not this
208 * one
209 */
210typedef i32 Irregular2
211
212/**
213* Flush against
214* the left.
215*/
216typedef i32 Flush
217
218/**
219 No stars in this one.
220 It should still work fine, though.
221 Including indenting.
222 */
223typedef i32 NoStars
224
225/** Trailing whitespace
226Sloppy trailing whitespace
227is truncated. */
228typedef 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 */
239typedef i32 BigDog
David Reissc2532a92007-07-30 23:46:11 +0000240
241/**
242*
243*
244*/
245typedef i32 TotallyDegenerate
246
Jens Geyer97cc95b2013-09-18 23:53:14 +0200247/**no room for newline here*/
248
Jens Geyer108fab82016-01-28 21:30:08 +0100249/* * / */
250typedef i32 TestFor3501a
251
252/**
253 * /
254 */
255typedef i32 TestFor3501b
256
Jens Geyer775671a2016-03-06 19:02:42 +0100257
258/* Comment-end tokens can of course have more than one asterisk */
259struct TestFor3709_00 { /* ? */ 1: i32 foo }
260/* Comment-end tokens can of course have more than one asterisk **/
261struct TestFor3709_01 { /* ? */ 1: i32 foo }
262/* Comment-end tokens can of course have more than one asterisk ***/
263struct TestFor3709_02 { /* ? */ 1: i32 foo }
264/** Comment-end tokens can of course have more than one asterisk */
265struct TestFor3709_03 { /* ? */ 1: i32 foo }
266/** Comment-end tokens can of course have more than one asterisk **/
267struct TestFor3709_04 { /* ? */ 1: i32 foo }
268/** Comment-end tokens can of course have more than one asterisk ***/
269struct TestFor3709_05 { /* ? */ 1: i32 foo }
270/*** Comment-end tokens can of course have more than one asterisk */
271struct TestFor3709_06 { /* ? */ 1: i32 foo }
272/*** Comment-end tokens can of course have more than one asterisk **/
273struct TestFor3709_07 { /* ? */ 1: i32 foo }
274/*** Comment-end tokens can of course have more than one asterisk ***/
275struct TestFor3709_08 { /* ? */ 1: i32 foo }
276
277struct 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 Reissc2532a92007-07-30 23:46:11 +0000287/* THE END */