12 #include "boost/foreach.hpp" 13 #include "boost/property_tree/ptree.hpp" 14 namespace bpt = boost::property_tree;
15 #include "boost/tokenizer.hpp" 23 std::vector<std::string> cols;
27 typedef boost::tokenizer<boost::char_separator<char> >
tokenizer;
28 typedef tokenizer::const_iterator iterator;
29 boost::char_separator<char>
separator(
",\t");
30 tokenizer tok(line, separator);
31 BOOST_FOREACH(std::string
const& col_name, tok) {
32 if( col_name.empty() ) BOOST_THROW_EXCEPTION(
34 << Err::msg_t(
"empty column name")
36 cols.push_back(col_name);
39 for(
int line_num = 2; getline(is, line); ++line_num ) {
40 tokenizer tok(line, separator);
41 iterator i = tok.begin();
42 if( i.at_end() )
continue;
44 for( std::size_t
n = 0; ! i.at_end(); ++i, ++
n ) {
45 if(
n == cols.size() ) BOOST_THROW_EXCEPTION(
47 << Err::msg_t(
"too many values")
48 << Err::line_t(line_num)
52 pt.push_back(bpt::ptree::value_type(
"", pt1));
Definition: file_properties.hpp:59
Main namespace of vdj_pipe library.
Definition: keywords_variable.hpp:11
boost::tokenizer< boost::char_separator< char > > tokenizer
Definition: me_factory.cpp:34
const std::size_t n
Definition: vector_set_test.cpp:26
bpt::ptree ptree
Definition: processing_step_utils.hpp:19
void input_csv_to_tree(std::istream &is, bpt::ptree &pt)
Convert input data descriptions in CSV format into property tree.
Definition: input_csv.hpp:22
boost::char_separator< char > separator(",\t|")