feat: add OptionFlags for ArgOptions; complete SDGenerationParams to_json/from_json conversion#1277
Open
donington wants to merge 1 commit intoleejet:masterfrom
Open
feat: add OptionFlags for ArgOptions; complete SDGenerationParams to_json/from_json conversion#1277donington wants to merge 1 commit intoleejet:masterfrom
donington wants to merge 1 commit intoleejet:masterfrom
Conversation
…json/from_json conversion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
OptionFlagsto 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.options_to_jsonandoptions_from_json. These are designed to be generic, able to take an option parameter class and it's corresponding parsed ArgOptions. Theto_jsonvariant 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 oldto_json_strformatting (underscores instead of dashes). To use this function with an option parameter class, it will need to implementmanual_options_to_json(std::vector<ManualOptions> const&, json&)andmanual_options_from_json(std::vector<ManualOptions>&, json const&)to finalize the conversion for the manual options.SDGenerationParams, as these are the parameters that are most relevant for network transfer to/from the client and server. I also addedjson to_json(ArgOptions const&)andvoid from_json(json const&)convenience methods.