43 #ifndef GUM_CSV_PARSER_H 44 #define GUM_CSV_PARSER_H 50 #include <agrum/agrum.h> 77 template <
template<
typename>
class ALLOC = std::allocator>
82 using allocator_type = ALLOC<std::string>;
99 CSVParser( std::istream& in,
100 const std::string& delimiter =
",",
101 const char commentmarker =
'#',
102 const char quoteMarker =
'"',
103 const allocator_type& alloc = allocator_type () );
106 virtual ~CSVParser();
124 const std::vector<std::string,ALLOC<std::string>>& current()
const;
127 const std::size_t nbLine()
const;
130 void useNewStream ( std::istream& in,
131 const std::string& delimiter =
",",
132 const char commentmarker =
'#',
133 const char quoteMarker =
'"' );
138 #ifndef DOXYGEN_SHOULD_SKIP_THIS 141 void getNextTriplet__(
const std::string& str,
142 std::size_t& first_letter_token,
143 std::size_t& next_token,
144 std::size_t& last_letter_token,
145 std::size_t from )
const;
147 void tokenize__(
const std::string& str );
149 std::size_t correspondingQuoteMarker__(
const std::string& str,
150 std::size_t pos )
const;
154 std::string delimiter__;
155 std::string spaces__;
156 std::string delimiterPlusSpaces__;
157 std::size_t nbLine__;
158 char commentMarker__;
162 std::istream* instream__;
163 std::vector<std::string,ALLOC<std::string>> data__;
173 #include <agrum/tools/database/CSVParser_tpl.h>