Gemmi C++ API
Loading...
Searching...
No Matches
to_json.hpp
Go to the documentation of this file.
1// Copyright 2017 Global Phasing Ltd.
2
3// Writing cif::Document or its parts as JSON (mmJSON, CIF-JSON, etc).
4
5#ifndef GEMMI_TO_JSON_HPP_
6#define GEMMI_TO_JSON_HPP_
7#include <ostream> // for ostream
8#include "cifdoc.hpp"
9
10namespace gemmi {
11namespace cif {
12
14 bool as_comcifs = false; // conform to the COMCIFS CIF-JSON draft
15 bool group_ddl2_categories = false; // for mmJSON
16 bool with_data_keyword = false; // for mmJSON
17 bool bare_tags = false; // "tag" instead of "_tag"
18 bool values_as_arrays = false; // "_tag": ["value"]
19 bool lowercase_names = true; // write case-insensitive names as lower case
20 int quote_numbers = 1; // 0=never (no s.u.), 1=mix, 2=always
21 std::string cif_dot = "null"; // how to convert '.' from CIF
22
25 opt.as_comcifs = true;
26 opt.values_as_arrays = true;
27 opt.quote_numbers = 2;
28 opt.cif_dot = "false";
29 return opt;
30 }
31
34 opt.group_ddl2_categories = true;
35 opt.with_data_keyword = true;
36 opt.bare_tags = true;
37 opt.values_as_arrays = true;
38 opt.lowercase_names = false;
39 opt.quote_numbers = 0;
40 return opt;
41 }
42};
43
44GEMMI_DLL void write_json_to_stream(std::ostream& os, const Document& doc,
46
47inline void write_mmjson_to_stream(std::ostream& os, const Document& doc) {
49}
50
51} // namespace cif
52} // namespace gemmi
53#endif
struct Document that represents the CIF file (but can also be read from a different representation,...
#define GEMMI_DLL
Definition fail.hpp:53
void write_mmjson_to_stream(std::ostream &os, const Document &doc)
Definition to_json.hpp:47
GEMMI_DLL void write_json_to_stream(std::ostream &os, const Document &doc, const JsonWriteOptions &options)
static JsonWriteOptions comcifs()
Definition to_json.hpp:23
static JsonWriteOptions mmjson()
Definition to_json.hpp:32