blob: 361bdded6371e21260fe7f5116a95072b11cde2c [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
48struct Xtruct2
49{
50 1: byte byte_thing,
51 2: Xtruct struct_thing,
52 3: i32 i32_thing
53}
54
David Reiss1ac05802007-07-30 22:00:27 +000055/** Struct insanity */
ccheeverf53b5cf2007-02-05 20:33:11 +000056struct Insanity
57{
58
David Reiss1ac05802007-07-30 22:00:27 +000059 /** This is doc for field 1 */
ccheeverf53b5cf2007-02-05 20:33:11 +000060 1: map<Numberz, UserId> userMap,
61
David Reiss1ac05802007-07-30 22:00:27 +000062 /** And this is doc for field 2 */
ccheeverf53b5cf2007-02-05 20:33:11 +000063 2: list<Xtruct> xtructs
64}
65
66exception Xception {
67 1: i32 errorCode,
68 2: string message
69}
70
71exception Xception2 {
72 1: i32 errorCode,
73 2: Xtruct struct_thing
74}
75
David Reissc2532a92007-07-30 23:46:11 +000076/* C1 */
77/** Doc */
78/* C2 */
79/* C3 */
ccheeverf53b5cf2007-02-05 20:33:11 +000080struct EmptyStruct {}
81
82struct OneField {
83 1: EmptyStruct field
84}
85
David Reiss1ac05802007-07-30 22:00:27 +000086/** This is where you would document a Service */
ccheeverf53b5cf2007-02-05 20:33:11 +000087service ThriftTest
88{
89
David Reiss1ac05802007-07-30 22:00:27 +000090 /** And this is how you would document functions in a service */
ccheeverf53b5cf2007-02-05 20:33:11 +000091 void testVoid(),
92 string testString(1: string thing),
93 byte testByte(1: byte thing),
94 i32 testI32(1: i32 thing),
95
David Reiss1ac05802007-07-30 22:00:27 +000096 /** Like this one */
ccheeverf53b5cf2007-02-05 20:33:11 +000097 i64 testI64(1: i64 thing),
98 double testDouble(1: double thing),
99 Xtruct testStruct(1: Xtruct thing),
100 Xtruct2 testNest(1: Xtruct2 thing),
101 map<i32,i32> testMap(1: map<i32,i32> thing),
102 set<i32> testSet(1: set<i32> thing),
103 list<i32> testList(1: list<i32> thing),
104
David Reiss1ac05802007-07-30 22:00:27 +0000105 /** This is an example of a function with params documented */
ccheeverf53b5cf2007-02-05 20:33:11 +0000106 Numberz testEnum(
107
David Reiss1ac05802007-07-30 22:00:27 +0000108 /** This param is a thing */
ccheeverf53b5cf2007-02-05 20:33:11 +0000109 1: Numberz thing
110
111 ),
112
113 UserId testTypedef(1: UserId thing),
114
115 map<i32,map<i32,i32>> testMapMap(1: i32 hello),
116
117 /* So you think you've got this all worked, out eh? */
118 map<UserId, map<Numberz,Insanity>> testInsanity(1: Insanity argument),
119
120 /* Multiple parameters */
121
122 Xtruct testMulti(byte arg0, i32 arg1, i64 arg2, map<i16, string> arg3, Numberz arg4, UserId arg5),
123
124 /* Exception specifier */
125
126 void testException(string arg) throws(Xception err1),
127
128 /* Multiple exceptions specifier */
129
130 Xtruct testMultiException(string arg0, string arg1) throws(Xception err1, Xception2 err2)
131}
132
David Reiss1ac05802007-07-30 22:00:27 +0000133/// This style of Doxy-comment doesn't work.
134typedef i32 SorryNoGo
135
136/**
137 * This is a trivial example of a multiline docstring.
138 */
139typedef i32 TrivialMultiLine
140
141/**
142 * This is the cannonical example
143 * of a multiline docstring.
144 */
145typedef i32 StandardMultiLine
146
147/**
148 * The last line is non-blank.
149 * I said non-blank! */
150typedef i32 LastLine
151
152/** Both the first line
153 * are non blank. ;-)
154 * and the last line */
155typedef i32 FirstAndLastLine
156
157/**
158 * INDENTED TITLE
159 * The text is less indented.
160 */
161typedef i32 IndentedTitle
162
163/** First line indented.
164 * Unfortunately, this does not get indented.
165 */
166typedef i32 FirstLineIndent
167
168
169/**
170 * void code_in_comment() {
171 * printf("hooray code!");
172 * }
173 */
174typedef i32 CodeInComment
175
176 /**
177 * Indented Docstring.
178 * This whole docstring is indented.
179 * This line is indented further.
180 */
181typedef i32 IndentedDocstring
182
183/** Irregular docstring.
184 * We will have to punt
185 * on this thing */
186typedef i32 Irregular1
187
188/**
189 * note the space
190 * before these lines
191* but not this
192 * one
193 */
194typedef i32 Irregular2
195
196/**
197* Flush against
198* the left.
199*/
200typedef i32 Flush
201
202/**
203 No stars in this one.
204 It should still work fine, though.
205 Including indenting.
206 */
207typedef i32 NoStars
208
209/** Trailing whitespace
210Sloppy trailing whitespace
211is truncated. */
212typedef i32 TrailingWhitespace
213
214/**
215 * This is a big one.
216 *
217 * We'll have some blank lines in it.
218 *
219 * void as_well_as(some code) {
220 * puts("YEEHAW!");
221 * }
222 */
223typedef i32 BigDog
David Reissc2532a92007-07-30 23:46:11 +0000224
225/**
226*
227*
228*/
229typedef i32 TotallyDegenerate
230
231/* THE END */