MCPcopy Create free account
hub / github.com/apache/brpc / field_to_string

Function field_to_string

src/mcpack2pb/generator.cpp:57–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55}
56
57const std::string field_to_string(const google::protobuf::FieldDescriptor* f) {
58 switch (f->type()) {
59 case google::protobuf::FieldDescriptor::TYPE_DOUBLE: return "double";
60 case google::protobuf::FieldDescriptor::TYPE_FLOAT: return "float";
61 case google::protobuf::FieldDescriptor::TYPE_INT64: return "int64";
62 case google::protobuf::FieldDescriptor::TYPE_UINT64: return "uint64";
63 case google::protobuf::FieldDescriptor::TYPE_INT32: return "int32";
64 case google::protobuf::FieldDescriptor::TYPE_FIXED64: return "fixed64";
65 case google::protobuf::FieldDescriptor::TYPE_FIXED32: return "fixed32";
66 case google::protobuf::FieldDescriptor::TYPE_BOOL: return "bool";
67 case google::protobuf::FieldDescriptor::TYPE_STRING: return "string";
68 case google::protobuf::FieldDescriptor::TYPE_GROUP:
69 case google::protobuf::FieldDescriptor::TYPE_MESSAGE:
70 return butil::EnsureString(f->message_type()->name());
71 case google::protobuf::FieldDescriptor::TYPE_BYTES: return "bytes";
72 case google::protobuf::FieldDescriptor::TYPE_UINT32: return "uint32";
73 case google::protobuf::FieldDescriptor::TYPE_ENUM:
74 return butil::EnsureString(f->enum_type()->name());
75 case google::protobuf::FieldDescriptor::TYPE_SFIXED32: return "sfixed32";
76 case google::protobuf::FieldDescriptor::TYPE_SFIXED64: return "sfixed64";
77 case google::protobuf::FieldDescriptor::TYPE_SINT32: return "sint32";
78 case google::protobuf::FieldDescriptor::TYPE_SINT64: return "sint64";
79 }
80 return "unknown_protobuf_type";
81}
82
83const char* to_mcpack_typestr(const google::protobuf::FieldDescriptor* f) {
84 switch (f->type()) {

Callers 2

generate_parsingFunction · 0.85
generate_serializingFunction · 0.85

Calls 3

EnsureStringFunction · 0.85
typeMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected