external SwitchedSetExample: terminated_by(0xA) {
// Size is remaining_size -1 (minus the terminator linefeed)
switched_set( packageId ):
dynamic_size( remaining_size - 1 ) {
ascii packageId: int(base10), static_size(1);
ascii packageLength: static_size(1), int(base10),
encode_value( case_size - 2 );
case(1) {
list<ascii> list1:
dynamic_size( packageLength );
};
case(2): include_prefix {
ascii packageId_3: int(base10), static_size(1),
encode_value(3), external_only;
ascii packageLength_3: int(base10), static_size(1),
encode_value(case_size - 2), external_only;
ascii body_3: dynamic_size( packageLength_3 );
};
default: include_prefix {
list<ascii> defaultContent:
dynamic_size( packageLength + 2 );
};
};
}; |