The way parsers and serializers are generated could be changed so that they are configurable with macro definitions rather than settings for the generator, with a notable exception of noThrow as that would result in a mess with function return types. This would also make it easier to check different versions of the generated functions as all would be visible simultaneously. The settings can be kept for default macro values, e.g.
#ifndef JSON_CPP_STRICT_SYNTAX_CHECK
#define JSON_CPP_STRICT_SYNTAX_CHECK 0
#endif
// In actual function:
#if JSON_CPP_STRICT_SYNTAX_CHECK
// ...
For checkMissingKeys and checkRepeatingKeys, this would work as
if (buffer == "firstKey") {
JSON_CPP_KEY_ENCOUNTERED(0, 0x00000001)
parseXYZ(value.firstKey);
continue;
}
with JSON_CPP_KEY_ENCOUNTERED being defined at the beginning of the file to either nothing, just flagging doneKeys, or also checking to throw a REPEATED_KEY based on the configuration macros.
The way parsers and serializers are generated could be changed so that they are configurable with macro definitions rather than settings for the generator, with a notable exception of
noThrowas that would result in a mess with function return types. This would also make it easier to check different versions of the generated functions as all would be visible simultaneously. The settings can be kept for default macro values, e.g.For
checkMissingKeysandcheckRepeatingKeys, this would work aswith
JSON_CPP_KEY_ENCOUNTEREDbeing defined at the beginning of the file to either nothing, just flaggingdoneKeys, or also checking to throw aREPEATED_KEYbased on the configuration macros.