Re: [protobuf] DescriptorPool: call to FindFileByName() required before call to FindMessageTypeByName()?

2012-06-05 Thread Dan
Thanks for the update Jason. I'll make sure to iterate over the directory 
and call FindFileByName() on each .proto I plan to use

On Monday, June 4, 2012 4:06:39 PM UTC-7, Jason Hsueh wrote:
>
> This is a result of SourceTreeDescirptorDatabase not implementing 
> FindFileContainingSymbol() - it doesn't maintain an index of the types 
> available in the database within the database, just the list of files that 
> are available. This is a sufficient implementation for the proto compiler, 
> where one specifies the files to build and thus FindFileByName() is always 
> called.
>
> I'm not aware of any DescriptorDatabase implementations that have all the 
> types within a source tree indexed - various Google-internal 
> implementations don't support this either, as there are so many .proto 
> files that it's typically not useful to load all of them, and we have 
> clients specify the leaf file explicitly.
>
> On Wed, May 30, 2012 at 1:16 PM, Dan  wrote:
>
>> Hi,
>> In the code below, I've found that the returned Descriptor* is NULL after 
>> I call FindMessageTypeByName(), *unless* I first call FindFileByName() 
>> on the .proto which contains the Message I am looking for.
>>
>> Is this a bug? Is there another way to do this? I would really like to be 
>> able to setup a SourceTreeDescriptorDatabase to a directory that contains 
>> all of the .proto files I plan to use and not have to search for each file 
>> individually.
>>
>> Any advice is much appreciated.
>>
>> thanks,
>> Dan
>>
>>
>> string sProtoRoot("/home/dan/tests/new-protobuf/protos");
>>
>> DiskSourceTree dst;
>> dst.MapPath("", sProtoRoot);
>>
>> SourceTreeDescriptorDatabase stdb(&dst);
>>
>> DescriptorPool dp(&stdb);
>> const FileDescriptor* pfd = dp.FindFileByName("TestMessage.proto");
>> const Descriptor* pd = dp.FindMessageTypeByName("Test.TestMessage");
>>
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Protocol Buffers" group.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msg/protobuf/-/V3u8UREKOEAJ.
>> 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.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/protobuf/-/K0hsd8JOtLQJ.
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: [protobuf] DescriptorPool: call to FindFileByName() required before call to FindMessageTypeByName()?

2012-06-04 Thread Jason Hsueh
This is a result of SourceTreeDescirptorDatabase not implementing
FindFileContainingSymbol() - it doesn't maintain an index of the types
available in the database within the database, just the list of files that
are available. This is a sufficient implementation for the proto compiler,
where one specifies the files to build and thus FindFileByName() is always
called.

I'm not aware of any DescriptorDatabase implementations that have all the
types within a source tree indexed - various Google-internal
implementations don't support this either, as there are so many .proto
files that it's typically not useful to load all of them, and we have
clients specify the leaf file explicitly.

On Wed, May 30, 2012 at 1:16 PM, Dan  wrote:

> Hi,
> In the code below, I've found that the returned Descriptor* is NULL after
> I call FindMessageTypeByName(), *unless* I first call FindFileByName() on
> the .proto which contains the Message I am looking for.
>
> Is this a bug? Is there another way to do this? I would really like to be
> able to setup a SourceTreeDescriptorDatabase to a directory that contains
> all of the .proto files I plan to use and not have to search for each file
> individually.
>
> Any advice is much appreciated.
>
> thanks,
> Dan
>
>
> string sProtoRoot("/home/dan/tests/new-protobuf/protos");
>
> DiskSourceTree dst;
> dst.MapPath("", sProtoRoot);
>
> SourceTreeDescriptorDatabase stdb(&dst);
>
> DescriptorPool dp(&stdb);
> const FileDescriptor* pfd = dp.FindFileByName("TestMessage.proto");
> const Descriptor* pd = dp.FindMessageTypeByName("Test.TestMessage");
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/protobuf/-/V3u8UREKOEAJ.
> 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.
>

-- 
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] DescriptorPool: call to FindFileByName() required before call to FindMessageTypeByName()?

2012-05-30 Thread Dan
Hi,
In the code below, I've found that the returned Descriptor* is NULL after I 
call FindMessageTypeByName(), *unless* I first call FindFileByName() on the 
.proto which contains the Message I am looking for.

Is this a bug? Is there another way to do this? I would really like to be 
able to setup a SourceTreeDescriptorDatabase to a directory that contains 
all of the .proto files I plan to use and not have to search for each file 
individually.

Any advice is much appreciated.

thanks,
Dan


string sProtoRoot("/home/dan/tests/new-protobuf/protos");

DiskSourceTree dst;
dst.MapPath("", sProtoRoot);

SourceTreeDescriptorDatabase stdb(&dst);

DescriptorPool dp(&stdb);
const FileDescriptor* pfd = dp.FindFileByName("TestMessage.proto");
const Descriptor* pd = dp.FindMessageTypeByName("Test.TestMessage");

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/protobuf/-/V3u8UREKOEAJ.
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.