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 | |
| 48 | struct Xtruct2 |
| 49 | { |
| 50 | 1: byte byte_thing, |
| 51 | 2: Xtruct struct_thing, |
| 52 | 3: i32 i32_thing |
| 53 | } |
| 54 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 55 | /** Struct insanity */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 56 | struct Insanity |
| 57 | { |
| 58 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 59 | /** This is doc for field 1 */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 60 | 1: map<Numberz, UserId> userMap, |
| 61 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 62 | /** And this is doc for field 2 */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 63 | 2: list<Xtruct> xtructs |
| 64 | } |
| 65 | |
| 66 | exception Xception { |
| 67 | 1: i32 errorCode, |
| 68 | 2: string message |
| 69 | } |
| 70 | |
| 71 | exception Xception2 { |
| 72 | 1: i32 errorCode, |
| 73 | 2: Xtruct struct_thing |
| 74 | } |
| 75 | |
David Reiss | c2532a9 | 2007-07-30 23:46:11 +0000 | [diff] [blame] | 76 | /* C1 */ |
| 77 | /** Doc */ |
| 78 | /* C2 */ |
| 79 | /* C3 */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 80 | struct EmptyStruct {} |
| 81 | |
| 82 | struct OneField { |
| 83 | 1: EmptyStruct field |
| 84 | } |
| 85 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 86 | /** This is where you would document a Service */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 87 | service ThriftTest |
| 88 | { |
| 89 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 90 | /** And this is how you would document functions in a service */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 91 | void testVoid(), |
| 92 | string testString(1: string thing), |
| 93 | byte testByte(1: byte thing), |
| 94 | i32 testI32(1: i32 thing), |
| 95 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 96 | /** Like this one */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 97 | 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 Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 105 | /** This is an example of a function with params documented */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 106 | Numberz testEnum( |
| 107 | |
David Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 108 | /** This param is a thing */ |
ccheever | f53b5cf | 2007-02-05 20:33:11 +0000 | [diff] [blame] | 109 | 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 Reiss | 1ac0580 | 2007-07-30 22:00:27 +0000 | [diff] [blame] | 133 | /// This style of Doxy-comment doesn't work. |
| 134 | typedef i32 SorryNoGo |
| 135 | |
| 136 | /** |
| 137 | * This is a trivial example of a multiline docstring. |
| 138 | */ |
| 139 | typedef i32 TrivialMultiLine |
| 140 | |
| 141 | /** |
| 142 | * This is the cannonical example |
| 143 | * of a multiline docstring. |
| 144 | */ |
| 145 | typedef i32 StandardMultiLine |
| 146 | |
| 147 | /** |
| 148 | * The last line is non-blank. |
| 149 | * I said non-blank! */ |
| 150 | typedef i32 LastLine |
| 151 | |
| 152 | /** Both the first line |
| 153 | * are non blank. ;-) |
| 154 | * and the last line */ |
| 155 | typedef i32 FirstAndLastLine |
| 156 | |
| 157 | /** |
| 158 | * INDENTED TITLE |
| 159 | * The text is less indented. |
| 160 | */ |
| 161 | typedef i32 IndentedTitle |
| 162 | |
| 163 | /** First line indented. |
| 164 | * Unfortunately, this does not get indented. |
| 165 | */ |
| 166 | typedef i32 FirstLineIndent |
| 167 | |
| 168 | |
| 169 | /** |
| 170 | * void code_in_comment() { |
| 171 | * printf("hooray code!"); |
| 172 | * } |
| 173 | */ |
| 174 | typedef i32 CodeInComment |
| 175 | |
| 176 | /** |
| 177 | * Indented Docstring. |
| 178 | * This whole docstring is indented. |
| 179 | * This line is indented further. |
| 180 | */ |
| 181 | typedef i32 IndentedDocstring |
| 182 | |
| 183 | /** Irregular docstring. |
| 184 | * We will have to punt |
| 185 | * on this thing */ |
| 186 | typedef i32 Irregular1 |
| 187 | |
| 188 | /** |
| 189 | * note the space |
| 190 | * before these lines |
| 191 | * but not this |
| 192 | * one |
| 193 | */ |
| 194 | typedef i32 Irregular2 |
| 195 | |
| 196 | /** |
| 197 | * Flush against |
| 198 | * the left. |
| 199 | */ |
| 200 | typedef i32 Flush |
| 201 | |
| 202 | /** |
| 203 | No stars in this one. |
| 204 | It should still work fine, though. |
| 205 | Including indenting. |
| 206 | */ |
| 207 | typedef i32 NoStars |
| 208 | |
| 209 | /** Trailing whitespace |
| 210 | Sloppy trailing whitespace |
| 211 | is truncated. */ |
| 212 | typedef 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 | */ |
| 223 | typedef i32 BigDog |
David Reiss | c2532a9 | 2007-07-30 23:46:11 +0000 | [diff] [blame] | 224 | |
| 225 | /** |
| 226 | * |
| 227 | * |
| 228 | */ |
| 229 | typedef i32 TotallyDegenerate |
| 230 | |
| 231 | /* THE END */ |