blob: 682edffe030c4cb1265fbb183dfea5ce456b14d9 [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
9[Some doc text goes here. Wow I am [nesting these].]
10enum Numberz
11{
12
13 [This is how to document a parameter]
14 ONE = 1,
15
16 [And this is a doc for a parameter that has no specific value assigned]
17 TWO,
18
19 THREE,
20 FIVE = 5,
21 SIX,
22 EIGHT = 8
23}
24
25[This is how you would do a typedef doc]
26typedef i64 UserId
27
28[And this is where you would document a struct]
29struct Xtruct
30{
31
32 [And the members of a struct]
33 1: string string_thing
34
35 [doct text goes before a comma]
36 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
49[Struct insanity]
50struct Insanity
51{
52
53 [This is doc for field 1]
54 1: map<Numberz, UserId> userMap,
55
56 [And this is doc for field 2]
57 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
76[This is where you would document a Service]
77service ThriftTest
78{
79
80 [And this is how you would document functions in a service]
81 void testVoid(),
82 string testString(1: string thing),
83 byte testByte(1: byte thing),
84 i32 testI32(1: i32 thing),
85
86 [Like this one]
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
95 [This is an example of a function with params documented]
96 Numberz testEnum(
97
98 [This param is a thing]
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
123service SecondService
124{
125 void blahBlah()
126}