On 22 juil, 13:41, Srivats P <pstav...@gmail.com> wrote: > Hi, > > As per CHANGES.txt for "2009-05-13 version 2.1.0" > <snip> > * For each field, the generated code contains an integer constant assigned > to the field number. For example, the .proto file: > message Foo { optional int bar_baz = 123; } > would generate the following constants, all with the integer value 123: > C++: Foo::kBarBazFieldNumber > Java: Foo.BAR_BAZ_FIELD_NUMBER > Python: Foo.BAR_BAZ_FIELD_NUMBER > Constants are also generated for extensions, with the same naming scheme. > These constants may be used as switch cases. > </snip> > > All my .proto files use a global namespace via the "package MyProto" > directive. > > The constants for members of message Foo are in the MyProto::Foo > namespace while extension members of Foo are in the MyProto:: > namespace (not MyProto::Foo). Is this intentional? If so, the above > changelog snippet seems to indicate otherwise.
I believe this is intended: http://code.google.com/apis/protocolbuffers/docs/reference/cpp-generated.html#extension extension fields are generate in the scope the "extend" is declared in your .proto. If you declared the "extend Foo" at the top-level, then the fields are generated at the package level. -- 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.