preset.h 772 B

1234567891011121314151617181920212223242526272829303132
  1. #pragma once
  2. #include "common.h"
  3. #include "arg.h"
  4. #include <string>
  5. #include <vector>
  6. #include <map>
  7. //
  8. // INI preset parser and writer
  9. //
  10. constexpr const char * COMMON_PRESET_DEFAULT_NAME = "default";
  11. struct common_preset {
  12. std::string name;
  13. // TODO: support repeated args in the future
  14. std::map<common_arg, std::string> options;
  15. // convert preset to CLI argument list
  16. std::vector<std::string> to_args() const;
  17. // convert preset to INI format string
  18. std::string to_ini() const;
  19. // TODO: maybe implement to_env() if needed
  20. };
  21. // interface for multiple presets in one file
  22. using common_presets = std::map<std::string, common_preset>;
  23. common_presets common_presets_load(const std::string & path, common_params_context & ctx_params);