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