IMPLEMENT support of custom scalar types (/!\ swift not supported) #207

Merged
merged 2 commits into from Aug 7, 2014

3 participants

@QuentinArnault

This is my proposition tu resolve issue #162.

To specify a custom scalar type you have to add to your Entity attribute user info a new item with key "attributeValueScalarType" and your custom scalar type as value.

During generation, for int16_t, int32_t, int64_t scalar types, if "attributeValueScalarType" key exists, the custom scalar type is copied into generated file.

If this custom scalar type is not visible from the machine generated header file (i.e. : not present in your pch file), it is possible to define an additional header file name.

It is possible to add to your Entity user info a new item with key "additionalHeaderFileName" and your additional header file name.

During generation, if this key is present, a new import line is added to the generated machine header file.

Warning : Swift is not supported, I do not know (yet) Swift. Feel free to add this support.

@AliSoftware

👍 Waiting for the support of custom type (especially for enums) for a long time!

@AliSoftware

Actually your code seems pretty compatible with Swift already.

If the developer uses Swift, it's up to him/her to provide the right type name in the attributeValueScalarType key. It's only if the key is not present that mogenerator itself should choose between int16_t and Int16 for example, but if the developer for the scalar type using the attributeValueScalarType key then it's their responsibility to enter a valid type name.

So probably the only missing thing to fully support this modification in the Swift side is to apply the same modifications that are present for the Objective-C template to the Swift template, to add the import directive when an additionalHeaderFileName is present, and that's it!

@rentzsch rentzsch added this to the 1.28 milestone Jun 26, 2014
@rentzsch rentzsch merged commit 4a57ef9 into rentzsch:master Aug 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment