blob: c06bd212b74aaf27672ad1628737b7abcd62454c [file] [log] [blame]
ccheeverf53b5cf2007-02-05 20:33:11 +00001java_package thrift.test
2cpp_namespace thrift.test
3
4// C++ comment
5/* c style comment */
6
7# the new unix comment
8
David Reiss1ac05802007-07-30 22:00:27 +00009/** Some doc text goes here. Wow I am [nesting these] (no more nesting.) */
ccheeverf53b5cf2007-02-05 20:33:11 +000010enum Numberz
11{
12
David Reiss1ac05802007-07-30 22:00:27 +000013 /** This is how to document a parameter */
ccheeverf53b5cf2007-02-05 20:33:11 +000014 ONE = 1,
15
David Reiss1ac05802007-07-30 22:00:27 +000016 /** And this is a doc for a parameter that has no specific value assigned */
ccheeverf53b5cf2007-02-05 20:33:11 +000017 TWO,
18
19 THREE,
20 FIVE = 5,
21 SIX,
22 EIGHT = 8
23}
24
David Reiss1ac05802007-07-30 22:00:27 +000025/** This is how you would do a typedef doc */
ccheeverf53b5cf2007-02-05 20:33:11 +000026typedef i64 UserId
27
David Reiss1ac05802007-07-30 22:00:27 +000028/** And this is where you would document a struct */
ccheeverf53b5cf2007-02-05 20:33:11 +000029struct Xtruct
30{
31
David Reiss1ac05802007-07-30 22:00:27 +000032 /** And the members of a struct */
ccheeverf53b5cf2007-02-05 20:33:11 +000033 1: string string_thing
34
David Reiss1ac05802007-07-30 22:00:27 +000035 /** doct text goes before a comma */
ccheeverf53b5cf2007-02-05 20:33:11 +000036 4: byte byte_thing,
37
38 9: i32 i32_thing,
39 11: i64 i64_thing
40}
41
42struct Xtruct2
43{
44 1: byte byte_thing,
45 2: Xtruct struct_thing,
46 3: i32 i32_thing
47}
48
David Reiss1ac05802007-07-30 22:00:27 +000049/** Struct insanity */
ccheeverf53b5cf2007-02-05 20:33:11 +000050struct Insanity
51{
52
David Reiss1ac05802007-07-30 22:00:27 +000053 /** This is doc for field 1 */
ccheeverf53b5cf2007-02-05 20:33:11 +000054 1: map<Numberz, UserId> userMap,
55
David Reiss1ac05802007-07-30 22:00:27 +000056 /** And this is doc for field 2 */
ccheeverf53b5cf2007-02-05 20:33:11 +000057 2: list<Xtruct> xtructs
58}
59
60exception Xception {
61 1: i32 errorCode,
62 2: string message
63}
64
65exception Xception2 {
66 1: i32 errorCode,
67 2: Xtruct struct_thing
68}
69
70struct EmptyStruct {}
71
72struct OneField {
73 1: EmptyStruct field
74}
75
David Reiss1ac05802007-07-30 22:00:27 +000076/** This is where you would document a Service */
ccheeverf53b5cf2007-02-05 20:33:11 +000077service ThriftTest
78{
79
David Reiss1ac05802007-07-30 22:00:27 +000080 /** And this is how you would document functions in a service */
ccheeverf53b5cf2007-02-05 20:33:11 +000081 void testVoid(),
82 string testString(1: string thing),
83 byte testByte(1: byte thing),
84 i32 testI32(1: i32 thing),
85
David Reiss1ac05802007-07-30 22:00:27 +000086 /** Like this one */
ccheeverf53b5cf2007-02-05 20:33:11 +000087 i64 testI64(1: i64 thing),
88 double testDouble(1: double thing),
89 Xtruct testStruct(1: Xtruct thing),
90 Xtruct2 testNest(1: Xtruct2 thing),
91 map<i32,i32> testMap(1: map<i32,i32> thing),
92 set<i32> testSet(1: set<i32> thing),
93 list<i32> testList(1: list<i32> thing),
94
David Reiss1ac05802007-07-30 22:00:27 +000095 /** This is an example of a function with params documented */
ccheeverf53b5cf2007-02-05 20:33:11 +000096 Numberz testEnum(
97
David Reiss1ac05802007-07-30 22:00:27 +000098 /** This param is a thing */
ccheeverf53b5cf2007-02-05 20:33:11 +000099 1: Numberz thing
100
101 ),
102
103 UserId testTypedef(1: UserId thing),
104
105 map<i32,map<i32,i32>> testMapMap(1: i32 hello),
106
107 /* So you think you've got this all worked, out eh? */
108 map<UserId, map<Numberz,Insanity>> testInsanity(1: Insanity argument),
109
110 /* Multiple parameters */
111
112 Xtruct testMulti(byte arg0, i32 arg1, i64 arg2, map<i16, string> arg3, Numberz arg4, UserId arg5),
113
114 /* Exception specifier */
115
116 void testException(string arg) throws(Xception err1),
117
118 /* Multiple exceptions specifier */
119
120 Xtruct testMultiException(string arg0, string arg1) throws(Xception err1, Xception2 err2)
121}
122
David Reiss1ac05802007-07-30 22:00:27 +0000123/// This style of Doxy-comment doesn't work.
124typedef i32 SorryNoGo
125
126/**
127 * This is a trivial example of a multiline docstring.
128 */
129typedef i32 TrivialMultiLine
130
131/**
132 * This is the cannonical example
133 * of a multiline docstring.
134 */
135typedef i32 StandardMultiLine
136
137/**
138 * The last line is non-blank.
139 * I said non-blank! */
140typedef i32 LastLine
141
142/** Both the first line
143 * are non blank. ;-)
144 * and the last line */
145typedef i32 FirstAndLastLine
146
147/**
148 * INDENTED TITLE
149 * The text is less indented.
150 */
151typedef i32 IndentedTitle
152
153/** First line indented.
154 * Unfortunately, this does not get indented.
155 */
156typedef i32 FirstLineIndent
157
158
159/**
160 * void code_in_comment() {
161 * printf("hooray code!");
162 * }
163 */
164typedef i32 CodeInComment
165
166 /**
167 * Indented Docstring.
168 * This whole docstring is indented.
169 * This line is indented further.
170 */
171typedef i32 IndentedDocstring
172
173/** Irregular docstring.
174 * We will have to punt
175 * on this thing */
176typedef i32 Irregular1
177
178/**
179 * note the space
180 * before these lines
181* but not this
182 * one
183 */
184typedef i32 Irregular2
185
186/**
187* Flush against
188* the left.
189*/
190typedef i32 Flush
191
192/**
193 No stars in this one.
194 It should still work fine, though.
195 Including indenting.
196 */
197typedef i32 NoStars
198
199/** Trailing whitespace
200Sloppy trailing whitespace
201is truncated. */
202typedef i32 TrailingWhitespace
203
204/**
205 * This is a big one.
206 *
207 * We'll have some blank lines in it.
208 *
209 * void as_well_as(some code) {
210 * puts("YEEHAW!");
211 * }
212 */
213typedef i32 BigDog