Is it possible to delete one item of a 'repeated' message field (in Python)
I'm building a generic gpb editor, that can create gpb encoded files. The UI is completely dynamic, based on the .proto files that one chooses (http://github.com/bvdeenen/gpbedit/tree/master) In this editor I'm currently generating a gpb object on the fly, but since it's a gui editor, it is necessary to delete one item anywhere in a range of 'repeated' items. Is this currently possible with the python interface (ClearField removes all items of a repeated field)? Or should I hack around it, or maybe have a separate data representation and only build the gpb object when I'm done editting. (That's probably the easiest). Thanks Bart --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@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: Is it possible to delete one item of a 'repeated' message field (in Python)
I think this was added in rev 90: http://code.google.com/p/protobuf/source/detail?r=90 But it hasn't made it into an official release yet. On Thu, Feb 19, 2009 at 7:12 AM, bart van deenen bart.vandee...@gmail.comwrote: I'm building a generic gpb editor, that can create gpb encoded files. The UI is completely dynamic, based on the .proto files that one chooses (http://github.com/bvdeenen/gpbedit/tree/master) In this editor I'm currently generating a gpb object on the fly, but since it's a gui editor, it is necessary to delete one item anywhere in a range of 'repeated' items. Is this currently possible with the python interface (ClearField removes all items of a repeated field)? Or should I hack around it, or maybe have a separate data representation and only build the gpb object when I'm done editting. (That's probably the easiest). Thanks Bart --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@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: Problem with dynamic __import__ of gpb modules
+petar, who may be able to answer this. On Wed, Feb 18, 2009 at 6:48 AM, bart van deenen bart.vandee...@gmail.comwrote: Hi I'm building a generic editor for creating loading and saving gpb objects and am running into problems with dynamic __import__ statements. I've nailed it down to a very simple testcase. This is all with python 2.5.2 and protobuf 2.0.3 on Linux. test.proto: message test {optional int32 x=1; } C.py: class K: def __init__(self): print new K import test_pb2, C a=getattr(test_pb2,test) a class 'test_pb2.test' b=getattr(C,K) b class C.K at 0xb64ceddc Why is one of the classnames in quotes, and the other not? When I try a dynamic import I've narrowed my problem down to : #!/usr/bin/python def test(): for module,klass in [('test_pb2','test'), ('C', 'K')]: m=__import__(module) k=getattr(m, klass) print *, m, k, type(k) print k() test() Which when run gives me the following * module 'test_pb2' from 'gpbedit/test_pb2.pyc' class 'test_pb2.test' class 'google.protobuf.reflection.GeneratedProtocolMessageType' new k= * module 'C' from '...gpbedit/C.pyc' C.K type 'classobj' new k= new K C.K instance at 0xb7d2764c When I try to create a protocol object of the 'test' type, my python script returns None. So where does this go wrong? Bart P.S. the editor is at http://github.com/bvdeenen/gpbedit/tree/master. It's still alpha quality, but it is capable of editing proto objects and generating a gui from proto files --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@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 -~--~~~~--~~--~--~---
C++ to Java and vice versa
A Quick newbie question: Can i use Protocol Buffers to serialize in c+ + and deserialize in java? Basically I need to transfer data from a c+ + layer to Java and we were planning to use XML. I was wondering whether Protocol Buffer can be used instead. thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@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: C++ to Java and vice versa
Yes, this is exactly what we're all excited about :) /Magnus -Original Message- From: protobuf@googlegroups.com [mailto:proto...@googlegroups.com] On Behalf Of iyer...@gmail.com Sent: den 20 februari 2009 08:50 To: Protocol Buffers Subject: C++ to Java and vice versa A Quick newbie question: Can i use Protocol Buffers to serialize in c+ + and deserialize in java? Basically I need to transfer data from a c+ + layer to Java and we were planning to use XML. I was wondering whether Protocol Buffer can be used instead. thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@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 -~--~~~~--~~--~--~---