r1403@opsdev009 (orig r74388): dreiss | 2007-12-14 12:56:04 -0800
[amiethrift.git] / test / DocTest.thrift
blobc94d426b4673d319fdff80ebd78ab2eb698f500a
1 /**
2  * Program doctext.
3  *
4  * Seriously, this is the documentation for this whole program.
5  */
7 java_package thrift.test
8 cpp_namespace thrift.test
10 // C++ comment
11 /* c style comment */
13 # the new unix comment
15 /** Some doc text goes here.  Wow I am [nesting these] (no more nesting.) */
16 enum Numberz
19   /** This is how to document a parameter */
20   ONE = 1,
22   /** And this is a doc for a parameter that has no specific value assigned */
23   TWO,
25   THREE,
26   FIVE = 5,
27   SIX,
28   EIGHT = 8
31 /** This is how you would do a typedef doc */
32 typedef i64 UserId 
34 /** And this is where you would document a struct */
35 struct Xtruct
38   /** And the members of a struct */
39   1:  string string_thing
41   /** doct text goes before a comma */
42   4:  byte   byte_thing,
44   9:  i32    i32_thing,
45   11: i64    i64_thing
48 /**
49  * You can document constants now too.  Yeehaw!
50  */
51 const i32 INT32CONSTANT = 9853
52 const i16 INT16CONSTANT = 1616
53 /** Everyone get in on the docu-action! */
54 const map<string,string> MAPCONSTANT = {'hello':'world', 'goodnight':'moon'}
56 struct Xtruct2
58   1: byte   byte_thing,
59   2: Xtruct struct_thing,
60   3: i32    i32_thing
63 /** Struct insanity */
64 struct Insanity
67   /** This is doc for field 1 */
68   1: map<Numberz, UserId> userMap,
70   /** And this is doc for field 2 */
71   2: list<Xtruct> xtructs 
74 exception Xception {
75   1: i32 errorCode,
76   2: string message
79 exception Xception2 {
80   1: i32 errorCode,
81   2: Xtruct struct_thing
84 /* C1 */
85 /** Doc */
86 /* C2 */
87 /* C3 */
88 struct EmptyStruct {}
90 struct OneField {
91   1: EmptyStruct field
94 /** This is where you would document a Service */
95 service ThriftTest
98   /** And this is how you would document functions in a service */
99   void         testVoid(),
100   string       testString(1: string thing),
101   byte         testByte(1: byte thing),
102   i32          testI32(1: i32 thing),
104   /** Like this one */
105   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),
113   /** This is an example of a function with params documented */
114   Numberz      testEnum(
116     /** This param is a thing */
117     1: Numberz thing
119   ),
121   UserId       testTypedef(1: UserId thing),
123   map<i32,map<i32,i32>> testMapMap(1: i32 hello),
125   /* So you think you've got this all worked, out eh? */
126   map<UserId, map<Numberz,Insanity>> testInsanity(1: Insanity argument),
130 /// This style of Doxy-comment doesn't work.
131 typedef i32 SorryNoGo
134  * This is a trivial example of a multiline docstring.
135  */
136 typedef i32 TrivialMultiLine
139  * This is the cannonical example
140  * of a multiline docstring.
141  */
142 typedef i32 StandardMultiLine
145  * The last line is non-blank.
146  * I said non-blank! */
147 typedef i32 LastLine
149 /** Both the first line
150  * are non blank. ;-)
151  * and the last line */
152 typedef i32 FirstAndLastLine
155  *    INDENTED TITLE
156  * The text is less indented.
157  */
158 typedef i32 IndentedTitle
160 /**       First line indented.
161  * Unfortunately, this does not get indented.
162  */
163 typedef i32 FirstLineIndent
167  * void code_in_comment() {
168  *   printf("hooray code!");
169  * }
170  */
171 typedef i32 CodeInComment
173     /**
174      * Indented Docstring.
175      * This whole docstring is indented.
176      *   This line is indented further.
177      */
178 typedef i32 IndentedDocstring
180 /** Irregular docstring.
181  * We will have to punt
182   * on this thing */
183 typedef i32 Irregular1
186  * note the space
187  * before these lines
188 * but not this
189  * one
190  */
191 typedef i32 Irregular2
194 * Flush against
195 * the left.
197 typedef i32 Flush
200   No stars in this one.
201   It should still work fine, though.
202     Including indenting.
203     */
204 typedef i32 NoStars
206 /** Trailing whitespace   
207 Sloppy trailing whitespace   
208 is truncated.   */
209 typedef i32 TrailingWhitespace
212  * This is a big one.
214  * We'll have some blank lines in it.
215  * 
216  * void as_well_as(some code) {
217  *   puts("YEEHAW!");
218  * }
219  */
220 typedef i32 BigDog
226 typedef i32 TotallyDegenerate
228 /* THE END */