我的协议缓冲区消息中有一个UpdateType枚举
我想使用反射修改它,因为我需要EnumDescriptor。
Google protocol buffers Documentation说
#include <google/protobuf/descriptor.h>
namespace google::protobuf
Describes an enum type defined in a .proto file.
To get the EnumDescriptor for a generated enum type, call TypeName_descriptor(). Use DescriptorPool to construct your own descriptors.
我如何获得EnumDescriptor? TypeName_descriptor()函数在哪里?
答案 0 :(得分:1)
您可以从FieldDescriptor获取enum_descriptor。
只需使用FiledDescriptor :: enum_type()来获取EnumDescriptor *
希望它有所帮助!!