blob: e202b0eb5876896a4161913c61e64cd88a5c554b [file] [log] [blame]
David Reissc2532a92007-07-30 23:46:11 +00001/**
2 * Program doctext.
3 *
4 * Seriously, this is the documentation for this whole program.
5 */
6
ccheeverf53b5cf2007-02-05 20:33:11 +00007java_package thrift.test
8cpp_namespace thrift.test
9
10// C++ comment
11/* c style comment */
12
13# the new unix comment
14
David Reiss1ac05802007-07-30 22:00:27 +000015/** Some doc text goes here. Wow I am [nesting these] (no more nesting.) */
ccheeverf53b5cf2007-02-05 20:33:11 +000016enum Numberz
17{
18
David Reiss1ac05802007-07-30 22:00:27 +000019 /** This is how to document a parameter */
ccheeverf53b5cf2007-02-05 20:33:11 +000020 ONE = 1,
21
David Reiss1ac05802007-07-30 22:00:27 +000022 /** And this is a doc for a parameter that has no specific value assigned */
ccheeverf53b5cf2007-02-05 20:33:11 +000023 TWO,
24
25 THREE,
26 FIVE = 5,
27 SIX,
28 EIGHT = 8
29}
30
David Reiss1ac05802007-07-30 22:00:27 +000031/** This is how you would do a typedef doc */
ccheeverf53b5cf2007-02-05 20:33:11 +000032typedef i64 UserId
33
David Reiss1ac05802007-07-30 22:00:27 +000034/** And this is where you would document a struct */
ccheeverf53b5cf2007-02-05 20:33:11 +000035struct Xtruct
36{
37
David Reiss1ac05802007-07-30 22:00:27 +000038 /** And the members of a struct */
ccheeverf53b5cf2007-02-05 20:33:11 +000039 1: string string_thing
40
David Reiss1ac05802007-07-30 22:00:27 +000041 /** doct text goes before a comma */
ccheeverf53b5cf2007-02-05 20:33:11 +000042 4: byte byte_thing,
43
44 9: i32 i32_thing,
45 11: i64 i64_thing
46}
47
David Reisscdffe262007-08-14 17:12:31 +000048/**
49 * You can document constants now too. Yeehaw!
50 */
51const i32 INT32CONSTANT = 9853
52const i16 INT16CONSTANT = 1616
53/** Everyone get in on the docu-action! */
54const map<string,string> MAPCONSTANT = {'hello':'world', 'goodnight':'moon'}
55
ccheeverf53b5cf2007-02-05 20:33:11 +000056struct Xtruct2
57{
58 1: byte byte_thing,
59 2: Xtruct struct_thing,
60 3: i32 i32_thing
61}
62
David Reiss1ac05802007-07-30 22:00:27 +000063/** Struct insanity */
ccheeverf53b5cf2007-02-05 20:33:11 +000064struct Insanity
65{
66
David Reiss1ac05802007-07-30 22:00:27 +000067 /** This is doc for field 1 */
ccheeverf53b5cf2007-02-05 20:33:11 +000068 1: map<Numberz, UserId> userMap,
69
David Reiss1ac05802007-07-30 22:00:27 +000070 /** And this is doc for field 2 */
ccheeverf53b5cf2007-02-05 20:33:11 +000071 2: list<Xtruct> xtructs
72}
73
74exception Xception {
75 1: i32 errorCode,
76 2: string message
77}
78
79exception Xception2 {
80 1: i32 errorCode,
81 2: Xtruct struct_thing
82}
83
David Reissc2532a92007-07-30 23:46:11 +000084/* C1 */
85/** Doc */
86/* C2 */
87/* C3 */
ccheeverf53b5cf2007-02-05 20:33:11 +000088struct EmptyStruct {}
89
90struct OneField {
91 1: EmptyStruct field
92}
93
David Reiss1ac05802007-07-30 22:00:27 +000094/** This is where you would document a Service */
ccheeverf53b5cf2007-02-05 20:33:11 +000095service ThriftTest
96{
97
David Reiss1ac05802007-07-30 22:00:27 +000098 /** And this is how you would document functions in a service */
ccheeverf53b5cf2007-02-05 20:33:11 +000099 void testVoid(),
100 string testString(1: string thing),
101 byte testByte(1: byte thing),
102 i32 testI32(1: i32 thing),
103
David Reiss1ac05802007-07-30 22:00:27 +0000104 /** Like this one */
ccheeverf53b5cf2007-02-05 20:33:11 +0000105 i64 testI64(1: i64 thing),
106 double testDouble(1: double thing),
107 Xtruct testStruct(1: Xtruct thing),
108 Xtruct2 testNest(1: Xtruct2 thing),
109 map<i32,i32> testMap(1: map<i32,i32> thing),
110 set<i32> testSet(1: set<i32> thing),
111 list<i32> testList(1: list<i32> thing),
112
David Reiss1ac05802007-07-30 22:00:27 +0000113 /** This is an example of a function with params documented */
ccheeverf53b5cf2007-02-05 20:33:11 +0000114 Numberz testEnum(
115
David Reiss1ac05802007-07-30 22:00:27 +0000116 /** This param is a thing */
ccheeverf53b5cf2007-02-05 20:33:11 +0000117 1: Numberz thing
118
119 ),
120
121 UserId testTypedef(1: UserId thing),
122
123 map<i32,map<i32,i32>> testMapMap(1: i32 hello),
124
125 /* So you think you've got this all worked, out eh? */
126 map<UserId, map<Numberz,Insanity>> testInsanity(1: Insanity argument),
127
128 /* Multiple parameters */
129
130 Xtruct testMulti(byte arg0, i32 arg1, i64 arg2, map<i16, string> arg3, Numberz arg4, UserId arg5),
131
132 /* Exception specifier */
133
134 void testException(string arg) throws(Xception err1),
135
136 /* Multiple exceptions specifier */
137
138 Xtruct testMultiException(string arg0, string arg1) throws(Xception err1, Xception2 err2)
139}
140
David Reiss1ac05802007-07-30 22:00:27 +0000141/// This style of Doxy-comment doesn't work.
142typedef i32 SorryNoGo
143
144/**
145 * This is a trivial example of a multiline docstring.
146 */
147typedef i32 TrivialMultiLine
148
149/**
150 * This is the cannonical example
151 * of a multiline docstring.
152 */
153typedef i32 StandardMultiLine
154
155/**
156 * The last line is non-blank.
157 * I said non-blank! */
158typedef i32 LastLine
159
160/** Both the first line
161 * are non blank. ;-)
162 * and the last line */
163typedef i32 FirstAndLastLine
164
165/**
166 * INDENTED TITLE
167 * The text is less indented.
168 */
169typedef i32 IndentedTitle
170
171/** First line indented.
172 * Unfortunately, this does not get indented.
173 */
174typedef i32 FirstLineIndent
175
176
177/**
178 * void code_in_comment() {
179 * printf("hooray code!");
180 * }
181 */
182typedef i32 CodeInComment
183
184 /**
185 * Indented Docstring.
186 * This whole docstring is indented.
187 * This line is indented further.
188 */
189typedef i32 IndentedDocstring
190
191/** Irregular docstring.
192 * We will have to punt
193 * on this thing */
194typedef i32 Irregular1
195
196/**
197 * note the space
198 * before these lines
199* but not this
200 * one
201 */
202typedef i32 Irregular2
203
204/**
205* Flush against
206* the left.
207*/
208typedef i32 Flush
209
210/**
211 No stars in this one.
212 It should still work fine, though.
213 Including indenting.
214 */
215typedef i32 NoStars
216
217/** Trailing whitespace
218Sloppy trailing whitespace
219is truncated. */
220typedef i32 TrailingWhitespace
221
222/**
223 * This is a big one.
224 *
225 * We'll have some blank lines in it.
226 *
227 * void as_well_as(some code) {
228 * puts("YEEHAW!");
229 * }
230 */
231typedef i32 BigDog
David Reissc2532a92007-07-30 23:46:11 +0000232
233/**
234*
235*
236*/
237typedef i32 TotallyDegenerate
238
239/* THE END */