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 * Program doctext.
22 *
23 * Seriously, this is the documentation for this whole program.
24 */
25
26namespace java thrift.test
27namespace cpp thrift.test
28
29// C++ comment
30/* c style comment */
31
32# the new unix comment
33
34/** Some doc text goes here.  Wow I am [nesting these] (no more nesting.) */
35enum Numberz
36{
37
38  /** This is how to document a parameter */
39  ONE = 1,
40
41  /** And this is a doc for a parameter that has no specific value assigned */
42  TWO,
43
44  THREE,
45  FIVE = 5,
46  SIX,
47  EIGHT = 8
48}
49
50/** This is how you would do a typedef doc */
51typedef i64 UserId
52
53/** And this is where you would document a struct */
54struct Xtruct
55{
56
57  /** And the members of a struct */
58  1:  string string_thing
59
60  /** doct text goes before a comma */
61  4:  i8     byte_thing,
62
63  9:  i32    i32_thing,
64  11: i64    i64_thing
65}
66
67/**
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
75struct Xtruct2
76{
77  1: i8     byte_thing,
78  2: Xtruct struct_thing,
79  3: i32    i32_thing
80}
81
82/** Struct insanity */
83struct Insanity
84{
85
86  /** This is doc for field 1 */
87  1: map<Numberz, UserId> userMap,
88
89  /** And this is doc for field 2 */
90  2: list<Xtruct> xtructs
91}
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}
102
103/* C1 */
104/** Doc */
105/* C2 */
106/* C3 */
107struct EmptyStruct {}
108
109struct OneField {
110  1: EmptyStruct field
111}
112
113/** This is where you would document a Service */
114service ThriftTest
115{
116
117  /** And this is how you would document functions in a service */
118  void         testVoid(),
119  string       testString(1: string thing),
120  i8           testByte(1: byte thing),
121  i32          testI32(1: i32 thing),
122
123  /** Like this one */
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
132  /** This is an example of a function with params documented */
133  Numberz      testEnum(
134
135    /** This param is a thing */
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
147}
148
149/// 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/**
158 * This is the canonical example
159 * 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
240
241/**
242*
243*
244*/
245typedef i32 TotallyDegenerate
246
247/**no room for newline here*/
248
249/* * / */
250typedef i32 TestFor3501a
251
252/**
253 * /
254 */
255typedef i32 TestFor3501b
256
257
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
287/* THE END */
288