| 84 | } |
| 85 | |
| 86 | google::protobuf::FieldDescriptorProto * |
| 87 | ProtobufDescriptor::addFieldToDescriptorPrimitiveType( |
| 88 | google::protobuf::DescriptorProto &Desc, const std::string &FieldName, |
| 89 | const Type &T) { |
| 90 | assert(T.isPrimitiveType() && "Unexpected Program State"); |
| 91 | google::protobuf::FieldDescriptorProto_Type FieldType; |
| 92 | if (T.isIntegerType()) { |
| 93 | if (T.isBoolean()) |
| 94 | FieldType = google::protobuf::FieldDescriptorProto::TYPE_BOOL; |
| 95 | else if (T.getTypeSize() == 8) { |
| 96 | FieldType = T.isUnsigned() |
| 97 | ? google::protobuf::FieldDescriptorProto::TYPE_UINT64 |
| 98 | : google::protobuf::FieldDescriptorProto::TYPE_SINT64; |
| 99 | } else { |
| 100 | FieldType = T.isUnsigned() |
| 101 | ? google::protobuf::FieldDescriptorProto::TYPE_UINT32 |
| 102 | : google::protobuf::FieldDescriptorProto::TYPE_SINT32; |
| 103 | } |
| 104 | } else if (T.isFloatType()) { |
| 105 | FieldType = T.getTypeSize() == 8 |
| 106 | ? google::protobuf::FieldDescriptorProto::TYPE_DOUBLE |
| 107 | : google::protobuf::FieldDescriptorProto::TYPE_FLOAT; |
| 108 | } else { // Unknown Type |
| 109 | return nullptr; |
| 110 | } |
| 111 | return addFieldToDescriptor(Desc, FieldName, FieldType); |
| 112 | } |
| 113 | |
| 114 | google::protobuf::FieldDescriptorProto * |
| 115 | ProtobufDescriptor::addFieldToDescriptorEnumType( |
nothing calls this directly
no test coverage detected