--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To post to this group, send email to prot...@googlegroups.com.
To unsubscribe from this group, send email to protobuf+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
-- message.proto --
enum Value {
V1 = 0;
V2 = 1;
V3 = 2;
}
message Message {
required Value value = 1;
required int32 integer = 2;
required string text = 3;
}
-- test.cpp --
#include "message.pb.h"
#include <iostream>
#include <string>
int main() {
std::string buffer;
{
Message m;
m.set_value(V1);
m.set_integer(27);
m.set_text("Hello World");
m.SerializeToString(&buffer);
}
{
Message m;
m.ParseFromString(buffer);
std::cout << "value = " << m.value() << '\n';
std::cout << "integer = " << m.integer() << '\n';
std::cout << "text = " << m.text() << '\n';
}
return 0;
}
-- console output --
value = 0
integer = 27
text = Hello World
-- end of copy --
Can you narrow it down a bit more from this?
Chris