David Reiss | 8320a92 | 2007-08-14 19:59:26 +0000 | [diff] [blame] | 1 | /* |
| 2 | ../compiler/cpp/thrift -cpp OptionalRequiredTest.thrift |
David Reiss | 2dc72c3 | 2007-08-21 23:59:34 +0000 | [diff] [blame] | 3 | g++ -Wall -g -I../lib/cpp/src -I/usr/local/include/boost-1_33_1 \ |
David Reiss | 8320a92 | 2007-08-14 19:59:26 +0000 | [diff] [blame] | 4 | OptionalRequiredTest.cpp gen-cpp/OptionalRequiredTest_types.cpp \ |
| 5 | ../lib/cpp/.libs/libthrift.a -o OptionalRequiredTest |
| 6 | ./OptionalRequiredTest |
| 7 | */ |
| 8 | |
| 9 | cpp_namespace thrift.test |
| 10 | |
| 11 | struct OldSchool { |
| 12 | 1: i16 im_int; |
| 13 | 2: string im_str; |
| 14 | 3: list<map<i32,string>> im_big; |
| 15 | } |
| 16 | |
| 17 | struct Simple { |
| 18 | 1: /* :) */ i16 im_default; |
| 19 | 2: required i16 im_required; |
| 20 | 3: optional i16 im_optional; |
| 21 | } |
| 22 | |
| 23 | struct Tricky1 { |
| 24 | 1: /* :) */ i16 im_default; |
| 25 | } |
| 26 | |
| 27 | struct Tricky2 { |
| 28 | 1: optional i16 im_optional; |
| 29 | } |
| 30 | |
| 31 | struct Tricky3 { |
| 32 | 1: required i16 im_required; |
| 33 | } |
| 34 | |
| 35 | struct Complex { |
| 36 | 1: i16 cp_default; |
| 37 | 2: required i16 cp_required; |
| 38 | 3: optional i16 cp_optional; |
| 39 | 4: map<i16,Simple> the_map; |
| 40 | 5: required Simple req_simp; |
| 41 | 6: optional Simple opt_simp; |
| 42 | } |
David Reiss | ce161a9 | 2007-09-11 22:09:42 +0000 | [diff] [blame^] | 43 | |
| 44 | struct ManyOpt { |
| 45 | 1: optional i32 opt1; |
| 46 | 2: optional i32 opt2; |
| 47 | 3: optional i32 opt3; |
| 48 | 4: i32 def4; |
| 49 | 5: optional i32 opt5; |
| 50 | 6: optional i32 opt6; |
| 51 | } |