| 61 | } |
| 62 | |
| 63 | google::protobuf::FieldDescriptorProto * |
| 64 | ProtobufDescriptor::addFieldToDescriptor( |
| 65 | google::protobuf::DescriptorProto &Desc, const std::string &FieldName, |
| 66 | const Type &T) { |
| 67 | bool Array = false; |
| 68 | const auto *BaseType = &T; |
| 69 | if (BaseType->isFixedLengthArrayPtr() && !BaseType->isStringType()) { |
| 70 | Array = true; |
| 71 | BaseType = BaseType->getPointeeType(); |
| 72 | } |
| 73 | google::protobuf::FieldDescriptorProto *Field = nullptr; |
| 74 | if (BaseType->isPointerType()) { |
| 75 | Field = addFieldToDescriptorPointerType(Desc, FieldName, *BaseType); |
| 76 | } else if (BaseType->isEnumType()) { |
| 77 | Field = addFieldToDescriptorEnumType(Desc, FieldName, *BaseType); |
| 78 | } else if (BaseType->isPrimitiveType()) { |
| 79 | Field = addFieldToDescriptorPrimitiveType(Desc, FieldName, *BaseType); |
| 80 | } |
| 81 | if (Field && Array) |
| 82 | Field->set_label(google::protobuf::FieldDescriptorProto::LABEL_REPEATED); |
| 83 | return Field; |
| 84 | } |
| 85 | |
| 86 | google::protobuf::FieldDescriptorProto * |
| 87 | ProtobufDescriptor::addFieldToDescriptorPrimitiveType( |
nothing calls this directly
no test coverage detected