Jpp  master_rocky-43-ge265d140c
the software that should make you happy
csv2python.cc
Go to the documentation of this file.
1 #include "csv2python.hh"
2 
3 template <>
4 void convertHeader<PYTHON>(std::ostream& out, const Header& header) {
5  out << "# -*- coding: utf-8 -*-\n";
6  out << "\"\"\"\n";
7 
8  out << header.description << "\n";
9  out << header.url << "\n";
10  out << "\"\"\"\n";
11  out << "\n";
12  out << "# " << header.base << "\n";
13 }
14 
15 template <>
16 void convertCSV<PYTHON>(std::ostream& out, const CSV& csv) {
17  out << "data = dict(\n";
18  for (auto i = 0; i < csv.types.size(); i++) {
19  out << " " << csv.names[i] << "=" << csv.numbers[i] << ",\n";
20  }
21  out << ")\n";
22 }
void convertCSV< PYTHON >(std::ostream &out, const CSV &csv)
Definition: csv2python.cc:16
void convertHeader< PYTHON >(std::ostream &out, const Header &header)
Definition: csv2python.cc:4
Definition: csv2code.hh:15
std::vector< std::string > numbers
Definition: csv2code.hh:18
std::vector< std::string > types
Definition: csv2code.hh:16
std::vector< std::string > names
Definition: csv2code.hh:17
std::string description
Definition: csv2code.hh:10
std::string base
Definition: csv2code.hh:9
std::string url
Definition: csv2code.hh:11