Chlumsky/json-cpp-gen

Allow specifying basic type aliases in configuration file

Opened this issue · 0 comments

If a basic type alias such as

typedef unsigned char byte;

is encountered by header parser, there is no problem. But if it is present in a non-parsed include file, there is no way to recover this information other than to add it as input. It needs to be possible to define custom basic types (their aliases) in the configuration file just like it is possible to define container templates.

I am not entirely sure if these types should just be regular aliases, because I would usually prefer the aliased name (byte) to be used in the parser code. The underlying type still cannot be changed without re-generating the parser though, because the actual implementation of its parsing would have to change, so there isn't really a functional reason to not treat it as a plain alias. Maybe it could work so that if an alias is specified in reverse (e.g. implying that unsigned char is the alias of byte), and only the alias name is recognized, the program could fully rename the actual type and move its original name to become an alias, causing all instances of the basic type to show up as the alias in the parser.