Chlumsky/json-cpp-gen

Name aliases in configuration

Chlumsky opened this issue · 1 comments

Since #1 will not be implemented for a while, there needs to be another way to resolve cases where JSON field names (or even enumeration values) are not valid C++ names, e.g. protected (reserved keyword) or value-with-dashes, or when the user wants the JSON names to be different for whatever reason.

It should be possible to provide both a simple dictionary applied to all enum values and member variable names, as well as qualified names for specific enums / structures only, e.g.:

"nameAliases": {
    "ENUM_VAL": "enum-val-as-it-appears-in-json",
    "SpecificEnum::ENUM_VAL": "enum-val-of-SpecificEnum",
    "MyStructure::bProtected": "protected"
}