Hi,

i'm currently required to use in some reflection style visitor pattern to 
extract the C++ type from the generated Proto Type.

For example a Proto file like this implementing some sort of general 
[Name,Value] structure:

message Int32 {
    extend Value {
        optional int32 value = 103;
    }
    required Int32 _v = 1;
}
message Float {
    extend Value {
        optional float value = 105;
    }
    required Float _v = 1;
}
message Double {
    extend Value {
        optional double value = 106;
    }
    required Double _v = 1;
}
message Bool {
    extend Value {
        optional bool value = 107;
    }
    required Bool _v = 1;
}

message KeyValue {
    required string key = 1;
    required Value  value = 2;
}

I futher need to access the corsiponding type ... currently this would look 
like this:

::google::protobuf::internal::ExtensionIdentifier< 
::Value,::google::protobuf::internal::PrimitiveTypeTraits< 
::google::protobuf::int32 >, 5, false >    getTypeExt(int32 i) {
    return Int32::value;
};

This is very error-prone and quirky... I would be so much simple if 
Protocol Buffers would generate the type like this:
  // nested types ----------------------------------------------------

  // accessors -------------------------------------------------------

  // required .Int32 _v = 1;
  inline bool has__v() const;
  inline void clear__v();
  static const int kVFieldNumber = 1;
  inline const ::Int32& _v() const;
  inline ::Int32* mutable__v();
  inline ::Int32* release__v();
  inline void set_allocated__v(::Int32* _v);

  static const int kValueFieldNumber = 103;
  typedef ::google::protobuf::internal::ExtensionIdentifier< ::Value,
      ::google::protobuf::internal::PrimitiveTypeTraits< 
::google::protobuf::int32 >, 5, false > value_t;
  static value_t value;

Is this somehow possible?

Thank you very much!

-- 
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 post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to