CASM  1.1.0
A Clusters Approach to Statistical Mechanics
json_io_impl.hh
Go to the documentation of this file.
1 #ifndef CASM_app_json_io_impl
2 #define CASM_app_json_io_impl
3 
5 
6 namespace CASM {
7 
10 template <typename OptionType>
11 jsonParser make_json_input(const OptionType &opt) {
12  if (!opt.settings_path().empty()) {
13  return jsonParser{opt.settings_path()};
14  } else if (!opt.input_str().empty()) {
15  return jsonParser::parse(opt.input_str());
16  } else {
17  return jsonParser::object();
18  }
19 }
20 
21 } // namespace CASM
22 
23 #endif
static jsonParser object()
Returns an empty json object.
Definition: jsonParser.hh:395
static jsonParser parse(const std::string &str)
Construct a jsonParser from a string containing JSON data.
Definition: jsonParser.hh:382
Main CASM namespace.
Definition: APICommand.hh:8
jsonParser make_json_input(const OptionType &opt)
Definition: json_io_impl.hh:11