GP-3590 Send void as normal core type

This commit is contained in:
caheckman 2023-07-28 18:00:37 +00:00
parent a961b069a4
commit b69840c347
3 changed files with 28 additions and 2 deletions

View file

@ -754,6 +754,23 @@ void TypeUnicode::encode(Encoder &encoder) const
encoder.closeElement(ELEM_TYPE);
}
/// Parse a \<type> element for the \b id attributes of the \b void data-type.
/// The \b void data-type is usually marshaled with the \<void> element, but this is an alternate
/// encoding that allows a specific id to be associated with the data-type when core data-types are specified.
/// \param decoder is the stream decoder
/// \param typegrp is the factory owning \b this data-type
void TypeVoid::decode(Decoder &decoder,TypeFactory &typegrp)
{
for(;;) {
uint4 attrib = decoder.getNextAttributeId();
if (attrib == 0) break;
if (attrib == ATTRIB_ID) {
id = decoder.readUnsignedInteger();
}
}
}
void TypeVoid::encode(Encoder &encoder) const
{
@ -4070,6 +4087,13 @@ Datatype *TypeFactory::decodeTypeNoRef(Decoder &decoder,bool forcecore)
case TYPE_CODE:
ct = decodeCode(decoder,false, false, forcecore);
break;
case TYPE_VOID:
{
TypeVoid voidType;
voidType.decode(decoder,*this);
ct = findAdd(voidType);
}
break;
default:
for(;;) {
uint4 attribId = decoder.getNextAttributeId();

View file

@ -326,6 +326,7 @@ public:
class TypeVoid : public Datatype {
protected:
friend class TypeFactory;
void decode(Decoder &decoder,TypeFactory &typegrp); ///< Restore \b void data-type, with an id
public:
/// Construct from another TypeVoid
TypeVoid(const TypeVoid &op) : Datatype(op) { flags |= Datatype::coretype; }