[protobuf] Generated Comments

2011-05-06 Thread Ben Wright
I was wondering if there was any convenient way to add comments into
a .proto file that would be included in generated code for context
help.

If not, is there an existing plug-in project anyone knows of that
provides anything like that?

i.e.

message Foo {
option documentation = A Foo message, must contain Bar!;
required Bar bar = 1 [documentation=A Bar value, be sure to
consider the implications of Foo.];
}

Maybe this is something that should be considered / could be a code
generator plugin for protoc?

-- 
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.



[protobuf] Can a builder automatically create *repeated* message fields as needed?

2011-05-06 Thread George Hawkins
I thought I would be able to do something like:

fooBuilder.getBarBuilder(index).setBlah(123);

But instead I have to explicitly ensure that a BarBuilder with the
given index already exists by adding a line like the following before
the one above:

while (index = fooBuilder.getBarBuilderCount())
fooBuilder.addBarBuilder();

Is there any way to avoid this? Am I missing an alternative method on
my containing builder, i.e. FooBuilder in my example, that would
automatically create the necessary repeated field builders if an
attempt is made to retrieve one where none already exists for the
given index.

I need to build up a highly nested structure, with the data for this
structure streaming in from source X in a fairly random order - I
don't want to check as I receive each data item that any repeating
containing parents, of the field where this data item should go,
already exist.

I'm just hoping I've missed something but maybe this is an unusual
case and so isn't directly supported - if so fair enough :)

/George

-- 
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.



[protobuf] protobuf wrapper trouble

2011-05-06 Thread ProfX
Hello!
I want to create static lib, which exports wrapper of prtobuf-generated 
class, but encountered such a problem:

1. building static library (Msg):

//msgbuf.proto 
message MsgBuf{
required int32 val = 1;
}

//msg.h---
class MsgBuff;

class Msg{
MsgBuff *ioBuf;
public:
int value() const;
};

//msg.cpp
#include msg.h
#include msgbuf.pb.h

Msg::Msg{
ioBuf = new MsgBuf;
}

int Msg::value() const {
return ioBuf-val();
}


thus lib project includes:
HEADERS += msg.h msgbuf.pb.h
SOURCES += msg.cpp msgbuf.pb.cc
INCLUDEPATH += path_to_protobuf_include
LIBS += -Lpath_to_protobuf_lib -lprotobuf

static library compilation is successful.

2. Further, if the resulting static library to linked to test app

//main.cpp
#include msg.h

int main(){
Msg m;
return 0;
}

lib project includes:
HEADERS+= msg.h
SOURCES += main.cpp
LIBS += -Lpath_to_libMsg -lMsg

then I get a long list of errors:

./libMsg.a(msgbuf.pb.o): In function 
`Z34protobuf_AssignDesc_msgbuf_2eprotov':

path_to_Msg/msgbuf.pb.cc:29: undefined reference to 
`google::protobuf::DescriptorPool::generated_pool()'

path_to_Msg /msgbuf.pb.cc:29: undefined reference to 
`google::protobuf::DescriptorPool::FindFileByName(std::string const) const'

path_to_Msg /msgbuf.pb.cc:30: undefined reference to 
`google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, 
char const*, int)'

path_to_Msg /msgbuf.pb.cc:30: undefined reference to 
`google::protobuf::internal::LogMessage::operator(char const*)'


and so on...

please help me solve this problem.

Sorry for my English.

-- 
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.