[protobuf] Re: Issue 199 in protobuf: How can I get the data packet of the right format from Linux in Windows?

2010-06-21 Thread protobuf


Comment #3 on issue 199 by baiming...@gmail.com: How can I get the data  
packet of the right format from Linux in Windows?

http://code.google.com/p/protobuf/issues/detail?id=199

haha~ Actually I have not known that before today morning. Thank you~

--
You received this message because you are subscribed to the Google Groups Protocol 
Buffers group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



[protobuf] Way to figure out the fields that are modified

2010-06-21 Thread Ananth Arockia
Hello,

I am exploring protobuf to use it in my project.

I would like to have a message defined in a .proto file. All the
fields in this message would be optional due to the fact that the
message producer in my project context would set just a subset of
fields. Can someone please clarify

1. Is there a way to figure out just the fields that are being set in
the message? I would require this after my message is deserialized.
2. does field_count() always return the total number of fields defined
in the message in .proto?
3. Is Reflection the only option to set fields directly/indirectly via
field numbers?

Thanks, Ananth

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Way to figure out the fields that are modified

2010-06-21 Thread Jason Hsueh
On Mon, Jun 21, 2010 at 8:23 AM, Ananth Arockia ananth.aroc...@gmail.comwrote:

 Hello,

 I am exploring protobuf to use it in my project.

 I would like to have a message defined in a .proto file. All the
 fields in this message would be optional due to the fact that the
 message producer in my project context would set just a subset of
 fields. Can someone please clarify

 1. Is there a way to figure out just the fields that are being set in
 the message? I would require this after my message is deserialized.


You can check the has() bits (see the tutorial:
http://code.google.com/apis/protocolbuffers/docs/tutorials.html)
Alternatively, you can define your protocol such that if the field is set,
it is not equal to the default value. Then instead of testing has_foo(), you
could test foo() != 0 (or whatever the default is).


 2. does field_count() always return the total number of fields defined
 in the message in .proto?


Assuming you mean Descriptor::field_count(), yes.


 3. Is Reflection the only option to set fields directly/indirectly via
 field numbers?


You could also generate the serialized format by hand and then merge that
into your message...but Reflection is friendlier :-)


 Thanks, Ananth

 --
 You received this message because you are subscribed to the Google Groups
 Protocol Buffers group.
 To post to this group, send email to proto...@googlegroups.com.
 To unsubscribe from this group, send email to
 protobuf+unsubscr...@googlegroups.comprotobuf%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/protobuf?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.