protobuf-c/protobuf-c — pull request #173 by lipnitsk (2014-11-05 23:40:34+00:00)
Title: Implement oneof support

Starting a Pull Request to fix #162, but a few things still need to be resolved:
- [ ] Need to finalize the exact casing and syntax for the union field selector enumeration:
Currently, the following test.proto:
```protobuf
package foo;
message some_msg {
oneof test_oneof {
int32 test_int32 = 1;
}
}
```

generates the following test.pb-c.h:
```c
typedef enum {
Foo__SomeMsg__TestOneof_case_none_e = 0,
Foo__SomeMsg__TestOneof_test_int32_e = 1,
} Foo__SomeMsg__TestOneof_case_t;

struct _Foo__SomeMsg
{
ProtobufCMessage base;
Foo__SomeMsg__TestOneof_case_t TestOneof_case;
union {
int32_t test_int32;
} TestOneof;
};
#define FOO__SOME_MSG__INIT \
{ PROTOBUF_C_MESSAGE_INIT (&foo__some_msg__descriptor) \
, Foo__SomeMsg__TestOneof_case_none_e, {} }
```

- [ ] Need to add tests and make sure logic works according to the Google parsing spec for edge cases, such as unpacking multiple oneof fields from the wire.