David Reiss | c2532a9 | 2007-07-30 23:46:11 +0000 | [diff] [blame] | 1 | /** |
| 2 | * Program doctext. |
| 3 | * |
| 4 | * Seriously, this is the documentation for this whole program. |
| 5 | */ |
| 6 | |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 7 | java_package thrift.test |
| 8 | cpp_namespace thrift.test |
| 9 | |
| 10 | // C++ comment |
| 11 | /* c style comment */ |
| 12 | |
| 13 | # the new unix comment |
| 14 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 15 | /** Some doc text goes here. Wow I am [nesting these] (no more nesting.) */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 16 | enum Numberz |
| 17 | { |
| 18 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 19 | /** This is how to document a parameter */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 20 | ONE = 1, |
| 21 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 22 | /** And this is a doc for a parameter that has no specific value assigned */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 23 | TWO, |
| 24 | |
| 25 | THREE, |
| 26 | FIVE = 5, |
| 27 | SIX, |
| 28 | EIGHT = 8 |
| 29 | } |
| 30 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 31 | /** This is how you would do a typedef doc */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 32 | typedef i64 UserId |
| 33 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 34 | /** And this is where you would document a struct */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 35 | struct Xtruct |
| 36 | { |
| 37 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 38 | /** And the members of a struct */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 39 | 1: string string_thing |
| 40 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 41 | /** doct text goes before a comma */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 42 | 4: byte byte_thing, |
| 43 | |
| 44 | 9: i32 i32_thing, |
| 45 | 11: i64 i64_thing |
| 46 | } |
| 47 | |
David Reiss | cdffe26 | 2007-08-14 17:12:31 +0000 | [diff] [blame] | 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'} |
| 55 | |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 56 | struct Xtruct2 |
| 57 | { |
| 58 | 1: byte byte_thing, |
| 59 | 2: Xtruct struct_thing, |
| 60 | 3: i32 i32_thing |
| 61 | } |
| 62 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 63 | /** Struct insanity */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 64 | struct Insanity |
| 65 | { |
| 66 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 67 | /** This is doc for field 1 */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 68 | 1: map<Numberz, UserId> userMap, |
| 69 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 70 | /** And this is doc for field 2 */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 71 | 2: list<Xtruct> xtructs |
| 72 | } |
| 73 | |
| 74 | exception Xception { |
| 75 | 1: i32 errorCode, |
| 76 | 2: string message |
| 77 | } |
| 78 | |
| 79 | exception Xception2 { |
| 80 | 1: i32 errorCode, |
| 81 | 2: Xtruct struct_thing |
| 82 | } |
| 83 | |
David Reiss | c2532a9 | 2007-07-30 23:46:11 +0000 | [diff] [blame] | 84 | /* C1 */ |
| 85 | /** Doc */ |
| 86 | /* C2 */ |
| 87 | /* C3 */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 88 | struct EmptyStruct {} |
| 89 | |
| 90 | struct OneField { |
| 91 | 1: EmptyStruct field |
| 92 | } |
| 93 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 94 | /** This is where you would document a Service */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 95 | service ThriftTest |
| 96 | { |
| 97 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 98 | /** And this is how you would document functions in a service */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 99 | void testVoid(), |
| 100 | string testString(1: string thing), |
| 101 | byte testByte(1: byte thing), |
| 102 | i32 testI32(1: i32 thing), |
| 103 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 104 | /** Like this one */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 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), |
| 112 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 113 | /** This is an example of a function with params documented */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 114 | Numberz testEnum( |
| 115 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 116 | /** This param is a thing */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 117 | 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 | |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 128 | } |
| 129 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 130 | /// This style of Doxy-comment doesn't work. |
| 131 | typedef i32 SorryNoGo |
| 132 | |
| 133 | /** |
| 134 | * This is a trivial example of a multiline docstring. |
| 135 | */ |
| 136 | typedef i32 TrivialMultiLine |
| 137 | |
| 138 | /** |
| 139 | * This is the cannonical example |
| 140 | * of a multiline docstring. |
| 141 | */ |
| 142 | typedef i32 StandardMultiLine |
| 143 | |
| 144 | /** |
| 145 | * The last line is non-blank. |
| 146 | * I said non-blank! */ |
| 147 | typedef i32 LastLine |
| 148 | |
| 149 | /** Both the first line |
| 150 | * are non blank. ;-) |
| 151 | * and the last line */ |
| 152 | typedef i32 FirstAndLastLine |
| 153 | |
| 154 | /** |
| 155 | * INDENTED TITLE |
| 156 | * The text is less indented. |
| 157 | */ |
| 158 | typedef i32 IndentedTitle |
| 159 | |
| 160 | /** First line indented. |
| 161 | * Unfortunately, this does not get indented. |
| 162 | */ |
| 163 | typedef i32 FirstLineIndent |
| 164 | |
| 165 | |
| 166 | /** |
| 167 | * void code_in_comment() { |
| 168 | * printf("hooray code!"); |
| 169 | * } |
| 170 | */ |
| 171 | typedef i32 CodeInComment |
| 172 | |
| 173 | /** |
| 174 | * Indented Docstring. |
| 175 | * This whole docstring is indented. |
| 176 | * This line is indented further. |
| 177 | */ |
| 178 | typedef i32 IndentedDocstring |
| 179 | |
| 180 | /** Irregular docstring. |
| 181 | * We will have to punt |
| 182 | * on this thing */ |
| 183 | typedef i32 Irregular1 |
| 184 | |
| 185 | /** |
| 186 | * note the space |
| 187 | * before these lines |
| 188 | * but not this |
| 189 | * one |
| 190 | */ |
| 191 | typedef i32 Irregular2 |
| 192 | |
| 193 | /** |
| 194 | * Flush against |
| 195 | * the left. |
| 196 | */ |
| 197 | typedef i32 Flush |
| 198 | |
| 199 | /** |
| 200 | No stars in this one. |
| 201 | It should still work fine, though. |
| 202 | Including indenting. |
| 203 | */ |
| 204 | typedef i32 NoStars |
| 205 | |
| 206 | /** Trailing whitespace |
| 207 | Sloppy trailing whitespace |
| 208 | is truncated. */ |
| 209 | typedef 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 | */ |
| 220 | typedef i32 BigDog |
David Reiss | c2532a9 | 2007-07-30 23:46:11 +0000 | [diff] [blame] | 221 | |
| 222 | /** |
| 223 | * |
| 224 | * |
| 225 | */ |
| 226 | typedef i32 TotallyDegenerate |
| 227 | |
| 228 | /* THE END */ |