[protobuf] Re: Why does protoc convert properties name with 'Url' suffix to 'URL' when converting Objective-C?
The protos style guide for fields: https://developers.google.com/protocol-buffers/docs/style#message_and_field_names > Use underscore_separated_names for field names (including oneof field and extension names) – for example, song_name To make the generated ObjC code a better fit for ObjC conventions, it attempts break things apart into the segments and apply Apple's naming guidelines when building the names. Those include turning some acronym into allcaps. On Tuesday, November 9, 2021 at 9:28:41 PM UTC-5 cedr...@gmail.com wrote: > eg > message User { string logoUrl } @interface User @property logoURL; @end > > I see that you have > a kUpperSegmentsList in > src/google/protobuf/compiler/objectivec/objectivec_helpers.cc. > What is the use of this? It causes the url in the property name to be > converted to all-caps. > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/8bd7d20d-6dc3-472f-86d1-1ea8f6eeebd7n%40googlegroups.com.
[protobuf] How to get a field object using name in proto3 like MutableExtension
Hello everyone, Intro: My company is in the process of migrating schemas from proto2 to proto3. I am eliminating extensions as they are not supported. Question: I am wondering if it is possible to get a field object using it's name. Example: In proto2, my current code looks like this: *> Foo.proto* message Foo { message Bar { unint32 a = 1; } extend Foo { Bar b = 1; } } *> in C++* *Foo::Bar b_val = foo.MutableExtension(Foo::b);* Now in proto3, I could do this: *> Foo.proto* syntax="proto3"; message Foo { message Bar { unint32 a = 1; } Bar b = 1; } *> in C++* *Foo::Bar b_val = foo.mutable_b();* However, I want to use the name Foo::b to get a Foo::Bar object. Is there a way to do this? If there is, which one is recommended? Thanks, Mihir -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/4b958fe0-5ec9-4fd9-99a9-cf096e6ff289n%40googlegroups.com.