CASM  1.1.0
A Clusters Approach to Statistical Mechanics
Import.cc
Go to the documentation of this file.
2 
3 typedef std::back_insert_iterator<std::vector<CASM::fs::path> >
5 typedef std::insert_iterator<std::set<CASM::fs::path> > set_path_inserter;
6 
7 namespace CASM {
8 namespace DB {
9 
11  _json["import"] = _set.import;
12  _json["copy_files"] = _set.copy_files;
13  _json["additional_files"] = _set.additional_files;
14  _json["overwrite"] = _set.overwrite;
15  return _json;
16 }
17 
18 jsonParser const &from_json(ImportSettings &_set, jsonParser const &_json) {
19  _set.set_default();
20 
21  if (_json.contains("import")) _set.import = _json["import"].get<bool>();
22 
23  if (_json.contains("copy_files"))
24  _set.copy_files = _json["copy_files"].get<bool>();
25 
26  if (_json.contains("additional_files"))
27  _set.additional_files = _json["additional_files"].get<bool>();
28 
29  if (_json.contains("overwrite"))
30  _set.overwrite = _json["overwrite"].get<bool>();
31 
32  return _json;
33 }
34 
35 template std::pair<vector_path_back_inserter, int>
37  const PrimClex &primclex, const Completer::ImportOption &import_opt,
39 
40 template std::pair<set_path_inserter, int>
42  const PrimClex &primclex, const Completer::ImportOption &import_opt,
43  set_path_inserter result);
44 
45 } // namespace DB
46 } // namespace CASM
PrimClex is the top-level data structure for a CASM project.
Definition: PrimClex.hh:55
bool contains(const std::string &name) const
Return true if JSON object contains 'name'.
Definition: jsonParser.cc:601
std::back_insert_iterator< std::vector< CASM::fs::path > > vector_path_back_inserter
Definition: Import.cc:4
std::insert_iterator< std::set< CASM::fs::path > > set_path_inserter
Definition: Import.cc:5
T get(Args &&... args) const
Get data from json, using one of several alternatives.
Definition: jsonParser.hh:716
jsonParser & to_json(ImportSettings const &_set, jsonParser &_json)
Definition: Import.cc:10
template std::pair< vector_path_back_inserter, int > construct_pos_paths< vector_path_back_inserter >(const PrimClex &primclex, const Completer::ImportOption &import_opt, vector_path_back_inserter result)
jsonParser const & from_json(ImportSettings &_set, jsonParser const &_json)
Definition: Import.cc:18
template std::pair< set_path_inserter, int > construct_pos_paths< set_path_inserter >(const PrimClex &primclex, const Completer::ImportOption &import_opt, set_path_inserter result)
Main CASM namespace.
Definition: APICommand.hh:8
PrimClex * primclex
Definition: settings.cc:135
Struct with optional parameters for Config/Data Import Specifies default parameters for all values,...
Definition: Import.hh:34