blob: 72599fac667230687d712fd90054aa828c52d596 [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
David Reiss771f8c72008-02-27 01:55:25 +00007namespace java thrift.test
David Reiss9a08dc62008-02-27 01:55:17 +00008namespace cpp thrift.test
ccheeverf53b5cf2007-02-05 20:33:11 +00009
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 */
David Reiss0c90f6f2008-02-06 22:18:40 +000032typedef i64 UserId
ccheeverf53b5cf2007-02-05 20:33:11 +000033
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 */
David Reiss0c90f6f2008-02-06 22:18:40 +000071 2: list<Xtruct> xtructs
ccheeverf53b5cf2007-02-05 20:33:11 +000072}
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}
David Reiss0c90f6f2008-02-06 22:18:40 +000083
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
ccheeverf53b5cf2007-02-05 20:33:11 +0000128}
129
David Reiss1ac05802007-07-30 22:00:27 +0000130/// This style of Doxy-comment doesn't work.
131typedef i32 SorryNoGo
132
133/**
134 * This is a trivial example of a multiline docstring.
135 */
136typedef i32 TrivialMultiLine
137
138/**
139 * This is the cannonical example
140 * of a multiline docstring.
141 */
142typedef i32 StandardMultiLine
143
144/**
145 * The last line is non-blank.
146 * I said non-blank! */
147typedef i32 LastLine
148
149/** Both the first line
150 * are non blank. ;-)
151 * and the last line */
152typedef i32 FirstAndLastLine
153
154/**
155 * INDENTED TITLE
156 * The text is less indented.
157 */
158typedef i32 IndentedTitle
159
160/** First line indented.
161 * Unfortunately, this does not get indented.
162 */
163typedef i32 FirstLineIndent
164
165
166/**
167 * void code_in_comment() {
168 * printf("hooray code!");
169 * }
170 */
171typedef i32 CodeInComment
172
173 /**
174 * Indented Docstring.
175 * This whole docstring is indented.
176 * This line is indented further.
177 */
178typedef i32 IndentedDocstring
179
180/** Irregular docstring.
181 * We will have to punt
182 * on this thing */
183typedef i32 Irregular1
184
185/**
186 * note the space
187 * before these lines
188* but not this
189 * one
190 */
191typedef i32 Irregular2
192
193/**
194* Flush against
195* the left.
196*/
197typedef i32 Flush
198
199/**
200 No stars in this one.
201 It should still work fine, though.
202 Including indenting.
203 */
204typedef i32 NoStars
205
206/** Trailing whitespace
207Sloppy trailing whitespace
208is truncated. */
209typedef i32 TrailingWhitespace
210
211/**
212 * This is a big one.
213 *
214 * We'll have some blank lines in it.
215 *
216 * void as_well_as(some code) {
217 * puts("YEEHAW!");
218 * }
219 */
220typedef i32 BigDog
David Reissc2532a92007-07-30 23:46:11 +0000221
222/**
223*
224*
225*/
226typedef i32 TotallyDegenerate
227
228/* THE END */