Debian Codegraph @

avogadro/command/cjsontocml.cpp

raw
1 /******************************************************************************
2 This source file is part of the Avogadro project.
3 This source code is released under the 3-Clause BSD License, (see "LICENSE").
4 ******************************************************************************/
5 #include "avogadro/core/molecule.h"
6 #include "avogadro/io/fileformatmanager.h"
7
8 #include <iostream>
9 #include <sstream>
10 #include <string>
11
12 using Avogadro::Core::Molecule;
13 using Avogadro::Io::FileFormatManager;
14 using std::cin;
15 using std::cout;
16 using std::ostringstream;
17 using std::string;
18
19 int main()
20 {
21
22 FileFormatManager& mgr = FileFormatManager::instance();
23 Molecule mol;
24
25 ostringstream cjson;
26
27 string line;
28 while (getline(cin, line)) {
29 cjson << line;
30 }
31
32 mgr.readString(mol, cjson.str(), "cjson");
33 string cml;
34 mgr.writeString(mol, cml, "cml");
35 cout << cml;
36 }