Skip to content

feat: add OptionFlags for ArgOptions; complete SDGenerationParams to_json/from_json conversion#1277

Open
donington wants to merge 1 commit intoleejet:masterfrom
donington:options_json_conv
Open

feat: add OptionFlags for ArgOptions; complete SDGenerationParams to_json/from_json conversion#1277
donington wants to merge 1 commit intoleejet:masterfrom
donington:options_json_conv

Conversation

@donington
Copy link

This PR adds the functionality necessary to convert generic option param types to and from json using the ArgOptions. To achieve this, it adds a number of features:

  • adds OptionFlags to all of the Option types. This implements the ability to mark options as assigned during command line parsing, making it easier to iterate through options manually set by the caller. This also adds a no network tag to mark options that are not meant to be transferred over the network.
  • Utilizing this, I added options_to_json and options_from_json. These are designed to be generic, able to take an option parameter class and it's corresponding parsed ArgOptions. The to_json variant makes use of the assigned flag to only focus on parameters that were specifically declared by the caller. These functions operate on all of the basic ArgOptions types dynamically, converting the long_name into a json friendly expression matching the old to_json_str formatting (underscores instead of dashes). To use this function with an option parameter class, it will need to implement manual_options_to_json(std::vector<ManualOptions> const&, json&) and manual_options_from_json(std::vector<ManualOptions>&, json const&) to finalize the conversion for the manual options.
  • Finally, I added the manual options conversions into SDGenerationParams, as these are the parameters that are most relevant for network transfer to/from the client and server. I also added json to_json(ArgOptions const&) and void from_json(json const&) convenience methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant